1 
2 //          Copyright 2019 - 2021 Michael D. Parker
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.freetype.bind.freetype;
8 
9 import core.stdc.config;
10 import bindbc.freetype.config;
11 import bindbc.freetype.bind.ftimage,
12        bindbc.freetype.bind.ftsystem,
13        bindbc.freetype.bind.fttypes;
14 
15 struct FT_Glyph_Metrics {
16     FT_Pos width;
17     FT_Pos height;
18     FT_Pos horiBearingX;
19     FT_Pos horiBearingY;
20     FT_Pos horiAdvance;
21     FT_Pos vertBearingX;
22     FT_Pos vertBearingY;
23     FT_Pos vertAdvance;
24 }
25 
26 struct FT_Bitmap_Size {
27     FT_Short height;
28     FT_Short width;
29     FT_Pos size;
30     FT_Pos x_ppem;
31     FT_Pos y_ppem;
32 }
33 
34 struct FT_LibraryRec;
35 struct FT_ModuleRec;
36 struct FT_DriverRec;
37 struct FT_RendererRec;
38 
39 alias FT_Library = FT_LibraryRec*;
40 alias FT_Module = FT_ModuleRec*;
41 alias FT_Driver = FT_DriverRec*;
42 alias FT_Renderer = FT_RendererRec*;
43 alias FT_Face = FT_FaceRec*;
44 alias FT_Size = FT_SizeRec*;
45 alias FT_GlyphSlot = FT_GlyphSlotRec*;
46 alias FT_CharMap = FT_CharMapRec*;
47 
48 alias FT_ENC_TAG = FT_MAKE_TAG;
49 
50 alias FT_Encoding = FT_Tag;
51 enum : FT_Tag {
52     FT_ENCODING_NONE = 0,
53     FT_ENCODING_MS_SYMBOL = FT_MAKE_TAG('s','y','m','b'),
54     FT_ENCODING_UNICODE = FT_MAKE_TAG('u','n','i','c'),
55     FT_ENCODING_SJIS = FT_MAKE_TAG('s','j','i','s'),
56     FT_ENCODING_PRC = FT_MAKE_TAG('g','b',' ',' '),
57     FT_ENCODING_BIG5 = FT_MAKE_TAG('b','i','g','5'),
58     FT_ENCODING_WANSUNG = FT_MAKE_TAG('w','a','n','s'),
59     FT_ENCODING_JOHAB = FT_MAKE_TAG('j','o','h','a'),
60     FT_ENCODING_GB2312 = FT_ENCODING_PRC,
61     FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
62     FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,
63     FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
64     FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
65     FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
66     FT_ENCODING_ADOBE_STANDARD = FT_MAKE_TAG('A','D','O','B'),
67     FT_ENCODING_ADOBE_EXPERT = FT_MAKE_TAG('A','D','B','E'),
68     FT_ENCODING_ADOBE_CUSTOM = FT_MAKE_TAG('A','D','B','C'),
69     FT_ENCODING_ADOBE_LATIN_1 = FT_MAKE_TAG('l','a','t','1'),
70     FT_ENCODING_OLD_LATIN_2 = FT_MAKE_TAG('l','a','t','2'),
71     FT_ENCODING_APPLE_ROMAN = FT_MAKE_TAG('a','r','m','n'),
72 }
73 
74 struct FT_CharMapRec {
75     FT_Face face;
76     FT_Encoding encoding;
77     FT_UShort platform_id;
78     FT_UShort encoding_id;
79 }
80 
81 struct FT_Face_InternalRec;
82 alias FT_Face_Internal = FT_Face_InternalRec*;
83 
84 struct FT_FaceRec {
85     FT_Long num_faces;
86     FT_Long face_index;
87     FT_Long face_flags;
88     FT_Long style_flags;
89     FT_Long num_glyphs;
90     FT_String* family_name;
91     FT_String* style_name;
92     FT_Int num_fixed_sizes;
93     FT_Bitmap_Size* available_sizes;
94     FT_Int num_charmaps;
95     FT_CharMap* charmaps;
96     FT_Generic generic;
97     FT_BBox bbox;
98     FT_UShort units_per_EM;
99     FT_Short ascender;
100     FT_Short descender;
101     FT_Short height;
102     FT_Short max_advance_width;
103     FT_Short max_advance_height;
104     FT_Short underline_position;
105     FT_Short underline_thickness;
106     FT_GlyphSlot glyph;
107     FT_Size size;
108     FT_CharMap charmap;
109     FT_Driver driver;
110     FT_Memory memory;
111     FT_Stream stream;
112     FT_ListRec sizes_list;
113     FT_Generic autohint;
114     void* extensions;
115     FT_Face_Internal internal;
116 }
117 
118 enum : uint {
119     FT_FACE_FLAG_SCALABLE = 1 << 0,
120     FT_FACE_FLAG_FIXED_SIZES = 1 << 1,
121     FT_FACE_FLAG_FIXED_WIDTH = 1 << 2,
122     FT_FACE_FLAG_SFNT = 1 << 3,
123     FT_FACE_FLAG_HORIZONTAL = 1 << 4,
124     FT_FACE_FLAG_VERTICAL = 1 << 5,
125     FT_FACE_FLAG_KERNING = 1 << 6,
126     FT_FACE_FLAG_FAST_GLYPHS = 1 << 7,
127     FT_FACE_FLAG_MULTIPLE_MASTERS = 1 << 8,
128     FT_FACE_FLAG_GLYPH_NAMES = 1 << 9,
129     FT_FACE_FLAG_EXTERNAL_STREAM = 1 << 10,
130     FT_FACE_FLAG_HINTER = 1 << 11,
131     FT_FACE_FLAG_CID_KEYED = 1 << 12,
132     FT_FACE_FLAG_TRICKY = 1 << 13,
133     FT_FACE_FLAG_COLOR = 1 << 14,
134 
135     // Added in Freetype 2.9
136     FT_FACE_FLAG_VARIATION = 1 << 15,
137 }
138 
139 @nogc nothrow {
140     bool FT_HAS_HORIZONTAL(FT_Face face) {
141         return (face.face_flags & FT_FACE_FLAG_HORIZONTAL) != 0;
142     }
143 
144     bool FT_HAS_VERTICAL(FT_Face face) {
145         return (face.face_flags & FT_FACE_FLAG_VERTICAL) != 0;
146     }
147 
148     bool FT_HAS_KERNING(FT_Face face) {
149         return (face.face_flags & FT_FACE_FLAG_KERNING) != 0;
150     }
151 
152     bool FT_IS_SCALABLE(FT_Face face) {
153         return (face.face_flags & FT_FACE_FLAG_SCALABLE) != 0;
154     }
155 
156     bool FT_IS_SFNT(FT_Face face) {
157         return (face.face_flags & FT_FACE_FLAG_SFNT) != 0;
158     }
159 
160     bool FT_IS_FIXED_WIDTH(FT_Face face) {
161         return (face.face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0;
162     }
163 
164     bool FT_HAS_FIXED_SIZES(FT_Face face) {
165         return (face.face_flags & FT_FACE_FLAG_FIXED_SIZES) != 0;
166     }
167 
168     bool FT_HAS_FAST_GLYPHS(FT_Face face) {
169         return false;
170     }
171 
172     bool FT_HAS_GLYPH_NAMES(FT_Face face) {
173         return (face.face_flags & FT_FACE_FLAG_GLYPH_NAMES) != 0;
174     }
175 
176     bool FT_HAS_MULTIPLE_MASTERS(FT_Face face) {
177         return (face.face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS) != 0;
178     }
179 
180     bool FT_IS_CID_KEYED(FT_Face face) {
181         return (face.face_flags & FT_FACE_FLAG_CID_KEYED) != 0;
182     }
183 
184     bool FT_IS_TRICKY(FT_Face face) {
185         return (face.face_flags & FT_FACE_FLAG_TRICKY) != 0;
186     }
187 
188     bool FT_HAS_COLOR(FT_Face face) {
189         return (face.face_flags & FT_FACE_FLAG_COLOR) != 0;
190     }
191 
192     static if(ftSupport >= FTSupport.ft27) {
193         bool FT_IS_NAMED_INSTANCE(FT_Face face) {
194             return (face.face_index & 0x7FFF0000L) != 0;
195         }
196     }
197 
198     static if(ftSupport >= FTSupport.ft29) {
199         bool FT_IS_VARIATION(FT_Face face) {
200             return (face.face_flags & FT_FACE_FLAG_VARIATION) != 0;
201         }
202     }
203 }
204 
205 enum {
206     FT_STYLE_FLAG_ITALIC          = 1 << 0,
207     FT_STYLE_FLAG_BOLD            = 1 << 1,
208 }
209 
210 struct FT_Size_InternalRec;
211 alias FT_Size_Internal = FT_Size_InternalRec*;
212 
213 struct FT_Size_Metrics {
214     FT_UShort x_ppem;
215     FT_UShort y_ppem;
216 
217     FT_Fixed x_scale;
218     FT_Fixed y_scale;
219 
220     FT_Pos ascender;
221     FT_Pos descender;
222     FT_Pos height;
223     FT_Pos max_advance;
224 }
225 
226 struct FT_SizeRec {
227     FT_Face face;
228     FT_Generic generic;
229     FT_Size_Metrics metrics;
230     FT_Size_Internal internal;
231 }
232 
233 struct FT_SubGlyphRec;
234 struct FT_Slot_InternalRec;
235 alias FT_SubGlyph = FT_SubGlyphRec*;
236 alias FT_Slot_Internal = FT_Slot_InternalRec*;
237 
238 struct FT_GlyphSlotRec {
239     FT_Library library;
240     FT_Face face;
241     FT_GlyphSlot next;
242 
243     // Renamed from "reserved" in Freetype 2.10
244     FT_UInt glyph_index;
245 
246     FT_Generic generic;
247     FT_Glyph_Metrics metrics;
248     FT_Fixed linearHoriAdvance;
249     FT_Fixed linearVertAdvance;
250     FT_Vector advance;
251     FT_Glyph_Format format;
252     FT_Bitmap bitmap;
253     FT_Int bitmap_left;
254     FT_Int bitmap_top;
255     FT_Outline outline;
256     FT_UInt num_subglyphs;
257     FT_SubGlyph subglyphs;
258     void* control_data;
259     c_long control_len;
260     FT_Pos lsb_delta;
261     FT_Pos rsb_delta;
262     void* other;
263     FT_Slot_Internal internal;
264 }
265 
266 enum : uint {
267     FT_OPEN_MEMORY           = 0x1,
268     FT_OPEN_STREAM           = 0x2,
269     FT_OPEN_PATHNAME         = 0x4,
270     FT_OPEN_DRIVER           = 0x8,
271     FT_OPEN_PARAMS           = 0x10,
272 }
273 
274 struct FT_Parameter {
275     FT_ULong tag;
276     FT_Pointer data;
277 }
278 
279 struct FT_Open_Args {
280     FT_UInt flags;
281     const(FT_Byte)* memory_base;
282     FT_Long memory_size;
283     FT_String* pathname;
284     FT_Stream stream;
285     FT_Module driver;
286     FT_Int num_params;
287     FT_Parameter* params;
288 }
289 
290 alias FT_Size_Request_Type = int;
291 enum  {
292     FT_SIZE_REQUEST_TYPE_NOMINAL,
293     FT_SIZE_REQUEST_TYPE_REAL_DIM,
294     FT_SIZE_REQUEST_TYPE_BBOX,
295     FT_SIZE_REQUEST_TYPE_CELL,
296     FT_SIZE_REQUEST_TYPE_SCALES,
297     FT_SIZE_REQUEST_TYPE_MAX
298 }
299 
300 struct FT_Size_RequestRec {
301     FT_Size_Request_Type type;
302     FT_Long width;
303     FT_Long height;
304     FT_UInt horiResolution;
305     FT_UInt vertResolution;
306 }
307 
308 alias FT_Size_Request = FT_Size_RequestRec*;
309 
310 static if(ftSupport >= FTSupport.ft27) {
311     enum : uint {
312         FT_LOAD_DEFAULT = 0x0,
313         FT_LOAD_NO_SCALE = 1 << 0,
314         FT_LOAD_NO_HINTING = 1 << 1,
315         FT_LOAD_RENDER = 1 << 2,
316         FT_LOAD_NO_BITMAP = 1 << 3,
317         FT_LOAD_VERTICAL_LAYOUT = 1 << 4,
318         FT_LOAD_FORCE_AUTOHINT = 1 << 5,
319         FT_LOAD_CROP_BITMAP = 1 << 6,
320         FT_LOAD_PEDANTIC = 1 << 7,
321         FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH = 1 << 9,
322         FT_LOAD_NO_RECURSE = 1 << 10,
323         FT_LOAD_IGNORE_TRANSFORM = 1 << 11,
324         FT_LOAD_MONOCHROME = 1 << 12,
325         FT_LOAD_LINEAR_DESIGN = 1 << 13,
326         FT_LOAD_NO_AUTOHINT = 1 << 15,
327         FT_LOAD_COLOR = 1 << 20,
328         FT_LOAD_COMPUTE_METRICS = 1 << 21,
329         FT_LOAD_BITMAP_METRICS_ONLY = 1 << 22,
330     }
331 }
332 else {
333     enum : uint {
334         FT_LOAD_DEFAULT = 0x0,
335         FT_LOAD_NO_SCALE = 1 << 0,
336         FT_LOAD_NO_HINTING = 1 << 1,
337         FT_LOAD_RENDER = 1 << 2,
338         FT_LOAD_NO_BITMAP = 1 << 3,
339         FT_LOAD_VERTICAL_LAYOUT = 1 << 4,
340         FT_LOAD_FORCE_AUTOHINT = 1 << 5,
341         FT_LOAD_CROP_BITMAP = 1 << 6,
342         FT_LOAD_PEDANTIC = 1 << 7,
343         FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH = 1 << 9,
344         FT_LOAD_NO_RECURSE = 1 << 10,
345         FT_LOAD_IGNORE_TRANSFORM = 1 << 11,
346         FT_LOAD_MONOCHROME = 1 << 12,
347         FT_LOAD_LINEAR_DESIGN = 1 << 13,
348         FT_LOAD_NO_AUTOHINT = 1 << 15,
349         FT_LOAD_COLOR = 1 << 20,
350         FT_LOAD_COMPUTE_METRICS = 1 << 21,
351     }
352 }
353 
354 @nogc FT_Render_Mode FT_LOAD_TARGET_MODE(uint x) nothrow {
355     return cast(FT_Render_Mode)((x >> 16) & 15);
356 }
357 
358 alias FT_Render_Mode = uint;
359 static if(ftSupport >= FTSupport.ft211) {
360     enum {
361         FT_RENDER_MODE_NORMAL = 0,
362         FT_RENDER_MODE_LIGHT,
363         FT_RENDER_MODE_MONO,
364         FT_RENDER_MODE_LCD,
365         FT_RENDER_MODE_LCD_V,
366         FT_RENDER_MODE_MAX,
367         FT_RENDER_MODE_SDF,
368     }
369 } else {
370     enum {
371         FT_RENDER_MODE_NORMAL = 0,
372         FT_RENDER_MODE_LIGHT,
373         FT_RENDER_MODE_MONO,
374         FT_RENDER_MODE_LCD,
375         FT_RENDER_MODE_LCD_V,
376         FT_RENDER_MODE_MAX
377     }
378 }
379 
380 enum {
381     FT_LOAD_TARGET_NORMAL = (FT_RENDER_MODE_NORMAL & 15) << 16,
382     FT_LOAD_TARGET_LIGHT = (FT_RENDER_MODE_LIGHT & 15) << 16,
383     FT_LOAD_TARGET_MONO = (FT_RENDER_MODE_MONO & 15) << 16,
384     FT_LOAD_TARGET_LCD = (FT_RENDER_MODE_LCD & 15) << 16,
385     FT_LOAD_TARGET_LCD_V = (FT_RENDER_MODE_LCD_V & 15) << 16,
386 }
387 
388 enum FT_Kerning_Mode {
389     FT_KERNING_DEFAULT = 0,
390     FT_KERNING_UNFITTED,
391     FT_KERNING_UNSCALED
392 }
393 
394 enum {
395     FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS = 1,
396     FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES = 2,
397     FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID = 4,
398     FT_SUBGLYPH_FLAG_SCALE = 8,
399     FT_SUBGLYPH_FLAG_XY_SCALE = 0x40,
400     FT_SUBGLYPH_FLAG_2X2 = 0x80,
401     FT_SUBGLYPH_FLAG_USE_MY_METRICS = 0x200,
402 }
403 
404 static if(ftSupport <= FTSupport.ft210) {
405     struct FT_LayerIterator {
406         FT_UInt num_layers;
407         FT_UInt layer;
408         FT_Byte* p;
409     }
410 }
411 
412 enum {
413     FT_FSTYPE_INSTALLABLE_EMBEDDING = 0x0000,
414     FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING = 0x0002,
415     FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING = 0x0004,
416     FT_FSTYPE_EDITABLE_EMBEDDING = 0x0008,
417     FT_FSTYPE_NO_SUBSETTING = 0x0100,
418     FT_FSTYPE_BITMAP_EMBEDDING_ONLY = 0x0200,
419 }
420 
421 static if(staticBinding) {
422 	extern(C) @nogc nothrow {
423         FT_Error FT_Init_FreeType(FT_Library* alibrary);
424         FT_Error FT_Done_FreeType(FT_Library library);
425         FT_Error FT_New_Face(FT_Library library, const(char)* filepathname, FT_Long face_index, FT_Face* aface);
426         FT_Error FT_New_Memory_Face(FT_Library library, const(FT_Byte)* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface);
427         FT_Error FT_Open_Face(FT_Library library, const(FT_Open_Args)* args, FT_Long face_index, FT_Face* aface);
428         FT_Error FT_Attach_File(FT_Face face, const(char)* filepathname);
429         FT_Error FT_Attach_Stream(FT_Face face, FT_Open_Args* parameters);
430         FT_Error FT_Reference_Face(FT_Face face);
431         FT_Error FT_Done_Face(FT_Face face);
432         FT_Error FT_Select_Size(FT_Face face, FT_Int strike_index);
433         FT_Error FT_Request_Size(FT_Face face, FT_Size_Request req);
434         FT_Error FT_Set_Char_Size(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution);
435         FT_Error FT_Set_Pixel_Sizes(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height);
436         FT_Error FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags);
437         FT_Error FT_Load_Char(FT_Face face, FT_UInt char_code, FT_Int32 load_flags);
438         void FT_Set_Transform(FT_Face face, FT_Matrix* matrix, FT_Vector* delta);
439         FT_Error FT_Render_Glyph(FT_GlyphSlot slot, FT_Render_Mode render_mode);
440         FT_Error FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector* akerning);
441         FT_Error FT_Get_Track_Kerning(FT_Face face, FT_Fixed point_size, FT_Int degree, FT_Fixed* akerning);
442         FT_Error FT_Get_Glyph_Name(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max);
443         const(char)* FT_Get_Postscript_Name(FT_Face face);
444         FT_Error FT_Select_Charmap(FT_Face face, FT_Encoding encoding);
445         FT_Error FT_Set_Charmap(FT_Face face, FT_CharMap charmap);
446         FT_Int FT_Get_Charmap_Index(FT_CharMap charmap);
447         FT_UInt FT_Get_Char_Index(FT_Face face, FT_ULong charcode);
448         FT_ULong FT_Get_First_Char(FT_Face face, FT_UInt* agindex);
449         FT_ULong FT_Get_Next_Char(FT_Face face, FT_ULong char_code, FT_UInt* agindex);
450         FT_UInt FT_Get_Name_Index(FT_Face face, const(FT_String)* glyph_name);
451         FT_Error FT_Get_SubGlyph_Info(FT_GlyphSlot glyph, FT_UInt sub_index, FT_Int* p_index, FT_UInt* p_flags, FT_Int* p_arg1, FT_Int* p_arg2, FT_Matrix* p_transform);
452         FT_UShort FT_Get_FSType_Flags(FT_Face face);
453         FT_UInt FT_Face_GetCharVariantIndex(FT_Face face, FT_ULong charcode, FT_ULong variantSelector);
454         FT_Int FT_Face_GetCharVariantIsDefault(FT_Face face, FT_ULong charcode, FT_ULong variantSelector);
455         FT_UInt32* FT_Face_GetVariantSelectors(FT_Face face);
456         FT_UInt32* FT_Face_GetVariantsOfChar(FT_Face face, FT_ULong charcode);
457         FT_UInt32* FT_Face_GetCharsOfVariant(FT_Face face, FT_ULong variantSelector);
458         FT_Long FT_MulDiv(FT_Long a, FT_Long b, FT_Long c);
459         FT_Long FT_MulFix(FT_Long a, FT_Long b);
460         FT_Long FT_DivFix(FT_Long a,FT_Long b);
461         FT_Fixed FT_RoundFix(FT_Fixed a);
462         FT_Fixed FT_CeilFix(FT_Fixed a);
463         FT_Fixed FT_FloorFix(FT_Fixed a);
464         void FT_Vector_Transform(FT_Vector* vector, FT_Matrix* matrix);
465         void FT_Library_Version(FT_Library library, FT_Int* amajor, FT_Int* aminor, FT_Int* apatch);
466         FT_Bool FT_Face_CheckTrueTypePatents(FT_Face face);
467         FT_Bool FT_Face_SetUnpatentedHinting(FT_Face face, FT_Bool value);
468     }
469     static if(ftSupport >= FTSupport.ft28) {
470         FT_Error FT_Face_Properties(FT_Face face, FT_UInt num_properties, FT_Parameter* properties);
471     }
472     static if(ftSupport <= FTSupport.ft210) {
473         // Moved to ftcolor.h in 2.11
474         FT_Bool FT_Get_Color_Glyph_Layer(FT_Face face, FT_UInt base_glyph, FT_UInt* aglyph_index, FT_UInt* acolor_index, FT_LayerIterator* iterator);
475     }
476     static if(ftSupport >= FTSupport.ft211) {
477         void FT_Get_Transform(FT_Face face, FT_Matrix* matrix, FT_Vector* delta);
478     }
479 }
480 else {
481     extern(C) @nogc nothrow {
482         alias pFT_Init_FreeType = FT_Error function(FT_Library* alibrary);
483         alias pFT_Done_FreeType = FT_Error function(FT_Library library);
484         alias pFT_New_Face = FT_Error function(FT_Library library, const(char)* filepathname, FT_Long face_index, FT_Face* aface);
485         alias pFT_New_Memory_Face = FT_Error function(FT_Library library, const(FT_Byte)* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface);
486         alias pFT_Open_Face = FT_Error function(FT_Library library, const(FT_Open_Args)* args, FT_Long face_index, FT_Face* aface);
487         alias pFT_Attach_File = FT_Error function(FT_Face face, const(char)* filepathname);
488         alias pFT_Attach_Stream = FT_Error function(FT_Face face, FT_Open_Args* parameters);
489         alias pFT_Reference_Face = FT_Error function(FT_Face face);
490         alias pFT_Done_Face = FT_Error function(FT_Face face);
491         alias pFT_Select_Size = FT_Error function(FT_Face face, FT_Int strike_index);
492         alias pFT_Request_Size = FT_Error function(FT_Face face, FT_Size_Request req);
493         alias pFT_Set_Char_Size = FT_Error function(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution);
494         alias pFT_Set_Pixel_Sizes = FT_Error function(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height);
495         alias pFT_Load_Glyph = FT_Error function(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags);
496         alias pFT_Load_Char = FT_Error function(FT_Face face, FT_UInt char_code, FT_Int32 load_flags);
497         alias pFT_Set_Transform = void function(FT_Face face, FT_Matrix* matrix, FT_Vector* delta);
498         alias pFT_Render_Glyph = FT_Error function(FT_GlyphSlot slot, FT_Render_Mode render_mode);
499         alias pFT_Get_Kerning = FT_Error function(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector* akerning);
500         alias pFT_Get_Track_Kerning = FT_Error function(FT_Face face, FT_Fixed point_size, FT_Int degree, FT_Fixed* akerning);
501         alias pFT_Get_Glyph_Name = FT_Error function(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max);
502         alias pFT_Get_Postscript_Name = const(char)* function(FT_Face face);
503         alias pFT_Select_Charmap = FT_Error function(FT_Face face, FT_Encoding encoding);
504         alias pFT_Set_Charmap = FT_Error function(FT_Face face, FT_CharMap charmap);
505         alias pFT_Get_Charmap_Index = FT_Int function(FT_CharMap charmap);
506         alias pFT_Get_Char_Index = FT_UInt function(FT_Face face, FT_ULong charcode);
507         alias pFT_Get_First_Char = FT_ULong function(FT_Face face, FT_UInt* agindex);
508         alias pFT_Get_Next_Char = FT_ULong function(FT_Face face, FT_ULong char_code, FT_UInt* agindex);
509         alias pFT_Get_Name_Index = FT_UInt function(FT_Face face, const(FT_String)* glyph_name);
510         alias pFT_Get_SubGlyph_Info = FT_Error function(FT_GlyphSlot glyph, FT_UInt sub_index, FT_Int* p_index, FT_UInt* p_flags, FT_Int* p_arg1, FT_Int* p_arg2, FT_Matrix* p_transform);
511         alias pFT_Get_FSType_Flags = FT_UShort function(FT_Face face);
512         alias pFT_Face_GetCharVariantIndex = FT_UInt function(FT_Face face, FT_ULong charcode, FT_ULong variantSelector);
513         alias pFT_Face_GetCharVariantIsDefault = FT_Int function(FT_Face face, FT_ULong charcode, FT_ULong variantSelector);;
514         alias pFT_Face_GetVariantSelectors = FT_UInt32* function(FT_Face face);
515         alias pFT_Face_GetVariantsOfChar = FT_UInt32* function(FT_Face face, FT_ULong charcode);
516         alias pFT_Face_GetCharsOfVariant = FT_UInt32* function(FT_Face face, FT_ULong variantSelector);
517         alias pFT_MulDiv = FT_Long function(FT_Long a, FT_Long b, FT_Long c);
518         alias pFT_MulFix = FT_Long function(FT_Long a, FT_Long b);
519         alias pFT_DivFix = FT_Long function(FT_Long a, FT_Long b);
520         alias pFT_RoundFix = FT_Fixed function(FT_Fixed a);
521         alias pFT_CeilFix = FT_Fixed function(FT_Fixed a);
522         alias pFT_FloorFix = FT_Fixed function(FT_Fixed a);
523         alias pFT_Vector_Transform = void function(FT_Vector* vector, FT_Matrix* matrix);
524         alias pFT_Library_Version = void function(FT_Library library, FT_Int* amajor, FT_Int* aminor, FT_Int* apatch);
525         alias pFT_Face_CheckTrueTypePatents = FT_Bool function(FT_Face face);
526         alias pFT_Face_SetUnpatentedHinting = FT_Bool function(FT_Face face, FT_Bool value);
527 
528         static if(ftSupport >= FTSupport.ft28) {
529             alias pFT_Face_Properties = FT_Error function(FT_Face face, FT_UInt num_properties, FT_Parameter* properties);
530         }
531         static if(ftSupport <= FTSupport.ft210) {
532             // Moved to ftcolor.h in 2.11
533             alias pFT_Get_Color_Glyph_Layer = FT_Bool function(FT_Face face, FT_UInt base_glyph, FT_UInt* aglyph_index, FT_UInt* acolor_index, FT_LayerIterator* iterator);
534         }
535         static if(ftSupport >= FTSupport.ft211) {
536             alias pFT_Get_Transform = void function(FT_Face face, FT_Matrix* matrix, FT_Vector* delta);
537         }
538     }
539 
540     __gshared {
541         pFT_Init_FreeType FT_Init_FreeType;
542         pFT_Done_FreeType FT_Done_FreeType;
543         pFT_New_Face FT_New_Face;
544         pFT_New_Memory_Face FT_New_Memory_Face;
545         pFT_Open_Face FT_Open_Face;
546         pFT_Attach_File FT_Attach_File;
547         pFT_Attach_Stream FT_Attach_Stream;
548         pFT_Reference_Face FT_Reference_Face;
549         pFT_Done_Face FT_Done_Face;
550         pFT_Select_Size FT_Select_Size;
551         pFT_Request_Size FT_Request_Size;
552         pFT_Set_Char_Size FT_Set_Char_Size;
553         pFT_Set_Pixel_Sizes FT_Set_Pixel_Sizes;
554         pFT_Load_Glyph FT_Load_Glyph;
555         pFT_Load_Char FT_Load_Char;
556         pFT_Set_Transform FT_Set_Transform;
557         pFT_Render_Glyph FT_Render_Glyph;
558         pFT_Get_Kerning FT_Get_Kerning;
559         pFT_Get_Track_Kerning FT_Get_Track_Kerning;
560         pFT_Get_Glyph_Name FT_Get_Glyph_Name;
561         pFT_Get_Postscript_Name FT_Get_Postscript_Name;
562         pFT_Select_Charmap FT_Select_Charmap;
563         pFT_Set_Charmap FT_Set_Charmap;
564         pFT_Get_Charmap_Index FT_Get_Charmap_Index;
565         pFT_Get_Char_Index FT_Get_Char_Index;
566         pFT_Get_First_Char FT_Get_First_Char;
567         pFT_Get_Next_Char FT_Get_Next_Char;
568         pFT_Get_Name_Index FT_Get_Name_Index;
569         pFT_Get_SubGlyph_Info FT_Get_SubGlyph_Info;
570         pFT_Get_FSType_Flags FT_Get_FSType_Flags;
571         pFT_Face_GetCharVariantIndex FT_Face_GetCharVariantIndex;
572         pFT_Face_GetCharVariantIsDefault FT_Face_GetCharVariantIsDefault;
573         pFT_Face_GetVariantSelectors FT_Face_GetVariantSelectors;
574         pFT_Face_GetVariantsOfChar FT_Face_GetVariantsOfChar;
575         pFT_Face_GetCharsOfVariant FT_Face_GetCharsOfVariant;
576         pFT_MulDiv FT_MulDiv;
577         pFT_MulFix FT_MulFix;
578         pFT_DivFix FT_DivFix;
579         pFT_RoundFix FT_RoundFix;
580         pFT_CeilFix FT_CeilFix;
581         pFT_FloorFix FT_FloorFix;
582         pFT_Vector_Transform FT_Vector_Transform;
583         pFT_Library_Version FT_Library_Version;
584         pFT_Face_CheckTrueTypePatents FT_Face_CheckTrueTypePatents;
585         pFT_Face_SetUnpatentedHinting FT_Face_SetUnpatentedHinting;
586 
587         static if(ftSupport >= FTSupport.ft28) {
588             pFT_Face_Properties FT_Face_Properties;
589         }
590         static if(ftSupport <= FTSupport.ft210) {
591             // Moved to ftcolor.h in 2.11
592             pFT_Get_Color_Glyph_Layer FT_Get_Color_Glyph_Layer;
593         }
594         static if(ftSupport >= FTSupport.ft211) {
595             pFT_Get_Transform FT_Get_Transform;
596         }
597     }
598 }