Mercurial > projects > mde
comparison mde/font/font.d @ 74:cee261eba249
Minor tweaks.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 07 Jul 2008 15:54:47 +0100 |
parents | 7fc0a8295c83 |
children | 65780e0e48e6 |
comparison
equal
deleted
inserted
replaced
73:08d3b6bcf891 | 74:cee261eba249 |
---|---|
54 debug (drawGlyphCache) void drawTexture() { | 54 debug (drawGlyphCache) void drawTexture() { |
55 if (fontTex !is null) | 55 if (fontTex !is null) |
56 fontTex.drawTexture; | 56 fontTex.drawTexture; |
57 } | 57 } |
58 | 58 |
59 /** Load the freetype library. */ | 59 /** Load the freetype library from the file fileName. */ |
60 private const fileName = "fonts"; | |
60 void initialize () { | 61 void initialize () { |
61 if (!confDir.exists (fileName)) | 62 if (!confDir.exists (fileName)) |
62 throw new fontException ("No font settings file (fonts.[mtt|mtb])"); | 63 throw new fontException ("No font settings file (fonts.[mtt|mtb])"); |
63 | 64 |
64 if (FT_Init_FreeType (&library)) | 65 if (FT_Init_FreeType (&library)) |
103 return f; | 104 return f; |
104 }; | 105 }; |
105 reader.read; | 106 reader.read; |
106 | 107 |
107 // get fallback name | 108 // get fallback name |
108 char[]* p = "fallback" in reader.dataset.header.Arg!(char[]).Arg; | 109 char[]* p = "fallback" in reader.dataset.header.Arg!(char[]); |
109 if (p is null) | 110 if (p is null) |
110 throw new fontException ("No fallback font style specified"); | 111 throw new fontException ("No fallback font style specified"); |
111 fallbackName = *p; | 112 fallbackName = *p; |
112 } | 113 } |
113 catch (MTException e) { | 114 catch (MTException e) { |
121 fallback = *p; | 122 fallback = *p; |
122 // Load the fallback now, to ensure it's available. | 123 // Load the fallback now, to ensure it's available. |
123 // Also note that get() doesn't make sure the fallback is loaded before returning it. | 124 // Also note that get() doesn't make sure the fallback is loaded before returning it. |
124 fallback.load; | 125 fallback.load; |
125 } | 126 } |
126 private const fileName = "fonts"; | |
127 | 127 |
128 //FIXME: don't use GC for FontStyle resources | 128 //FIXME: don't use GC for FontStyle resources |
129 /** Cleanup: delete all fonts. */ | 129 /** Cleanup: delete all fonts. */ |
130 void cleanup () { | 130 void cleanup () { |
131 FT_Done_FreeType (library); | 131 FT_Done_FreeType (library); |