1 /* FreeType 2 definitions from the freetype header mostly.
8 typedef __int32 FT_Int32;
9 typedef unsigned __int32 FT_UInt32;
12 typedef int32_t FT_Int32;
13 typedef uint32_t FT_UInt32;
18 typedef signed char FT_Char;
19 typedef unsigned char FT_Byte;
20 typedef const FT_Byte *FT_Bytes;
21 typedef char FT_String;
22 typedef signed short FT_Short;
23 typedef unsigned short FT_UShort;
24 typedef signed int FT_Int;
25 typedef unsigned int FT_UInt;
26 typedef signed long FT_Long;
27 typedef signed long FT_Fixed;
28 typedef unsigned long FT_ULong;
29 typedef void *FT_Pointer;
30 typedef size_t FT_Offset;
31 typedef signed long FT_F26Dot6;
33 typedef void *FT_Stream;
34 typedef void *FT_Module;
35 typedef void *FT_Library;
36 typedef struct FT_FaceRec_ *FT_Face;
37 typedef struct FT_CharMapRec_* FT_CharMap;
38 typedef struct FT_SizeRec_* FT_Size;
39 typedef struct FT_Size_InternalRec_* FT_Size_Internal;
40 typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
41 typedef struct FT_SubGlyphRec_* FT_SubGlyph;
42 typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
44 // Taken from the freetype headers:
45 typedef signed long FT_Pos;
46 typedef struct FT_Vector_
52 typedef struct FT_BBox_
58 typedef enum FT_Pixel_Mode_
60 FT_PIXEL_MODE_NONE = 0,
67 FT_PIXEL_MODE_MAX /* do not remove */
69 typedef enum FT_Render_Mode_
71 FT_RENDER_MODE_NORMAL = 0,
80 #define ft_pixel_mode_none FT_PIXEL_MODE_NONE
81 #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
82 #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
83 #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
84 #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
86 typedef struct FT_Bitmap_
91 unsigned char* buffer;
98 typedef struct FT_Outline_
100 short n_contours; /* number of contours in glyph */
101 short n_points; /* number of points in the glyph */
103 FT_Vector* points; /* the outline's points */
104 char* tags; /* the points flags */
105 short* contours; /* the contour end points */
107 int flags; /* outline masks */
110 #define FT_OUTLINE_NONE 0x0
111 #define FT_OUTLINE_OWNER 0x1
112 #define FT_OUTLINE_EVEN_ODD_FILL 0x2
113 #define FT_OUTLINE_REVERSE_FILL 0x4
114 #define FT_OUTLINE_IGNORE_DROPOUTS 0x8
115 #define FT_OUTLINE_SMART_DROPOUTS 0x10
116 #define FT_OUTLINE_INCLUDE_STUBS 0x20
118 #define FT_OUTLINE_HIGH_PRECISION 0x100
119 #define FT_OUTLINE_SINGLE_PASS 0x200
121 #define ft_outline_none FT_OUTLINE_NONE
122 #define ft_outline_owner FT_OUTLINE_OWNER
123 #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL
124 #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL
125 #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS
126 #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION
127 #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS
129 #define FT_CURVE_TAG( flag ) ( flag & 3 )
131 #define FT_CURVE_TAG_ON 1
132 #define FT_CURVE_TAG_CONIC 0
133 #define FT_CURVE_TAG_CUBIC 2
135 #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */
136 #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */
138 #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \
139 FT_CURVE_TAG_TOUCH_Y )
141 #define FT_Curve_Tag_On FT_CURVE_TAG_ON
142 #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC
143 #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC
144 #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X
145 #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y
148 (*FT_Outline_MoveToFunc)( const FT_Vector* to,
150 #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc
153 (*FT_Outline_LineToFunc)( const FT_Vector* to,
155 #define FT_Outline_LineTo_Func FT_Outline_LineToFunc
158 (*FT_Outline_ConicToFunc)( const FT_Vector* control,
161 #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc
164 (*FT_Outline_CubicToFunc)( const FT_Vector* control1,
165 const FT_Vector* control2,
168 #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc
170 typedef struct FT_Outline_Funcs_
172 FT_Outline_MoveToFunc move_to;
173 FT_Outline_LineToFunc line_to;
174 FT_Outline_ConicToFunc conic_to;
175 FT_Outline_CubicToFunc cubic_to;
182 #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
183 value = ( ( (unsigned long)_x1 << 24 ) | \
184 ( (unsigned long)_x2 << 16 ) | \
185 ( (unsigned long)_x3 << 8 ) | \
187 #endif /* FT_IMAGE_TAG */
189 typedef enum FT_Glyph_Format_
191 FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
193 FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
194 FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
195 FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
196 FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
198 #define ft_glyph_format_none FT_GLYPH_FORMAT_NONE
199 #define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE
200 #define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP
201 #define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
202 #define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
204 typedef struct FT_Glyph_Metrics_
218 #define FT_EXPORT( x ) x
220 #define FT_OPEN_MEMORY 0x1
221 #define FT_OPEN_STREAM 0x2
222 #define FT_OPEN_PATHNAME 0x4
223 #define FT_OPEN_DRIVER 0x8
224 #define FT_OPEN_PARAMS 0x10
226 typedef struct FT_Parameter_
232 typedef struct FT_Open_Args_
235 const FT_Byte* memory_base;
241 FT_Parameter* params;
243 typedef enum FT_Size_Request_Type_
245 FT_SIZE_REQUEST_TYPE_NOMINAL,
246 FT_SIZE_REQUEST_TYPE_REAL_DIM,
247 FT_SIZE_REQUEST_TYPE_BBOX,
248 FT_SIZE_REQUEST_TYPE_CELL,
249 FT_SIZE_REQUEST_TYPE_SCALES,
251 FT_SIZE_REQUEST_TYPE_MAX
253 } FT_Size_Request_Type;
254 typedef struct FT_Size_RequestRec_
256 FT_Size_Request_Type type;
259 FT_UInt horiResolution;
260 FT_UInt vertResolution;
261 } FT_Size_RequestRec;
262 typedef struct FT_Size_RequestRec_ *FT_Size_Request;
264 #define FT_LOAD_DEFAULT 0x0
265 #define FT_LOAD_NO_SCALE 0x1
266 #define FT_LOAD_NO_HINTING 0x2
267 #define FT_LOAD_RENDER 0x4
268 #define FT_LOAD_NO_BITMAP 0x8
269 #define FT_LOAD_VERTICAL_LAYOUT 0x10
270 #define FT_LOAD_FORCE_AUTOHINT 0x20
271 #define FT_LOAD_CROP_BITMAP 0x40
272 #define FT_LOAD_PEDANTIC 0x80
273 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
274 #define FT_LOAD_NO_RECURSE 0x400
275 #define FT_LOAD_IGNORE_TRANSFORM 0x800
276 #define FT_LOAD_MONOCHROME 0x1000
277 #define FT_LOAD_LINEAR_DESIGN 0x2000
278 #define FT_LOAD_NO_AUTOHINT 0x8000U
280 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
282 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
283 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
284 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
285 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
286 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
288 #define FT_ENC_TAG( value, a, b, c, d ) \
289 value = ( ( (FT_UInt32)(a) << 24 ) | \
290 ( (FT_UInt32)(b) << 16 ) | \
291 ( (FT_UInt32)(c) << 8 ) | \
294 typedef enum FT_Encoding_
296 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
298 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
299 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
301 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
302 FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
303 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
304 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
305 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
307 /* for backwards compatibility */
308 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
309 FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
310 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
311 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
312 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
314 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
315 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
316 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
317 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
319 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
321 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
324 #define ft_encoding_none FT_ENCODING_NONE
325 #define ft_encoding_unicode FT_ENCODING_UNICODE
326 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
327 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
328 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
329 #define ft_encoding_sjis FT_ENCODING_SJIS
330 #define ft_encoding_gb2312 FT_ENCODING_GB2312
331 #define ft_encoding_big5 FT_ENCODING_BIG5
332 #define ft_encoding_wansung FT_ENCODING_WANSUNG
333 #define ft_encoding_johab FT_ENCODING_JOHAB
335 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
336 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
337 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
338 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
340 typedef struct FT_Bitmap_Size_
351 typedef struct FT_CharMapRec_
354 FT_Encoding encoding;
355 FT_UShort platform_id;
356 FT_UShort encoding_id;
359 typedef void (*FT_Generic_Finalizer)(void* object);
360 typedef struct FT_Generic_
363 FT_Generic_Finalizer finalizer;
366 typedef struct FT_Size_Metrics_
368 FT_UShort x_ppem; /* horizontal pixels per EM */
369 FT_UShort y_ppem; /* vertical pixels per EM */
371 FT_Fixed x_scale; /* scaling values used to convert font */
372 FT_Fixed y_scale; /* units to 26.6 fractional pixels */
374 FT_Pos ascender; /* ascender in 26.6 frac. pixels */
375 FT_Pos descender; /* descender in 26.6 frac. pixels */
376 FT_Pos height; /* text height in 26.6 frac. pixels */
377 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
380 typedef struct FT_SizeRec_
382 FT_Face face; /* parent face object */
383 FT_Generic generic; /* generic pointer for client uses */
384 FT_Size_Metrics metrics; /* size metrics */
385 FT_Size_Internal internal;
388 typedef struct FT_FaceRec_
398 FT_String* family_name;
399 FT_String* style_name;
401 FT_Int num_fixed_sizes;
402 FT_Bitmap_Size* available_sizes;
405 FT_CharMap* charmaps;
409 /*# The following member variables (down to `underline_thickness') */
410 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
411 /*# for bitmap fonts. */
414 FT_UShort units_per_EM;
419 FT_Short max_advance_width;
420 FT_Short max_advance_height;
422 FT_Short underline_position;
423 FT_Short underline_thickness;
434 FT_ListRec sizes_list;
439 FT_Face_Internal internal;
443 typedef struct FT_GlyphSlotRec_
448 FT_UInt reserved; /* retained for binary compatibility */
451 FT_Glyph_Metrics metrics;
452 FT_Fixed linearHoriAdvance;
453 FT_Fixed linearVertAdvance;
456 FT_Glyph_Format format;
464 FT_UInt num_subglyphs;
465 FT_SubGlyph subglyphs;
475 FT_Slot_Internal internal;
478 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
479 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
480 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
481 #define FT_FACE_FLAG_SFNT ( 1L << 3 )
482 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
483 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
484 #define FT_FACE_FLAG_KERNING ( 1L << 6 )
485 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
486 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
487 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
488 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
489 #define FT_FACE_FLAG_HINTER ( 1L << 11 )
490 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
491 #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
493 typedef enum FT_Kerning_Mode_
495 FT_KERNING_DEFAULT = 0,
500 #endif // FT2_DEFS_H_H__