ReactOS  0.4.15-dev-1206-g731eddf
afindic.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* afindic.c */
4 /* */
5 /* Auto-fitter hinting routines for Indic writing system (body). */
6 /* */
7 /* Copyright 2007-2018 by */
8 /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17 
18 
19 #include "aftypes.h"
20 #include "aflatin.h"
21 #include "afcjk.h"
22 
23 
24 #ifdef AF_CONFIG_OPTION_INDIC
25 
26 #include "afindic.h"
27 #include "aferrors.h"
28 
29 
30 #ifdef AF_CONFIG_OPTION_USE_WARPER
31 #include "afwarp.h"
32 #endif
33 
34 
35  static FT_Error
36  af_indic_metrics_init( AF_CJKMetrics metrics,
37  FT_Face face )
38  {
39  /* skip blue zone init in CJK routines */
40  FT_CharMap oldmap = face->charmap;
41 
42 
43  metrics->units_per_em = face->units_per_EM;
44 
45  if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
46  face->charmap = NULL;
47  else
48  {
49  af_cjk_metrics_init_widths( metrics, face );
50 #if 0
51  /* either need indic specific blue_chars[] or just skip blue zones */
52  af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars );
53 #endif
54  af_cjk_metrics_check_digits( metrics, face );
55  }
56 
57  FT_Set_Charmap( face, oldmap );
58 
59  return FT_Err_Ok;
60  }
61 
62 
63  static void
64  af_indic_metrics_scale( AF_CJKMetrics metrics,
65  AF_Scaler scaler )
66  {
67  /* use CJK routines */
68  af_cjk_metrics_scale( metrics, scaler );
69  }
70 
71 
72  static FT_Error
73  af_indic_hints_init( AF_GlyphHints hints,
75  {
76  /* use CJK routines */
77  return af_cjk_hints_init( hints, metrics );
78  }
79 
80 
81  static FT_Error
82  af_indic_hints_apply( FT_UInt glyph_index,
86  {
87  /* use CJK routines */
88  return af_cjk_hints_apply( glyph_index, hints, outline, metrics );
89  }
90 
91 
92  /* Extract standard_width from writing system/script specific */
93  /* metrics class. */
94 
95  static void
96  af_indic_get_standard_widths( AF_CJKMetrics metrics,
97  FT_Pos* stdHW,
98  FT_Pos* stdVW )
99  {
100  if ( stdHW )
101  *stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
102 
103  if ( stdVW )
104  *stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
105  }
106 
107 
108  /*************************************************************************/
109  /*************************************************************************/
110  /***** *****/
111  /***** I N D I C S C R I P T C L A S S *****/
112  /***** *****/
113  /*************************************************************************/
114  /*************************************************************************/
115 
116 
118  af_indic_writing_system_class,
119 
120  AF_WRITING_SYSTEM_INDIC,
121 
122  sizeof ( AF_CJKMetricsRec ),
123 
124  (AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init, /* style_metrics_init */
125  (AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale, /* style_metrics_scale */
126  (AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */
127  (AF_WritingSystem_GetStdWidthsFunc)af_indic_get_standard_widths, /* style_metrics_getstdw */
128 
129  (AF_WritingSystem_InitHintsFunc) af_indic_hints_init, /* style_hints_init */
130  (AF_WritingSystem_ApplyHintsFunc) af_indic_hints_apply /* style_hints_apply */
131  )
132 
133 
134 #else /* !AF_CONFIG_OPTION_INDIC */
135 
136 
138  af_indic_writing_system_class,
139 
140  AF_WRITING_SYSTEM_INDIC,
141 
142  sizeof ( AF_CJKMetricsRec ),
143 
144  (AF_WritingSystem_InitMetricsFunc) NULL, /* style_metrics_init */
145  (AF_WritingSystem_ScaleMetricsFunc)NULL, /* style_metrics_scale */
146  (AF_WritingSystem_DoneMetricsFunc) NULL, /* style_metrics_done */
147  (AF_WritingSystem_GetStdWidthsFunc)NULL, /* style_metrics_getstdw */
148 
149  (AF_WritingSystem_InitHintsFunc) NULL, /* style_hints_init */
150  (AF_WritingSystem_ApplyHintsFunc) NULL /* style_hints_apply */
151  )
152 
153 
154 #endif /* !AF_CONFIG_OPTION_INDIC */
155 
156 
157 /* END */
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
int FT_Error
Definition: fttypes.h:300
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
void(* AF_WritingSystem_DoneMetricsFunc)(AF_StyleMetrics metrics)
Definition: aftypes.h:212
return FT_Err_Ok
Definition: ftbbox.c:511
FT_Error(* AF_WritingSystem_InitMetricsFunc)(AF_StyleMetrics metrics, FT_Face face)
Definition: aftypes.h:204
FT_Error(* AF_WritingSystem_InitHintsFunc)(AF_GlyphHints hints, AF_StyleMetrics metrics)
Definition: aftypes.h:221
smooth NULL
Definition: ftsmooth.c:416
void(* AF_WritingSystem_ScaleMetricsFunc)(AF_StyleMetrics metrics, AF_Scaler scaler)
Definition: aftypes.h:208
void(* AF_WritingSystem_GetStdWidthsFunc)(AF_StyleMetrics metrics, FT_Pos *stdHW, FT_Pos *stdVW)
Definition: aftypes.h:215
FT_Select_Charmap(FT_Face face, FT_Encoding encoding)
Definition: ftobjs.c:3457
#define AF_DEFINE_WRITING_SYSTEM_CLASS( writing_system_class, system, m_size, m_init, m_scale, m_done, m_stdw, h_init, h_apply)
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3499
Definition: mesh.c:5329
unsigned int FT_UInt
Definition: fttypes.h:231
FT_Error(* AF_WritingSystem_ApplyHintsFunc)(FT_UInt glyph_index, AF_GlyphHints hints, FT_Outline *outline, AF_StyleMetrics metrics)
Definition: aftypes.h:225
GLenum GLuint GLint GLenum face
Definition: glext.h:7025