1 
2 //          Copyright 2018 - 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.sdl.ttf;
8 
9 import bindbc.sdl.config;
10 static if(bindSDLTTF):
11 
12 import core.stdc.config;
13 import bindbc.sdl.bind.sdlerror : SDL_GetError, SDL_SetError;
14 import bindbc.sdl.bind.sdlpixels : SDL_Color;
15 import bindbc.sdl.bind.sdlrwops : SDL_RWops;
16 import bindbc.sdl.bind.sdlsurface : SDL_Surface;
17 import bindbc.sdl.bind.sdlversion : SDL_version;
18 
19 alias TTF_SetError = SDL_SetError;
20 alias TTF_GetError = SDL_GetError;
21 
22 enum SDLTTFSupport {
23     noLibrary,
24     badLibrary,
25     sdlTTF2012 = 2012,
26     sdlTTF2013 = 2013,
27     sdlTTF2014 = 2014,
28 }
29 
30 enum ubyte SDL_TTF_MAJOR_VERSION = 2;
31 enum ubyte SDL_TTF_MINOR_VERSION = 0;
32 
33 version(SDL_TTF_2014) {
34     enum sdlTTFSupport = SDLTTFSupport.sdlTTF2014;
35     enum ubyte SDL_TTF_PATCHLEVEL = 14;
36 }
37 else version(SDL_TTF_2013) {
38     enum sdlTTFSupport = SDLTTFSupport.sdlTTF2013;
39     enum ubyte SDL_TTF_PATCHLEVEL = 13;
40 }
41 else {
42     enum sdlTTFSupport = SDLTTFSupport.sdlTTF2012;
43     enum ubyte SDL_TTF_PATCHLEVEL = 12;
44 }
45 
46 alias TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION;
47 alias TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION;
48 alias TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL;
49 
50 @nogc nothrow
51 void SDL_TTF_VERSION(SDL_version* X) {
52     X.major = SDL_TTF_MAJOR_VERSION;
53     X.minor = SDL_TTF_MINOR_VERSION;
54     X.patch = SDL_TTF_PATCHLEVEL;
55 }
56 alias TTF_VERSION = SDL_TTF_VERSION;
57 
58 enum {
59     UNICODE_BOM_NATIVE = 0xFEFF,
60     UNICODE_BOM_SWAPPED = 0xFFFE,
61     TTF_STYLE_NORMAL = 0x00,
62     TTF_STYLE_BOLD = 0x01,
63     TTF_STYLE_ITALIC = 0x02,
64     TTF_STYLE_UNDERLINE = 0x04,
65     TTF_STYLE_STRIKETHROUGH = 0x08,
66 }
67 
68 enum {
69     TTF_HINTING_NORMAL = 0,
70     TTF_HINTING_LIGHT = 1,
71     TTF_HINTING_MONO = 2,
72     TTF_HINTING_NONE = 3,
73 }
74 
75 struct TTF_Font;
76 
77 static if(staticBinding) {
78     extern(C) @nogc nothrow {
79         SDL_version* TTF_Linked_Version();
80         void TTF_ByteSwappedUNICODE(int swapped);
81         int TTF_Init();
82         TTF_Font * TTF_OpenFont(const(char)* file, int ptsize);
83         TTF_Font * TTF_OpenFontIndex(const(char)* file, int ptsize, c_long index);
84         TTF_Font * TTF_OpenFontRW(SDL_RWops* src, int freesrc, int ptsize);
85         TTF_Font * TTF_OpenFontIndexRW(SDL_RWops* src, int freesrc, int ptsize, c_long index);
86         int TTF_GetFontStyle(const(TTF_Font)* font);
87         void TTF_SetFontStyle(const(TTF_Font)* font ,int style);
88         int TTF_GetFontOutline(const(TTF_Font)* font);
89         void TTF_SetFontOutline(TTF_Font* font, int outline);
90         int TTF_GetFontHinting(const(TTF_Font)* font);
91         void TTF_SetFontHinting(TTF_Font* font, int hinting);
92         int TTF_FontHeight(const(TTF_Font)* font);
93         int TTF_FontAscent(const(TTF_Font)* font);
94         int TTF_FontDescent(const(TTF_Font)* font);
95         int TTF_FontLineSkip(const(TTF_Font)* font);
96         int TTF_GetFontKerning(const(TTF_Font)* font);
97         void TTF_SetFontKerning(TTF_Font* font, int allowed);
98         int TTF_FontFaces(const(TTF_Font)* font);
99         int TTF_FontFaceIsFixedWidth(const(TTF_Font)* font);
100         char* TTF_FontFaceFamilyName(const(TTF_Font)* font);
101         char* TTF_FontFaceStyleName(const(TTF_Font)* font);
102         int TTF_GlyphIsProvided(const(TTF_Font)* font, ushort ch);
103         int TTF_GlyphMetrics(TTF_Font* font, ushort ch, int* minx, int* maxx, int* miny, int* maxy, int* advance);
104         int TTF_SizeText(TTF_Font* font, const(char)* text, int* w, int* h);
105         int TTF_SizeUTF8(TTF_Font* font, const(char)* text, int* w, int* h);
106         int TTF_SizeUNICODE(TTF_Font* font, const(ushort)* text, int* w, int* h);
107         SDL_Surface* TTF_RenderText_Solid(TTF_Font* font, const(char)* text, SDL_Color fg);
108         SDL_Surface* TTF_RenderUTF8_Solid(TTF_Font* font, const(char)* text, SDL_Color fg);
109         SDL_Surface* TTF_RenderUNICODE_Solid(TTF_Font* font, const(ushort)* text, SDL_Color fg);
110         SDL_Surface* TTF_RenderGlyph_Solid(TTF_Font* font, ushort ch, SDL_Color fg);
111         SDL_Surface* TTF_RenderText_Shaded(TTF_Font* font, const(char)* text, SDL_Color fg, SDL_Color bg);
112         SDL_Surface* TTF_RenderUTF8_Shaded(TTF_Font* font, const(char)* text, SDL_Color fg, SDL_Color bg);
113         SDL_Surface* TTF_RenderUNICODE_Shaded(TTF_Font* font, const(ushort)* text, SDL_Color fg, SDL_Color bg);
114         SDL_Surface TTF_RenderGlyph_Shaded(TTF_Font* font, ushort ch, SDL_Color fg,SDL_Color bg);
115         SDL_Surface* TTF_RenderText_Blended(TTF_Font* font, const(char)* text, SDL_Color fg);
116         SDL_Surface* TTF_RenderUTF8_Blended(TTF_Font* font, const(char)* text, SDL_Color fg);
117         SDL_Surface* TTF_RenderUNICODE_Blended(TTF_Font* font, const(ushort)* text, SDL_Color fg);
118         SDL_Surface* TTF_RenderText_Blended_Wrapped(TTF_Font* font, const(char)* text, SDL_Color fg, uint wrapLength);
119         SDL_Surface* TTF_RenderUTF8_Blended_Wrapped(TTF_Font* font, const(char)* text,SDL_Color fg, uint wrapLength);
120         SDL_Surface* TTF_RenderUNICODE_Blended_Wrapped(TTF_Font* font, const(ushort)* text, SDL_Color fg, uint wrapLength);
121         SDL_Surface* TTF_RenderGlyph_Blended(TTF_Font* font, ushort ch, SDL_Color fg);
122         void TTF_CloseFont(TTF_Font* font);
123         void TTF_Quit();
124         int TTF_WasInit();
125         int TTF_GetFontKerningSize(TTF_Font* font, int prev_index, int index);
126 
127         static if(sdlTTFSupport >= SDLTTFSupport.sdlTTF2014)  {
128             int TTF_GetFontKerningSizeGlyph(TTF_Font* font, ushort previous_ch, ushort ch);
129         }
130     }
131 }
132 else {
133     import bindbc.loader;
134     extern(C) @nogc nothrow {
135         alias pTTF_Linked_Version = SDL_version* function();
136         alias pTTF_ByteSwappedUNICODE = void function(int swapped);
137         alias pTTF_Init = int function();
138         alias pTTF_OpenFont = TTF_Font * function(const(char)* file, int ptsize);
139         alias pTTF_OpenFontIndex = TTF_Font * function(const(char)* file, int ptsize, c_long index);
140         alias pTTF_OpenFontRW = TTF_Font * function(SDL_RWops* src, int freesrc, int ptsize);
141         alias pTTF_OpenFontIndexRW = TTF_Font * function(SDL_RWops* src, int freesrc, int ptsize, c_long index);
142         alias pTTF_GetFontStyle = int function(const(TTF_Font)* font);
143         alias pTTF_SetFontStyle = void function(const(TTF_Font)* font ,int style);
144         alias pTTF_GetFontOutline = int function(const(TTF_Font)* font);
145         alias pTTF_SetFontOutline = void function(TTF_Font* font, int outline);
146         alias pTTF_GetFontHinting = int function(const(TTF_Font)* font);
147         alias pTTF_SetFontHinting = void function(TTF_Font* font, int hinting);
148         alias pTTF_FontHeight = int function(const(TTF_Font)* font);
149         alias pTTF_FontAscent = int function(const(TTF_Font)* font);
150         alias pTTF_FontDescent = int function(const(TTF_Font)* font);
151         alias pTTF_FontLineSkip = int function(const(TTF_Font)* font);
152         alias pTTF_GetFontKerning = int function(const(TTF_Font)* font);
153         alias pTTF_SetFontKerning = void function(TTF_Font* font, int allowed);
154         alias pTTF_FontFaces = int function(const(TTF_Font)* font);
155         alias pTTF_FontFaceIsFixedWidth = int function(const(TTF_Font)* font);
156         alias pTTF_FontFaceFamilyName = char* function(const(TTF_Font)* font);
157         alias pTTF_FontFaceStyleName = char* function(const(TTF_Font)* font);
158         alias pTTF_GlyphIsProvided = int function(const(TTF_Font)* font, ushort ch);
159         alias pTTF_GlyphMetrics = int function(TTF_Font* font, ushort ch, int* minx, int* maxx, int* miny, int* maxy, int* advance);
160         alias pTTF_SizeText = int function(TTF_Font* font, const(char)* text, int* w, int* h);
161         alias pTTF_SizeUTF8 = int function(TTF_Font* font, const(char)* text, int* w, int* h);
162         alias pTTF_SizeUNICODE = int function(TTF_Font* font, const(ushort)* text, int* w, int* h);
163         alias pTTF_RenderText_Solid = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg);
164         alias pTTF_RenderUTF8_Solid = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg);
165         alias pTTF_RenderUNICODE_Solid = SDL_Surface* function(TTF_Font* font, const(ushort)* text,SDL_Color fg);
166         alias pTTF_RenderGlyph_Solid = SDL_Surface* function(TTF_Font* font, ushort ch, SDL_Color fg);
167         alias pTTF_RenderText_Shaded = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg, SDL_Color bg);
168         alias pTTF_RenderUTF8_Shaded = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg, SDL_Color bg);
169         alias pTTF_RenderUNICODE_Shaded = SDL_Surface* function(TTF_Font* font, const(ushort)* text, SDL_Color fg, SDL_Color bg);
170         alias pTTF_RenderGlyph_Shaded = SDL_Surface* function(TTF_Font* font, ushort ch, SDL_Color fg,SDL_Color bg);
171         alias pTTF_RenderText_Blended = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg);
172         alias pTTF_RenderUTF8_Blended = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg);
173         alias pTTF_RenderUNICODE_Blended = SDL_Surface* function(TTF_Font* font, const(ushort)* text, SDL_Color fg);
174         alias pTTF_RenderText_Blended_Wrapped = SDL_Surface* function(TTF_Font* font, const(char)* text, SDL_Color fg, uint wrapLength);
175         alias pTTF_RenderUTF8_Blended_Wrapped = SDL_Surface* function(TTF_Font* font, const(char)* text,SDL_Color fg, uint wrapLength);
176         alias pTTF_RenderUNICODE_Blended_Wrapped = SDL_Surface* function(TTF_Font* font, const(ushort)* text, SDL_Color fg, uint wrapLength);
177         alias pTTF_RenderGlyph_Blended = SDL_Surface* function(TTF_Font* font, ushort ch, SDL_Color fg);
178         alias pTTF_CloseFont = void function(TTF_Font* font);
179         alias pTTF_Quit = void function();
180         alias pTTF_WasInit = int function();
181         alias pTTF_GetFontKerningSize = int function(TTF_Font* font, int prev_index, int index);
182     }
183 
184     __gshared {
185         pTTF_Linked_Version TTF_Linked_Version;
186         pTTF_ByteSwappedUNICODE TTF_ByteSwappedUNICODE;
187         pTTF_Init TTF_Init;
188         pTTF_OpenFont TTF_OpenFont;
189         pTTF_OpenFontIndex TTF_OpenFontIndex;
190         pTTF_OpenFontRW TTF_OpenFontRW;
191         pTTF_OpenFontIndexRW TTF_OpenFontIndexRW;
192         pTTF_GetFontStyle TTF_GetFontStyle;
193         pTTF_SetFontStyle TTF_SetFontStyle;
194         pTTF_GetFontOutline TTF_GetFontOutline;
195         pTTF_SetFontOutline TTF_SetFontOutline;
196         pTTF_GetFontHinting TTF_GetFontHinting;
197         pTTF_SetFontHinting TTF_SetFontHinting;
198         pTTF_FontHeight TTF_FontHeight;
199         pTTF_FontAscent TTF_FontAscent;
200         pTTF_FontDescent TTF_FontDescent;
201         pTTF_FontLineSkip TTF_FontLineSkip;
202         pTTF_GetFontKerning TTF_GetFontKerning;
203         pTTF_SetFontKerning TTF_SetFontKerning;
204         pTTF_FontFaces TTF_FontFaces;
205         pTTF_FontFaceIsFixedWidth TTF_FontFaceIsFixedWidth;
206         pTTF_FontFaceFamilyName TTF_FontFaceFamilyName;
207         pTTF_FontFaceStyleName TTF_FontFaceStyleName;
208         pTTF_GlyphIsProvided TTF_GlyphIsProvided;
209         pTTF_GlyphMetrics TTF_GlyphMetrics;
210         pTTF_SizeText TTF_SizeText;
211         pTTF_SizeUTF8 TTF_SizeUTF8;
212         pTTF_SizeUNICODE TTF_SizeUNICODE;
213         pTTF_RenderText_Solid TTF_RenderText_Solid;
214         pTTF_RenderUTF8_Solid TTF_RenderUTF8_Solid;
215         pTTF_RenderUNICODE_Solid TTF_RenderUNICODE_Solid;
216         pTTF_RenderGlyph_Solid TTF_RenderGlyph_Solid;
217         pTTF_RenderText_Shaded TTF_RenderText_Shaded;
218         pTTF_RenderUTF8_Shaded TTF_RenderUTF8_Shaded;
219         pTTF_RenderUNICODE_Shaded TTF_RenderUNICODE_Shaded;
220         pTTF_RenderGlyph_Shaded TTF_RenderGlyph_Shaded;
221         pTTF_RenderText_Blended TTF_RenderText_Blended;
222         pTTF_RenderUTF8_Blended TTF_RenderUTF8_Blended;
223         pTTF_RenderUNICODE_Blended TTF_RenderUNICODE_Blended;
224         pTTF_RenderText_Blended_Wrapped TTF_RenderText_Blended_Wrapped;
225         pTTF_RenderUTF8_Blended_Wrapped TTF_RenderUTF8_Blended_Wrapped;
226         pTTF_RenderUNICODE_Blended_Wrapped TTF_RenderUNICODE_Blended_Wrapped;
227         pTTF_RenderGlyph_Blended TTF_RenderGlyph_Blended;
228         pTTF_CloseFont TTF_CloseFont;
229         pTTF_Quit TTF_Quit;
230         pTTF_WasInit TTF_WasInit;
231         pTTF_GetFontKerningSize TTF_GetFontKerningSize;
232     }
233 
234     static if(sdlTTFSupport >= SDLTTFSupport.sdlTTF2014) {
235         extern(C) @nogc nothrow {
236             alias pTTF_GetFontKerningSizeGlyphs = int function(TTF_Font* font, ushort previous_ch, ushort ch);
237         }
238 
239         __gshared {
240             pTTF_GetFontKerningSizeGlyphs TTF_GetFontKerningSizeGlyphs;
241         }
242     }
243 
244     private {
245         SharedLib lib;
246         SDLTTFSupport loadedVersion;
247     }
248 
249 @nogc nothrow:
250     void unloadSDLTTF()
251     {
252         if(lib != invalidHandle) {
253             lib.unload();
254         }
255     }
256 
257     SDLTTFSupport loadedSDLTTFVersion() { return loadedVersion; }
258 
259     bool isSDLTTFLoaded()
260     {
261         return  lib != invalidHandle;
262     }
263 
264     SDLTTFSupport loadSDLTTF()
265     {
266         version(Windows) {
267             const(char)[][1] libNames = ["SDL2_ttf.dll"];
268         }
269         else version(OSX) {
270             const(char)[][6] libNames = [
271                 "libSDL2_ttf.dylib",
272                 "/usr/local/lib/libSDL2_ttf.dylib",
273                 "../Frameworks/SDL2_ttf.framework/SDL2_ttf",
274                 "/Library/Frameworks/SDL2_ttf.framework/SDL2_ttf",
275                 "/System/Library/Frameworks/SDL2_ttf.framework/SDL2_ttf",
276                 "/opt/local/lib/libSDL2_ttf.dylib"
277             ];
278         }
279         else version(Posix) {
280             const(char)[][6] libNames = [
281                 "libSDL2_ttf.so",
282                 "/usr/local/lib/libSDL2_ttf.so",
283                 "libSDL2-2.0_ttf.so",
284                 "/usr/local/lib/libSDL2-2.0_ttf.so",
285                 "libSDL2-2.0_ttf.so.0",
286                 "/usr/local/lib/libSDL2-2.0_ttf.so.0"
287             ];
288         }
289         else static assert(0, "bindbc-sdl is not yet supported on this platform.");
290 
291         SDLTTFSupport ret;
292         foreach(name; libNames) {
293             ret = loadSDLTTF(name.ptr);
294             if(ret != SDLTTFSupport.noLibrary) break;
295         }
296         return ret;
297     }
298 
299     SDLTTFSupport loadSDLTTF(const(char)* libName)
300     {
301         lib = load(libName);
302         if(lib == invalidHandle) {
303             return SDLTTFSupport.noLibrary;
304         }
305 
306         auto errCount = errorCount();
307         loadedVersion = SDLTTFSupport.badLibrary;
308 
309         lib.bindSymbol(cast(void**)&TTF_Linked_Version,"TTF_Linked_Version");
310         lib.bindSymbol(cast(void**)&TTF_ByteSwappedUNICODE,"TTF_ByteSwappedUNICODE");
311         lib.bindSymbol(cast(void**)&TTF_Init,"TTF_Init");
312         lib.bindSymbol(cast(void**)&TTF_OpenFont,"TTF_OpenFont");
313         lib.bindSymbol(cast(void**)&TTF_OpenFontIndex,"TTF_OpenFontIndex");
314         lib.bindSymbol(cast(void**)&TTF_OpenFontRW,"TTF_OpenFontRW");
315         lib.bindSymbol(cast(void**)&TTF_OpenFontIndexRW,"TTF_OpenFontIndexRW");
316         lib.bindSymbol(cast(void**)&TTF_GetFontStyle,"TTF_GetFontStyle");
317         lib.bindSymbol(cast(void**)&TTF_SetFontStyle,"TTF_SetFontStyle");
318         lib.bindSymbol(cast(void**)&TTF_GetFontOutline,"TTF_GetFontOutline");
319         lib.bindSymbol(cast(void**)&TTF_SetFontOutline,"TTF_SetFontOutline");
320         lib.bindSymbol(cast(void**)&TTF_GetFontHinting,"TTF_GetFontHinting");
321         lib.bindSymbol(cast(void**)&TTF_SetFontHinting,"TTF_SetFontHinting");
322         lib.bindSymbol(cast(void**)&TTF_FontHeight,"TTF_FontHeight");
323         lib.bindSymbol(cast(void**)&TTF_FontAscent,"TTF_FontAscent");
324         lib.bindSymbol(cast(void**)&TTF_FontDescent,"TTF_FontDescent");
325         lib.bindSymbol(cast(void**)&TTF_FontLineSkip,"TTF_FontLineSkip");
326         lib.bindSymbol(cast(void**)&TTF_GetFontKerning,"TTF_GetFontKerning");
327         lib.bindSymbol(cast(void**)&TTF_SetFontKerning,"TTF_SetFontKerning");
328         lib.bindSymbol(cast(void**)&TTF_FontFaces,"TTF_FontFaces");
329         lib.bindSymbol(cast(void**)&TTF_FontFaceIsFixedWidth,"TTF_FontFaceIsFixedWidth");
330         lib.bindSymbol(cast(void**)&TTF_FontFaceFamilyName,"TTF_FontFaceFamilyName");
331         lib.bindSymbol(cast(void**)&TTF_FontFaceStyleName,"TTF_FontFaceStyleName");
332         lib.bindSymbol(cast(void**)&TTF_GlyphIsProvided,"TTF_GlyphIsProvided");
333         lib.bindSymbol(cast(void**)&TTF_GlyphMetrics,"TTF_GlyphMetrics");
334         lib.bindSymbol(cast(void**)&TTF_SizeText,"TTF_SizeText");
335         lib.bindSymbol(cast(void**)&TTF_SizeUTF8,"TTF_SizeUTF8");
336         lib.bindSymbol(cast(void**)&TTF_SizeUNICODE,"TTF_SizeUNICODE");
337         lib.bindSymbol(cast(void**)&TTF_RenderText_Solid,"TTF_RenderText_Solid");
338         lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Solid,"TTF_RenderUTF8_Solid");
339         lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Solid,"TTF_RenderUNICODE_Solid");
340         lib.bindSymbol(cast(void**)&TTF_RenderGlyph_Solid,"TTF_RenderGlyph_Solid");
341         lib.bindSymbol(cast(void**)&TTF_RenderText_Shaded,"TTF_RenderText_Shaded");
342         lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Shaded,"TTF_RenderUTF8_Shaded");
343         lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Shaded,"TTF_RenderUNICODE_Shaded");
344         lib.bindSymbol(cast(void**)&TTF_RenderGlyph_Shaded,"TTF_RenderGlyph_Shaded");
345         lib.bindSymbol(cast(void**)&TTF_RenderText_Blended,"TTF_RenderText_Blended");
346         lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Blended,"TTF_RenderUTF8_Blended");
347         lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Blended,"TTF_RenderUNICODE_Blended");
348         lib.bindSymbol(cast(void**)&TTF_RenderText_Blended_Wrapped,"TTF_RenderText_Blended_Wrapped");
349         lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Blended_Wrapped,"TTF_RenderUTF8_Blended_Wrapped");
350         lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Blended_Wrapped,"TTF_RenderUNICODE_Blended_Wrapped");
351         lib.bindSymbol(cast(void**)&TTF_RenderGlyph_Blended,"TTF_RenderGlyph_Blended");
352         lib.bindSymbol(cast(void**)&TTF_CloseFont,"TTF_CloseFont");
353         lib.bindSymbol(cast(void**)&TTF_Quit,"TTF_Quit");
354         lib.bindSymbol(cast(void**)&TTF_WasInit,"TTF_WasInit");
355         lib.bindSymbol(cast(void**)&TTF_GetFontKerningSize,"TTF_GetFontKerningSize");
356 
357         if(errorCount() != errCount) return SDLTTFSupport.badLibrary;
358         else loadedVersion = SDLTTFSupport.sdlTTF2012;
359 
360         static if(sdlTTFSupport >= SDLTTFSupport.sdlTTF2014) {
361             lib.bindSymbol(cast(void**)&TTF_GetFontKerningSizeGlyphs,"TTF_GetFontKerningSizeGlyphs");
362 
363             if(errorCount() != errCount) return SDLTTFSupport.badLibrary;
364             else loadedVersion = SDLTTFSupport.sdlTTF2014;
365         }
366 
367         return loadedVersion;
368     }
369 }