1 /* FreeType 2 definitions from the freetype header mostly.
8 typedef __int32 FT_Int32;
9 typedef __uint32 FT_UInt32;
11 typedef int32_t FT_Int32;
12 typedef u_int32_t FT_UInt32;
17 typedef signed char FT_Char;
18 typedef unsigned char FT_Byte;
19 typedef const FT_Byte *FT_Bytes;
20 typedef char FT_String;
21 typedef signed short FT_Short;
22 typedef unsigned short FT_UShort;
23 typedef signed int FT_Int;
24 typedef unsigned int FT_UInt;
25 typedef signed long FT_Long;
26 typedef signed long FT_Fixed;
27 typedef unsigned long FT_ULong;
28 typedef void *FT_Pointer;
29 typedef size_t FT_Offset;
30 typedef signed long FT_F26Dot6;
32 typedef void *FT_Stream;
33 typedef void *FT_Module;
34 typedef void *FT_Library;
35 typedef struct FT_FaceRec_ *FT_Face;
36 typedef struct FT_CharMapRec_* FT_CharMap;
37 typedef struct FT_SizeRec_* FT_Size;
38 typedef struct FT_Size_InternalRec_* FT_Size_Internal;
39 typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
40 typedef struct FT_SubGlyphRec_* FT_SubGlyph;
41 typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
43 // Taken from the freetype headers:
44 typedef signed long FT_Pos;
45 typedef struct FT_Vector_
51 typedef struct FT_BBox_
57 typedef enum FT_Pixel_Mode_
59 FT_PIXEL_MODE_NONE = 0,
66 FT_PIXEL_MODE_MAX /* do not remove */
68 typedef enum FT_Render_Mode_
70 FT_RENDER_MODE_NORMAL = 0,
79 #define ft_pixel_mode_none FT_PIXEL_MODE_NONE
80 #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
81 #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
82 #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
83 #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
85 typedef struct FT_Bitmap_
90 unsigned char* buffer;
97 typedef struct FT_Outline_
99 short n_contours; /* number of contours in glyph */
100 short n_points; /* number of points in the glyph */
102 FT_Vector* points; /* the outline's points */
103 char* tags; /* the points flags */
104 short* contours; /* the contour end points */
106 int flags; /* outline masks */
109 #define FT_OUTLINE_NONE 0x0
110 #define FT_OUTLINE_OWNER 0x1
111 #define FT_OUTLINE_EVEN_ODD_FILL 0x2
112 #define FT_OUTLINE_REVERSE_FILL 0x4
113 #define FT_OUTLINE_IGNORE_DROPOUTS 0x8
114 #define FT_OUTLINE_SMART_DROPOUTS 0x10
115 #define FT_OUTLINE_INCLUDE_STUBS 0x20
117 #define FT_OUTLINE_HIGH_PRECISION 0x100
118 #define FT_OUTLINE_SINGLE_PASS 0x200
120 #define ft_outline_none FT_OUTLINE_NONE
121 #define ft_outline_owner FT_OUTLINE_OWNER
122 #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL
123 #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL
124 #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS
125 #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION
126 #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS
128 #define FT_CURVE_TAG( flag ) ( flag & 3 )
130 #define FT_CURVE_TAG_ON 1
131 #define FT_CURVE_TAG_CONIC 0
132 #define FT_CURVE_TAG_CUBIC 2
134 #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */
135 #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */
137 #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \
138 FT_CURVE_TAG_TOUCH_Y )
140 #define FT_Curve_Tag_On FT_CURVE_TAG_ON
141 #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC
142 #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC
143 #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X
144 #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y
147 (*FT_Outline_MoveToFunc)( const FT_Vector* to,
149 #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc
152 (*FT_Outline_LineToFunc)( const FT_Vector* to,
154 #define FT_Outline_LineTo_Func FT_Outline_LineToFunc
157 (*FT_Outline_ConicToFunc)( const FT_Vector* control,
160 #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc
163 (*FT_Outline_CubicToFunc)( const FT_Vector* control1,
164 const FT_Vector* control2,
167 #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc
169 typedef struct FT_Outline_Funcs_
171 FT_Outline_MoveToFunc move_to;
172 FT_Outline_LineToFunc line_to;
173 FT_Outline_ConicToFunc conic_to;
174 FT_Outline_CubicToFunc cubic_to;
181 #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
182 value = ( ( (unsigned long)_x1 << 24 ) | \
183 ( (unsigned long)_x2 << 16 ) | \
184 ( (unsigned long)_x3 << 8 ) | \
186 #endif /* FT_IMAGE_TAG */
188 typedef enum FT_Glyph_Format_
190 FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
192 FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
193 FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
194 FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
195 FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
197 #define ft_glyph_format_none FT_GLYPH_FORMAT_NONE
198 #define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE
199 #define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP
200 #define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
201 #define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
203 typedef struct FT_Glyph_Metrics_
217 #define FT_EXPORT( x ) x
219 #define FT_OPEN_MEMORY 0x1
220 #define FT_OPEN_STREAM 0x2
221 #define FT_OPEN_PATHNAME 0x4
222 #define FT_OPEN_DRIVER 0x8
223 #define FT_OPEN_PARAMS 0x10
225 typedef struct FT_Parameter_
231 typedef struct FT_Open_Args_
234 const FT_Byte* memory_base;
240 FT_Parameter* params;
242 typedef enum FT_Size_Request_Type_
244 FT_SIZE_REQUEST_TYPE_NOMINAL,
245 FT_SIZE_REQUEST_TYPE_REAL_DIM,
246 FT_SIZE_REQUEST_TYPE_BBOX,
247 FT_SIZE_REQUEST_TYPE_CELL,
248 FT_SIZE_REQUEST_TYPE_SCALES,
250 FT_SIZE_REQUEST_TYPE_MAX
252 } FT_Size_Request_Type;
253 typedef struct FT_Size_RequestRec_
255 FT_Size_Request_Type type;
258 FT_UInt horiResolution;
259 FT_UInt vertResolution;
260 } FT_Size_RequestRec;
261 typedef struct FT_Size_RequestRec_ *FT_Size_Request;
263 #define FT_LOAD_DEFAULT 0x0
264 #define FT_LOAD_NO_SCALE 0x1
265 #define FT_LOAD_NO_HINTING 0x2
266 #define FT_LOAD_RENDER 0x4
267 #define FT_LOAD_NO_BITMAP 0x8
268 #define FT_LOAD_VERTICAL_LAYOUT 0x10
269 #define FT_LOAD_FORCE_AUTOHINT 0x20
270 #define FT_LOAD_CROP_BITMAP 0x40
271 #define FT_LOAD_PEDANTIC 0x80
272 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
273 #define FT_LOAD_NO_RECURSE 0x400
274 #define FT_LOAD_IGNORE_TRANSFORM 0x800
275 #define FT_LOAD_MONOCHROME 0x1000
276 #define FT_LOAD_LINEAR_DESIGN 0x2000
277 #define FT_LOAD_NO_AUTOHINT 0x8000U
279 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
281 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
282 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
283 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
284 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
285 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
287 #define FT_ENC_TAG( value, a, b, c, d ) \
288 value = ( ( (FT_UInt32)(a) << 24 ) | \
289 ( (FT_UInt32)(b) << 16 ) | \
290 ( (FT_UInt32)(c) << 8 ) | \
293 typedef enum FT_Encoding_
295 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
297 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
298 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
300 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
301 FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
302 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
303 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
304 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
306 /* for backwards compatibility */
307 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
308 FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
309 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
310 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
311 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
313 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
314 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
315 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
316 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
318 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
320 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
323 #define ft_encoding_none FT_ENCODING_NONE
324 #define ft_encoding_unicode FT_ENCODING_UNICODE
325 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
326 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
327 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
328 #define ft_encoding_sjis FT_ENCODING_SJIS
329 #define ft_encoding_gb2312 FT_ENCODING_GB2312
330 #define ft_encoding_big5 FT_ENCODING_BIG5
331 #define ft_encoding_wansung FT_ENCODING_WANSUNG
332 #define ft_encoding_johab FT_ENCODING_JOHAB
334 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
335 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
336 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
337 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
339 typedef struct FT_Bitmap_Size_
350 typedef struct FT_CharMapRec_
353 FT_Encoding encoding;
354 FT_UShort platform_id;
355 FT_UShort encoding_id;
358 typedef void (*FT_Generic_Finalizer)(void* object);
359 typedef struct FT_Generic_
362 FT_Generic_Finalizer finalizer;
365 typedef struct FT_Size_Metrics_
367 FT_UShort x_ppem; /* horizontal pixels per EM */
368 FT_UShort y_ppem; /* vertical pixels per EM */
370 FT_Fixed x_scale; /* scaling values used to convert font */
371 FT_Fixed y_scale; /* units to 26.6 fractional pixels */
373 FT_Pos ascender; /* ascender in 26.6 frac. pixels */
374 FT_Pos descender; /* descender in 26.6 frac. pixels */
375 FT_Pos height; /* text height in 26.6 frac. pixels */
376 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
379 typedef struct FT_SizeRec_
381 FT_Face face; /* parent face object */
382 FT_Generic generic; /* generic pointer for client uses */
383 FT_Size_Metrics metrics; /* size metrics */
384 FT_Size_Internal internal;
387 typedef struct FT_FaceRec_
397 FT_String* family_name;
398 FT_String* style_name;
400 FT_Int num_fixed_sizes;
401 FT_Bitmap_Size* available_sizes;
404 FT_CharMap* charmaps;
408 /*# The following member variables (down to `underline_thickness') */
409 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
410 /*# for bitmap fonts. */
413 FT_UShort units_per_EM;
418 FT_Short max_advance_width;
419 FT_Short max_advance_height;
421 FT_Short underline_position;
422 FT_Short underline_thickness;
433 FT_ListRec sizes_list;
438 FT_Face_Internal internal;
442 typedef struct FT_GlyphSlotRec_
447 FT_UInt reserved; /* retained for binary compatibility */
450 FT_Glyph_Metrics metrics;
451 FT_Fixed linearHoriAdvance;
452 FT_Fixed linearVertAdvance;
455 FT_Glyph_Format format;
463 FT_UInt num_subglyphs;
464 FT_SubGlyph subglyphs;
474 FT_Slot_Internal internal;
477 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
478 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
479 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
480 #define FT_FACE_FLAG_SFNT ( 1L << 3 )
481 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
482 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
483 #define FT_FACE_FLAG_KERNING ( 1L << 6 )
484 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
485 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
486 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
487 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
488 #define FT_FACE_FLAG_HINTER ( 1L << 11 )
489 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
490 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
492 typedef enum FT_Kerning_Mode_
494 FT_KERNING_DEFAULT = 0,
499 #endif // FT2_DEFS_H_H__