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