| 203 | } |
| 204 | |
| 205 | void FontDebug(HFont hfont, float scale, float padding, const char* text) |
| 206 | { |
| 207 | int indent = 0; |
| 208 | |
| 209 | FontType type = FontGetType(hfont); |
| 210 | printf("DebugFont: '%s' type: %d\n", FontGetPath(hfont), type); |
| 211 | |
| 212 | Indent(indent+1); printf("ascent: %.3f\n", FontGetAscent(hfont, scale)); |
| 213 | Indent(indent+1); printf("descent: %.3f\n", FontGetDescent(hfont, scale)); |
| 214 | Indent(indent+1); printf("line gap: %.3f\n", FontGetLineGap(hfont, scale)); |
| 215 | printf("\n"); |
| 216 | |
| 217 | FontGlyphOptions options; |
| 218 | options.m_Scale = scale; |
| 219 | options.m_GenerateImage = true; |
| 220 | |
| 221 | options.m_StbttSDFPadding = padding; |
| 222 | const char* cursor = text; |
| 223 | uint32_t codepoint = 0; |
| 224 | while ((codepoint = dmUtf8::NextChar(&cursor))) |
| 225 | { |
| 226 | FontGlyph glyph; |
| 227 | FontGetGlyph(hfont, codepoint, &options, &glyph); |
| 228 | FontDebugGlyph(&glyph, indent+2); |
| 229 | |
| 230 | if (options.m_GenerateImage && (type == FONT_TYPE_STBTTF || type == FONT_TYPE_STBOTF)) |
| 231 | { |
| 232 | if(glyph.m_Bitmap.m_Data) |
| 233 | { |
| 234 | Indent((indent+3)); printf("Bitmap: %u x %u x %u flags: %u\n", |
| 235 | glyph.m_Bitmap.m_Width, glyph.m_Bitmap.m_Height, glyph.m_Bitmap.m_Channels, glyph.m_Bitmap.m_Flags); |
| 236 | FontDebugPrintBitmap(glyph.m_Bitmap.m_Data, glyph.m_Bitmap.m_Width, glyph.m_Bitmap.m_Height); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | FontFreeGlyph(hfont, &glyph); |
| 241 | } |
| 242 | } |
nothing calls this directly
no test coverage detected