| 186 | } |
| 187 | |
| 188 | CFEGlyph CFEGetGlyphFromGlyphID(CommodettoFontEngine bmf, uint16_t glyphID, uint8_t needPixels) |
| 189 | { |
| 190 | CFEGlyph glyph = &bmf->glyph; |
| 191 | const uint8_t *chars = bmf->charTable; |
| 192 | const uint8_t *cc = chars + (20 * glyphID); |
| 193 | |
| 194 | glyph->substitute = C_NULL; |
| 195 | |
| 196 | if (!needPixels) { |
| 197 | c_memset(glyph, 0, sizeof(*glyph)); |
| 198 | glyph->advance = (uint8_t)c_read16(cc + 16); |
| 199 | return glyph; |
| 200 | } |
| 201 | |
| 202 | glyph->sx = c_read16(cc + 4); |
| 203 | glyph->sy = c_read16(cc + 6); |
| 204 | glyph->w = c_read16(cc + 8); |
| 205 | glyph->h = c_read16(cc + 10); |
| 206 | glyph->dx = (int16_t)c_read16(cc + 12); |
| 207 | glyph->dy = (int16_t)c_read16(cc + 14); |
| 208 | glyph->advance = c_read16(cc + 16); |
| 209 | |
| 210 | if (bmf->isCompressed) { |
| 211 | glyph->format = kCommodettoBitmapGray16 | kCommodettoBitmapPacked; |
| 212 | glyph->bits = (glyph->sx | (glyph->sy << 16)) + (char *)cc; |
| 213 | glyph->sx = 0; |
| 214 | glyph->sy = 0; |
| 215 | } |
| 216 | else { |
| 217 | glyph->format = 0; // invalid |
| 218 | glyph->bits = NULL; |
| 219 | } |
| 220 | |
| 221 | return glyph; |
| 222 | } |
| 223 | |
| 224 | CFEGlyph CFEGetGlyphFromUnicode(CommodettoFontEngine bmf, uint32_t unicode, uint8_t needPixels) |
| 225 | { |
no outgoing calls
no test coverage detected