| 189 | } |
| 190 | |
| 191 | static void |
| 192 | add_unicode_index(struct BitmapFont *font, uint32 ch, unsigned index) |
| 193 | { |
| 194 | unsigned i, j, k; |
| 195 | |
| 196 | i = (unsigned) (ch >> 16); |
| 197 | j = (unsigned) ((ch >> 8) & 0xFF); |
| 198 | k = (unsigned) (ch & 0xFF); |
| 199 | |
| 200 | if (font->unicode[i] == NULL) { |
| 201 | /* Create the second level node */ |
| 202 | font->unicode[i] = (unsigned **) alloc(256 * sizeof(unsigned *)); |
| 203 | memset(font->unicode[i], 0, 256 * sizeof(unsigned *)); |
| 204 | } |
| 205 | if (font->unicode[i][j] == NULL) { |
| 206 | /* Create the third level node */ |
| 207 | font->unicode[i][j] = (unsigned *) alloc(256 * sizeof(unsigned)); |
| 208 | memset(font->unicode[i][j], 0, 256 * sizeof(unsigned)); |
| 209 | } |
| 210 | font->unicode[i][j][k] = index; |
| 211 | } |
| 212 | |
| 213 | static uint32 |
| 214 | read_u32(const unsigned char *buf) |