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.dynload;
8 
9 version(BindFT_Static) {}
10 else:
11 
12 import bindbc.loader;
13 import bindbc.freetype.config,
14        bindbc.freetype.bind;
15 
16 private {
17     SharedLib lib;
18     FTSupport loadedVersion;
19 }
20 
21 @nogc nothrow:
22 void unloadFreeType()
23 {
24     if(lib != invalidHandle) {
25         lib.unload();
26     }
27 }
28 
29 FTSupport loadedFreeTypeVersion() { return loadedVersion; }
30 
31 bool isFreeTypeLoaded()
32 {
33     return  lib != invalidHandle;
34 }
35 
36 FTSupport loadFreeType()
37 {
38     // #1778 prevents me from using static arrays here :(
39     version(Windows) {
40         const(char)[][3] libNames = [
41             "freetype.dll",
42             "libfreetype.dll",
43             "libfreetype-6.dll"
44         ];
45     }
46     else version(OSX) {
47         const(char)[][6] libNames = [
48             "libfreetype.dylib",
49             "libfreetype.6.dylib",
50             "/usr/X11/lib/libfreetype.dylib",
51             "/usr/X11/lib/libfreetype.6.dylib",
52             "/opt/X11/lib/libfreetype.dylib",
53             "/opt/X11/lib/libfreetype.6.dylib"
54         ];
55     }
56     else version(Posix) {
57         const(char)[][2] libNames = [
58             "libfreetype.so.6",
59             "libfreetype.so"
60         ];
61     }
62     else static assert(0, "bindbc-freetype is not yet supported on this platform.");
63 
64     FTSupport ret;
65     foreach(name; libNames) {
66         ret = loadFreeType(name.ptr);
67         if(ret != FTSupport.noLibrary) break;
68     }
69     return ret;
70 }
71 
72 FTSupport loadFreeType(const(char)* libName)
73 {
74     lib = load(libName);
75     if(lib == invalidHandle) {
76         return FTSupport.noLibrary;
77     }
78 
79     auto errCount = errorCount();
80     loadedVersion = FTSupport.badLibrary;
81 
82     lib.bindSymbol(cast(void**)&FT_Init_FreeType, "FT_Init_FreeType");
83     lib.bindSymbol(cast(void**)&FT_Done_FreeType, "FT_Done_FreeType");
84     lib.bindSymbol(cast(void**)&FT_New_Face, "FT_New_Face");
85     lib.bindSymbol(cast(void**)&FT_New_Memory_Face, "FT_New_Memory_Face");
86     lib.bindSymbol(cast(void**)&FT_Open_Face, "FT_Open_Face");
87     lib.bindSymbol(cast(void**)&FT_Attach_File, "FT_Attach_File");
88     lib.bindSymbol(cast(void**)&FT_Attach_Stream, "FT_Attach_Stream");
89     lib.bindSymbol(cast(void**)&FT_Reference_Face, "FT_Reference_Face");
90     lib.bindSymbol(cast(void**)&FT_Done_Face, "FT_Done_Face");
91     lib.bindSymbol(cast(void**)&FT_Select_Size, "FT_Select_Size");
92     lib.bindSymbol(cast(void**)&FT_Request_Size, "FT_Request_Size");
93     lib.bindSymbol(cast(void**)&FT_Set_Char_Size, "FT_Set_Char_Size");
94     lib.bindSymbol(cast(void**)&FT_Set_Pixel_Sizes, "FT_Set_Pixel_Sizes");
95     lib.bindSymbol(cast(void**)&FT_Load_Glyph, "FT_Load_Glyph");
96     lib.bindSymbol(cast(void**)&FT_Load_Char, "FT_Load_Char");
97     lib.bindSymbol(cast(void**)&FT_Set_Transform, "FT_Set_Transform");
98     lib.bindSymbol(cast(void**)&FT_Render_Glyph, "FT_Render_Glyph");
99     lib.bindSymbol(cast(void**)&FT_Get_Kerning, "FT_Get_Kerning");
100     lib.bindSymbol(cast(void**)&FT_Get_Track_Kerning, "FT_Get_Track_Kerning");
101     lib.bindSymbol(cast(void**)&FT_Get_Glyph_Name, "FT_Get_Glyph_Name");
102     lib.bindSymbol(cast(void**)&FT_Get_Postscript_Name, "FT_Get_Postscript_Name");
103     lib.bindSymbol(cast(void**)&FT_Select_Charmap, "FT_Select_Charmap");
104     lib.bindSymbol(cast(void**)&FT_Set_Charmap, "FT_Set_Charmap");
105     lib.bindSymbol(cast(void**)&FT_Get_Charmap_Index, "FT_Get_Charmap_Index");
106     lib.bindSymbol(cast(void**)&FT_Get_Char_Index, "FT_Get_Char_Index");
107     lib.bindSymbol(cast(void**)&FT_Get_First_Char, "FT_Get_First_Char");
108     lib.bindSymbol(cast(void**)&FT_Get_Next_Char, "FT_Get_Next_Char");
109     lib.bindSymbol(cast(void**)&FT_Get_Name_Index, "FT_Get_Name_Index");
110     lib.bindSymbol(cast(void**)&FT_Get_SubGlyph_Info, "FT_Get_SubGlyph_Info");
111     lib.bindSymbol(cast(void**)&FT_Get_Color_Glyph_Layer, "FT_Get_Color_Glyph_Layer");
112     lib.bindSymbol(cast(void**)&FT_Get_FSType_Flags, "FT_Get_FSType_Flags");
113     lib.bindSymbol(cast(void**)&FT_Face_GetCharVariantIndex, "FT_Face_GetCharVariantIndex");
114     lib.bindSymbol(cast(void**)&FT_Face_GetCharVariantIsDefault, "FT_Face_GetCharVariantIsDefault");
115     lib.bindSymbol(cast(void**)&FT_Face_GetVariantSelectors, "FT_Face_GetVariantSelectors");
116     lib.bindSymbol(cast(void**)&FT_Face_GetVariantsOfChar, "FT_Face_GetVariantsOfChar");
117     lib.bindSymbol(cast(void**)&FT_Face_GetCharsOfVariant, "FT_Face_GetCharsOfVariant");
118     lib.bindSymbol(cast(void**)&FT_MulDiv, "FT_MulDiv");
119     lib.bindSymbol(cast(void**)&FT_MulFix, "FT_MulFix");
120     lib.bindSymbol(cast(void**)&FT_DivFix, "FT_DivFix");
121     lib.bindSymbol(cast(void**)&FT_RoundFix, "FT_RoundFix");
122     lib.bindSymbol(cast(void**)&FT_CeilFix, "FT_CeilFix");
123     lib.bindSymbol(cast(void**)&FT_FloorFix, "FT_FloorFix");
124     lib.bindSymbol(cast(void**)&FT_Vector_Transform, "FT_Vector_Transform");
125     lib.bindSymbol(cast(void**)&FT_Library_Version, "FT_Library_Version");
126     lib.bindSymbol(cast(void**)&FT_Face_CheckTrueTypePatents, "FT_Face_CheckTrueTypePatents");
127     lib.bindSymbol(cast(void**)&FT_Face_SetUnpatentedHinting, "FT_Face_SetUnpatentedHinting");
128 
129     lib.bindSymbol(cast(void**)&FT_Get_Advance, "FT_Get_Advance");
130     lib.bindSymbol(cast(void**)&FT_Get_Advances, "FT_Get_Advances");
131 
132     lib.bindSymbol(cast(void**)&FT_Outline_Get_BBox, "FT_Outline_Get_BBox");
133 
134     version(linux) {
135         lib.bindSymbol(cast(void**)&FT_Get_BDF_Charset_ID, "FT_Get_BDF_Charset_ID");
136         lib.bindSymbol(cast(void**)&FT_Get_BDF_Property, "FT_Get_BDF_Property");
137     }
138 
139     lib.bindSymbol(cast(void**)&FT_Bitmap_Init, "FT_Bitmap_Init");
140     lib.bindSymbol(cast(void**)&FT_Bitmap_Copy, "FT_Bitmap_Copy");
141     lib.bindSymbol(cast(void**)&FT_Bitmap_Embolden, "FT_Bitmap_Embolden");
142     lib.bindSymbol(cast(void**)&FT_Bitmap_Convert, "FT_Bitmap_Convert");
143     lib.bindSymbol(cast(void**)&FT_GlyphSlot_Own_Bitmap, "FT_GlyphSlot_Own_Bitmap");
144     lib.bindSymbol(cast(void**)&FT_Bitmap_Done, "FT_Bitmap_Done");
145 
146     static if(enableBZIP2) {
147         lib.bindSymbol(cast(void**)&FT_Stream_OpenBzip2, "FT_Stream_OpenBzip2");
148     }
149 
150     lib.bindSymbol(cast(void**)&FTC_Manager_New, "FTC_Manager_New");
151     lib.bindSymbol(cast(void**)&FTC_Manager_Reset, "FTC_Manager_Reset");
152     lib.bindSymbol(cast(void**)&FTC_Manager_Done, "FTC_Manager_Done");
153     lib.bindSymbol(cast(void**)&FTC_Manager_LookupFace, "FTC_Manager_LookupFace");
154     lib.bindSymbol(cast(void**)&FTC_Manager_LookupSize, "FTC_Manager_LookupSize");
155     lib.bindSymbol(cast(void**)&FTC_Node_Unref, "FTC_Node_Unref");
156     lib.bindSymbol(cast(void**)&FTC_Manager_RemoveFaceID, "FTC_Manager_RemoveFaceID");
157     lib.bindSymbol(cast(void**)&FTC_CMapCache_New, "FTC_CMapCache_New");
158     lib.bindSymbol(cast(void**)&FTC_CMapCache_Lookup, "FTC_CMapCache_Lookup");
159     lib.bindSymbol(cast(void**)&FTC_ImageCache_New, "FTC_ImageCache_New");
160     lib.bindSymbol(cast(void**)&FTC_ImageCache_Lookup, "FTC_ImageCache_Lookup");
161     lib.bindSymbol(cast(void**)&FTC_ImageCache_LookupScaler, "FTC_ImageCache_LookupScaler");
162     lib.bindSymbol(cast(void**)&FTC_SBitCache_New, "FTC_SBitCache_New");
163     lib.bindSymbol(cast(void**)&FTC_SBitCache_Lookup, "FTC_SBitCache_Lookup");
164     lib.bindSymbol(cast(void**)&FTC_SBitCache_LookupScaler, "FTC_SBitCache_LookupScaler");
165 
166     lib.bindSymbol(cast(void**)&FT_Get_CID_Registry_Ordering_Supplement, "FT_Get_CID_Registry_Ordering_Supplement");
167     lib.bindSymbol(cast(void**)&FT_Get_CID_Is_Internally_CID_Keyed, "FT_Get_CID_Is_Internally_CID_Keyed");
168     lib.bindSymbol(cast(void**)&FT_Get_CID_From_Glyph_Index, "FT_Get_CID_From_Glyph_Index");
169 
170     lib.bindSymbol(cast(void**)&FT_Error_String, "FT_Error_String");
171 
172     lib.bindSymbol(cast(void**)&FT_Get_Font_Format, "FT_Get_Font_Format");
173 
174     lib.bindSymbol(cast(void**)&FT_Get_Gasp, "FT_Get_Gasp");
175 
176     lib.bindSymbol(cast(void**)&FT_Get_Glyph, "FT_Get_Glyph");
177     lib.bindSymbol(cast(void**)&FT_Glyph_Copy, "FT_Glyph_Copy");
178     lib.bindSymbol(cast(void**)&FT_Glyph_Transform, "FT_Glyph_Transform");
179     lib.bindSymbol(cast(void**)&FT_Glyph_Get_CBox, "FT_Glyph_Get_CBox");
180     lib.bindSymbol(cast(void**)&FT_Glyph_To_Bitmap, "FT_Glyph_To_Bitmap");
181     lib.bindSymbol(cast(void**)&FT_Done_Glyph, "FT_Done_Glyph");
182     lib.bindSymbol(cast(void**)&FT_Matrix_Multiply, "FT_Matrix_Multiply");
183     lib.bindSymbol(cast(void**)&FT_Matrix_Invert, "FT_Matrix_Invert");
184 
185     lib.bindSymbol(cast(void**)&FT_TrueTypeGX_Validate, "FT_TrueTypeGX_Validate");
186     lib.bindSymbol(cast(void**)&FT_TrueTypeGX_Free, "FT_TrueTypeGX_Free");
187     lib.bindSymbol(cast(void**)&FT_ClassicKern_Validate, "FT_ClassicKern_Validate");
188     lib.bindSymbol(cast(void**)&FT_ClassicKern_Free, "FT_ClassicKern_Free");
189 
190     lib.bindSymbol(cast(void**)&FT_Stream_OpenGzip, "FT_Stream_OpenGzip");
191     lib.bindSymbol(cast(void**)&FT_Gzip_Uncompress, "FT_Gzip_Uncompress");
192 
193     lib.bindSymbol(cast(void**)&FT_Library_SetLcdFilter, "FT_Library_SetLcdFilter");
194     lib.bindSymbol(cast(void**)&FT_Library_SetLcdFilterWeights, "FT_Library_SetLcdFilterWeights");
195 
196     lib.bindSymbol(cast(void**)&FT_List_Find, "FT_List_Find");
197     lib.bindSymbol(cast(void**)&FT_List_Add, "FT_List_Add");
198     lib.bindSymbol(cast(void**)&FT_List_Insert, "FT_List_Insert");
199     lib.bindSymbol(cast(void**)&FT_List_Remove, "FT_List_Remove");
200     lib.bindSymbol(cast(void**)&FT_List_Up, "FT_List_Up");
201     lib.bindSymbol(cast(void**)&FT_List_Iterate, "FT_List_Iterate");
202     lib.bindSymbol(cast(void**)&FT_List_Finalize, "FT_List_Finalize");
203 
204     lib.bindSymbol(cast(void**)&FT_Stream_OpenLZW, "FT_Stream_OpenLZW");
205 
206     lib.bindSymbol(cast(void**)&FT_Get_Multi_Master, "FT_Get_Multi_Master");
207     lib.bindSymbol(cast(void**)&FT_Get_MM_Var, "FT_Get_MM_Var");
208     lib.bindSymbol(cast(void**)&FT_Set_MM_Design_Coordinates, "FT_Set_MM_Design_Coordinates");
209     lib.bindSymbol(cast(void**)&FT_Set_Var_Design_Coordinates, "FT_Set_Var_Design_Coordinates");
210     lib.bindSymbol(cast(void**)&FT_Set_MM_Blend_Coordinates, "FT_Set_MM_Blend_Coordinates");
211     lib.bindSymbol(cast(void**)&FT_Set_Var_Blend_Coordinates, "FT_Set_Var_Blend_Coordinates");
212 
213     lib.bindSymbol(cast(void**)&FT_Add_Module, "FT_Add_Module");
214     lib.bindSymbol(cast(void**)&FT_Get_Module, "FT_Get_Module");
215     lib.bindSymbol(cast(void**)&FT_Remove_Module, "FT_Remove_Module");
216     lib.bindSymbol(cast(void**)&FT_Property_Set, "FT_Property_Set");
217     lib.bindSymbol(cast(void**)&FT_Property_Get, "FT_Property_Get");
218     lib.bindSymbol(cast(void**)&FT_Reference_Library, "FT_Reference_Library");
219     lib.bindSymbol(cast(void**)&FT_New_Library, "FT_New_Library");
220     lib.bindSymbol(cast(void**)&FT_Done_Library, "FT_Done_Library");
221     lib.bindSymbol(cast(void**)&FT_Set_Debug_Hook, "FT_Set_Debug_Hook");
222     lib.bindSymbol(cast(void**)&FT_Add_Default_Modules, "FT_Add_Default_Modules");
223     lib.bindSymbol(cast(void**)&FT_Get_TrueType_Engine_Type, "FT_Get_TrueType_Engine_Type");
224 
225     lib.bindSymbol(cast(void**)&FT_OpenType_Validate, "FT_OpenType_Validate");
226     lib.bindSymbol(cast(void**)&FT_OpenType_Free, "FT_OpenType_Free");
227 
228     lib.bindSymbol(cast(void**)&FT_Outline_Decompose, "FT_Outline_Decompose");
229     lib.bindSymbol(cast(void**)&FT_Outline_New, "FT_Outline_New");
230     lib.bindSymbol(cast(void**)&FT_Outline_Done, "FT_Outline_Done");
231     lib.bindSymbol(cast(void**)&FT_Outline_Check, "FT_Outline_Check");
232     lib.bindSymbol(cast(void**)&FT_Outline_Get_CBox, "FT_Outline_Get_CBox");
233     lib.bindSymbol(cast(void**)&FT_Outline_Translate, "FT_Outline_Translate");
234     lib.bindSymbol(cast(void**)&FT_Outline_Copy, "FT_Outline_Copy");
235     lib.bindSymbol(cast(void**)&FT_Outline_Transform, "FT_Outline_Transform");
236     lib.bindSymbol(cast(void**)&FT_Outline_Embolden, "FT_Outline_Embolden");
237     lib.bindSymbol(cast(void**)&FT_Outline_EmboldenXY, "FT_Outline_EmboldenXY");
238     lib.bindSymbol(cast(void**)&FT_Outline_Reverse, "FT_Outline_Reverse");
239     lib.bindSymbol(cast(void**)&FT_Outline_Get_Bitmap, "FT_Outline_Get_Bitmap");
240     lib.bindSymbol(cast(void**)&FT_Outline_Render, "FT_Outline_Render");
241     lib.bindSymbol(cast(void**)&FT_Outline_Get_Orientation, "FT_Outline_Get_Orientation");
242 
243     lib.bindSymbol(cast(void**)&FT_Get_PFR_Metrics, "FT_Get_PFR_Metrics");
244     lib.bindSymbol(cast(void**)&FT_Get_PFR_Kerning, "FT_Get_PFR_Kerning");
245     lib.bindSymbol(cast(void**)&FT_Get_PFR_Advance, "FT_Get_PFR_Advance");
246 
247     lib.bindSymbol(cast(void**)&FT_Get_Renderer, "FT_Get_Renderer");
248     lib.bindSymbol(cast(void**)&FT_Set_Renderer, "FT_Set_Renderer");
249 
250     lib.bindSymbol(cast(void**)&FT_New_Size, "FT_New_Size");
251     lib.bindSymbol(cast(void**)&FT_Done_Size, "FT_Done_Size");
252     lib.bindSymbol(cast(void**)&FT_Activate_Size, "FT_Activate_Size");
253 
254     lib.bindSymbol(cast(void**)&FT_Get_Sfnt_Name_Count, "FT_Get_Sfnt_Name_Count");
255     lib.bindSymbol(cast(void**)&FT_Get_Sfnt_Name, "FT_Get_Sfnt_Name");
256 
257     lib.bindSymbol(cast(void**)&FT_Outline_GetInsideBorder, "FT_Outline_GetInsideBorder");
258     lib.bindSymbol(cast(void**)&FT_Outline_GetOutsideBorder, "FT_Outline_GetOutsideBorder");
259     lib.bindSymbol(cast(void**)&FT_Stroker_New, "FT_Stroker_New");
260     lib.bindSymbol(cast(void**)&FT_Stroker_Set, "FT_Stroker_Set");
261     lib.bindSymbol(cast(void**)&FT_Stroker_Rewind, "FT_Stroker_Rewind");
262     lib.bindSymbol(cast(void**)&FT_Stroker_ParseOutline, "FT_Stroker_ParseOutline");
263     lib.bindSymbol(cast(void**)&FT_Stroker_BeginSubPath, "FT_Stroker_BeginSubPath");
264     lib.bindSymbol(cast(void**)&FT_Stroker_EndSubPath, "FT_Stroker_EndSubPath");
265     lib.bindSymbol(cast(void**)&FT_Stroker_LineTo, "FT_Stroker_LineTo");
266     lib.bindSymbol(cast(void**)&FT_Stroker_ConicTo, "FT_Stroker_ConicTo");
267     lib.bindSymbol(cast(void**)&FT_Stroker_CubicTo, "FT_Stroker_CubicTo");
268     lib.bindSymbol(cast(void**)&FT_Stroker_GetBorderCounts, "FT_Stroker_GetBorderCounts");
269     lib.bindSymbol(cast(void**)&FT_Stroker_ExportBorder, "FT_Stroker_ExportBorder");
270     lib.bindSymbol(cast(void**)&FT_Stroker_GetCounts, "FT_Stroker_GetCounts");
271     lib.bindSymbol(cast(void**)&FT_Stroker_Export, "FT_Stroker_Export");
272     lib.bindSymbol(cast(void**)&FT_Stroker_Done, "FT_Stroker_Done");
273     lib.bindSymbol(cast(void**)&FT_Glyph_Stroke, "FT_Glyph_Stroke");
274     lib.bindSymbol(cast(void**)&FT_Glyph_StrokeBorder, "FT_Glyph_StrokeBorder");
275 
276     lib.bindSymbol(cast(void**)&FT_GlyphSlot_Embolden, "FT_GlyphSlot_Embolden");
277     lib.bindSymbol(cast(void**)&FT_GlyphSlot_Oblique, "FT_GlyphSlot_Oblique");
278 
279     lib.bindSymbol(cast(void**)&FT_Sin, "FT_Sin");
280     lib.bindSymbol(cast(void**)&FT_Cos, "FT_Cos");
281     lib.bindSymbol(cast(void**)&FT_Tan, "FT_Tan");
282     lib.bindSymbol(cast(void**)&FT_Atan2, "FT_Atan2");
283     lib.bindSymbol(cast(void**)&FT_Angle_Diff, "FT_Angle_Diff");
284     lib.bindSymbol(cast(void**)&FT_Vector_Unit, "FT_Vector_Unit");
285     lib.bindSymbol(cast(void**)&FT_Vector_Rotate, "FT_Vector_Rotate");
286     lib.bindSymbol(cast(void**)&FT_Vector_Length, "FT_Vector_Length");
287     lib.bindSymbol(cast(void**)&FT_Vector_Polarize, "FT_Vector_Polarize");
288     lib.bindSymbol(cast(void**)&FT_Vector_From_Polar, "FT_Vector_From_Polar");
289 
290     lib.bindSymbol(cast(void**)&FT_Get_WinFNT_Header, "FT_Get_WinFNT_Header");
291 
292     lib.bindSymbol(cast(void**)&FT_Has_PS_Glyph_Names, "FT_Has_PS_Glyph_Names");
293     lib.bindSymbol(cast(void**)&FT_Get_PS_Font_Info, "FT_Get_PS_Font_Info");
294     lib.bindSymbol(cast(void**)&FT_Get_PS_Font_Private, "FT_Get_PS_Font_Private");
295     lib.bindSymbol(cast(void**)&FT_Get_PS_Font_Value, "FT_Get_PS_Font_Value");
296 
297     lib.bindSymbol(cast(void**)&FT_Get_Sfnt_Table, "FT_Get_Sfnt_Table");
298     lib.bindSymbol(cast(void**)&FT_Load_Sfnt_Table, "FT_Load_Sfnt_Table");
299     lib.bindSymbol(cast(void**)&FT_Sfnt_Table_Info, "FT_Sfnt_Table_Info");
300     lib.bindSymbol(cast(void**)&FT_Get_CMap_Language_ID, "FT_Get_CMap_Language_ID");
301     lib.bindSymbol(cast(void**)&FT_Get_CMap_Format, "FT_Get_CMap_Format");
302 
303     if(errorCount() != errCount) return FTSupport.badLibrary;
304     else loadedVersion = FTSupport.ft26;
305 
306     static if(ftSupport >= FTSupport.ft27) {
307         lib.bindSymbol(cast(void**)&FT_Get_Var_Design_Coordinates, "FT_Get_Var_Design_Coordinates");
308         lib.bindSymbol(cast(void**)&FT_Get_MM_Blend_Coordinates, "FT_Get_MM_Blend_Coordinates");
309         lib.bindSymbol(cast(void**)&FT_Get_Var_Blend_Coordinates, "FT_Get_Var_Blend_Coordinates");
310 
311         if(errorCount() != errCount) return FTSupport.badLibrary;
312         else loadedVersion = FTSupport.ft27;
313     }
314     static if(ftSupport >= FTSupport.ft28) {
315         lib.bindSymbol(cast(void**)&FT_Face_Properties, "FT_Face_Properties");
316         lib.bindSymbol(cast(void**)&FT_Get_Var_Axis_Flags, "FT_Get_Var_Axis_Flags");
317         lib.bindSymbol(cast(void**)&FT_Set_Default_Properties, "FT_Set_Default_Properties");
318         lib.bindSymbol(cast(void**)&FT_Get_Sfnt_LangTag, "FT_Get_Sfnt_LangTag");
319 
320         if(errorCount() != errCount) return FTSupport.badLibrary;
321         else loadedVersion = FTSupport.ft28;
322     }
323     static if(ftSupport >= FTSupport.ft29) {
324         lib.bindSymbol(cast(void**)&FT_Done_MM_Var, "FT_Done_MM_Var");
325         lib.bindSymbol(cast(void**)&FT_Set_Named_Instance, "FT_Set_Named_Instance");
326 
327         if(errorCount() != errCount) return FTSupport.badLibrary;
328         else loadedVersion = FTSupport.ft29;
329     }
330     static if(ftSupport >= FTSupport.ft210) {
331         lib.bindSymbol(cast(void**)&FT_Palette_Data_Get, "FT_Palette_Data_Get");
332         lib.bindSymbol(cast(void**)&FT_Palette_Select, "FT_Palette_Select");
333         lib.bindSymbol(cast(void**)&FT_Palette_Set_Foreground_Color, "FT_Palette_Set_Foreground_Color");
334         lib.bindSymbol(cast(void**)&FT_Library_SetLcdGeometry, "FT_Library_SetLcdGeometry");
335         lib.bindSymbol(cast(void**)&FT_Bitmap_Blend, "FT_Bitmap_Blend");
336         lib.bindSymbol(cast(void**)&FT_New_Glyph, "FT_New_Glyph");
337         lib.bindSymbol(cast(void**)&FT_Set_MM_WeightVector, "FT_Set_MM_WeightVector");
338         lib.bindSymbol(cast(void**)&FT_Get_MM_WeightVector, "FT_Get_MM_WeightVector");
339 
340 
341         if(errorCount() != errCount) return FTSupport.badLibrary;
342         else loadedVersion = FTSupport.ft210;
343     }
344     static if(ftSupport >= FTSupport.ft211) {
345         lib.bindSymbol(cast(void**)&FT_Get_Transform, "FT_Get_Transform");
346         lib.bindSymbol(cast(void**)&FT_Get_Color_Glyph_Layer, "FT_Get_Color_Glyph_Layer");
347         lib.bindSymbol(cast(void**)&FT_Get_Color_Glyph_Paint, "FT_Get_Color_Glyph_Paint");
348         lib.bindSymbol(cast(void**)&FT_Get_Paint_Layers, "FT_Get_Paint_Layers");
349         lib.bindSymbol(cast(void**)&FT_Get_Colorline_Stops, "FT_Get_Colorline_Stops");
350         lib.bindSymbol(cast(void**)&FT_Get_Paint, "FT_Get_Paint");
351         lib.bindSymbol(cast(void**)&FT_Trace_Set_Level, "FT_Trace_Set_Level");
352         lib.bindSymbol(cast(void**)&FT_Trace_Set_Default_Level, "FT_Trace_Set_Default_Level");
353         lib.bindSymbol(cast(void**)&FT_Set_Log_Handler, "FT_Set_Log_Handler");
354         lib.bindSymbol(cast(void**)&FT_Set_Default_Log_Handler, "FT_Set_Default_Log_Handler");
355 
356 
357         if(errorCount() != errCount) return FTSupport.badLibrary;
358         else loadedVersion = FTSupport.ft211;
359     }
360 
361     return loadedVersion;
362 }