| 138 | } |
| 139 | |
| 140 | void |
| 141 | free_font(struct BitmapFont *font) |
| 142 | { |
| 143 | unsigned i, j; |
| 144 | |
| 145 | if (font == NULL) return; |
| 146 | |
| 147 | if (font->glyphs != NULL) { |
| 148 | for (i = 0; i < font->num_glyphs; ++i) |
| 149 | free(font->glyphs[i]); |
| 150 | free(font->glyphs); |
| 151 | } |
| 152 | |
| 153 | for (i = 0; i < SIZE(font->unicode); ++i) { |
| 154 | if (font->unicode[i] == NULL) continue; |
| 155 | for (j = 0; j < 256; ++j) |
| 156 | free(font->unicode[i][j]); |
| 157 | free(font->unicode[i]); |
| 158 | } |
| 159 | |
| 160 | free(font); |
| 161 | } |
| 162 | |
| 163 | const unsigned char * |
| 164 | get_font_glyph(struct BitmapFont *font, uint32 ch, boolean unicode) |