MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / CFEGetGlyphFromGlyphID

Function CFEGetGlyphFromGlyphID

modules/commodetto/cfeNFNT.c:113–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113CFEGlyph CFEGetGlyphFromGlyphID(CommodettoFontEngine tf, uint16_t glyphID, uint8_t needPixels)
114{
115 CFEGlyph glyph = &tf->glyph;
116
117 if ((glyphID < tf->firstChar) || (glyphID > tf->lastChar))
118 return NULL;
119
120 glyphID -= tf->firstChar;
121
122 glyph->dx = c_read8(tf->widthOffsetTable + (glyphID << 1) + 0);
123 if (glyph->dx & 0x80)
124 glyph->dx = -128 + (glyph->dx & 0x7f);
125
126 glyph->advance = c_read8(tf->widthOffsetTable + (glyphID << 1) + 1);
127 if (glyph->advance & 0x80)
128 glyph->advance = -128 + (glyph->advance & 0x7f);
129
130 glyph->sx = c_read16be(tf->bitmapLocationTable + glyphID);
131 glyph->w = c_read16be(tf->bitmapLocationTable + glyphID + 1) - glyph->sx;
132 glyph->h = tf->height;
133 glyph->substitute = C_NULL;
134
135 return glyph;
136}
137
138CFEGlyph CFEGetGlyphFromUnicode(CommodettoFontEngine tf, uint32_t unicode, uint8_t needPixels)
139{

Callers 2

CFEGetGlyphFromUnicodeFunction · 0.70
CFELayoutRunFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected