3 /* originally file `aftypes.h' (2011-Mar-30) from FreeType */
5 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
12 #include FT_FREETYPE_H
16 /* #define TA_DEBUG */
29 extern int _ta_debug_disable_horz_hints
;
30 extern int _ta_debug_disable_vert_hints
;
31 extern int _ta_debug_disable_blue_hints
;
32 extern void* _ta_debug_hints
;
37 do { } while (0) /* nothing */
39 #endif /* !TA_DEBUG */
42 #define TA_ABS(a) ((a) < 0 ? -(a) : (a))
44 /* from file `ftobjs.h' from FreeType */
45 #define TA_PAD_FLOOR(x, n) ((x) & ~((n) - 1))
46 #define TA_PAD_ROUND(x, n) TA_PAD_FLOOR((x) + ((n) / 2), n)
47 #define TA_PAD_CEIL(x, n) TA_PAD_FLOOR((x) + ((n) - 1), n)
49 #define TA_PIX_FLOOR(x) ((x) & ~63)
50 #define TA_PIX_ROUND(x) TA_PIX_FLOOR((x) + 32)
51 #define TA_PIX_CEIL(x) TA_PIX_FLOOR((x) + 63)
54 typedef struct TA_WidthRec_
56 FT_Pos org
; /* original position/width in font units */
57 FT_Pos cur
; /* current/scaled position/width in device sub-pixels */
58 FT_Pos fit
; /* current/fitted position/width in device sub-pixels */
59 } TA_WidthRec
, *TA_Width
;
62 /* the auto-hinter doesn't need a very high angular accuracy */
63 typedef FT_Int TA_Angle
;
65 #define TA_ANGLE_PI 256
66 #define TA_ANGLE_2PI (TA_ANGLE_PI * 2)
67 #define TA_ANGLE_PI2 (TA_ANGLE_PI / 2)
68 #define TA_ANGLE_PI4 (TA_ANGLE_PI / 4)
70 #define TA_ANGLE_DIFF(result, angle1, angle2) \
72 TA_Angle _delta = (angle2) - (angle1); \
75 _delta %= TA_ANGLE_2PI; \
77 _delta += TA_ANGLE_2PI; \
79 if (_delta > TA_ANGLE_PI) \
80 _delta -= TA_ANGLE_2PI; \
86 /* opaque handle to glyph-specific hints -- */
87 /* see `tahints.h' for more details */
88 typedef struct TA_GlyphHintsRec_
* TA_GlyphHints
;
91 /* a scaler models the target pixel device that will receive */
92 /* the auto-hinted glyph image */
93 #define TA_SCALER_FLAG_NO_HORIZONTAL 1 /* disable horizontal hinting */
94 #define TA_SCALER_FLAG_NO_VERTICAL 2 /* disable vertical hinting */
95 #define TA_SCALER_FLAG_NO_ADVANCE 4 /* disable advance hinting */
97 typedef struct TA_ScalerRec_
99 FT_Face face
; /* source font face */
100 FT_Fixed x_scale
; /* from font units to 1/64th device pixels */
101 FT_Fixed y_scale
; /* from font units to 1/64th device pixels */
102 FT_Pos x_delta
; /* in 1/64th device pixels */
103 FT_Pos y_delta
; /* in 1/64th device pixels */
104 FT_Render_Mode render_mode
; /* monochrome, anti-aliased, LCD, etc.*/
105 FT_UInt32 flags
; /* additional control flags, see above */
106 } TA_ScalerRec
, *TA_Scaler
;
108 #define TA_SCALER_EQUAL_SCALES(a, b) \
109 ((a)->x_scale == (b)->x_scale \
110 && (a)->y_scale == (b)->y_scale \
111 && (a)->x_delta == (b)->x_delta \
112 && (a)->y_delta == (b)->y_delta)
116 * The list of known scripts. Each different script corresponds to the
117 * following information:
119 * - A set of Unicode ranges to test whether the face supports the
122 * - A specific global analyzer that will compute global metrics
123 * specific to the script.
125 * - A specific glyph analyzer that will compute segments and
126 * edges for each glyph covered by the script.
128 * - A specific grid-fitting algorithm that will distort the
129 * scaled glyph outline according to the results of the glyph
132 * Note that a given analyzer and/or grid-fitting algorithm can be
133 * used by more than one script.
136 typedef enum TA_Script_
142 #ifdef FT_OPTION_AUTOFIT2
143 TA_SCRIPT_LATIN2
= 4,
146 /* add new scripts here; */
147 /* don't forget to update the list in `taglobal.c' */
149 TA_SCRIPT_MAX
/* do not remove */
152 typedef struct TA_ScriptClassRec_
const* TA_ScriptClass
;
154 typedef struct TA_ScriptMetricsRec_
156 TA_ScriptClass clazz
;
158 FT_Bool digits_have_same_width
;
159 } TA_ScriptMetricsRec
, *TA_ScriptMetrics
;
162 /* this function parses an FT_Face to compute global metrics */
163 /* for a specific script */
165 (*TA_Script_InitMetricsFunc
)(TA_ScriptMetrics metrics
,
168 (*TA_Script_ScaleMetricsFunc
)(TA_ScriptMetrics metrics
,
171 (*TA_Script_DoneMetricsFunc
)(TA_ScriptMetrics metrics
);
173 (*TA_Script_InitHintsFunc
)(TA_GlyphHints hints
,
174 TA_ScriptMetrics metrics
);
176 (*TA_Script_ApplyHintsFunc
)(TA_GlyphHints hints
,
178 TA_ScriptMetrics metrics
);
181 typedef struct TA_Script_UniRangeRec_
185 } TA_Script_UniRangeRec
;
187 #define TA_UNIRANGE_REC(a, b) \
188 { (FT_UInt32)(a), (FT_UInt32)(b) }
190 typedef const TA_Script_UniRangeRec
*TA_Script_UniRange
;
192 typedef struct TA_ScriptClassRec_
195 TA_Script_UniRange script_uni_ranges
; /* last must be { 0, 0 } */
197 FT_Offset script_metrics_size
;
198 TA_Script_InitMetricsFunc script_metrics_init
;
199 TA_Script_ScaleMetricsFunc script_metrics_scale
;
200 TA_Script_DoneMetricsFunc script_metrics_done
;
202 TA_Script_InitHintsFunc script_hints_init
;
203 TA_Script_ApplyHintsFunc script_hints_apply
;
206 #endif /* __TATYPES_H__ */
208 /* end of tatypes.h */