Add more debug information in font's bitmap images
This commit is contained in:
parent
b978873a58
commit
e82d766c2b
|
@ -208,6 +208,9 @@ int FontRendererBakeFontBitmap(FontRenderer *font_renderer, int font_height,
|
|||
glyph_info.yoff = -pad_y;
|
||||
glyph_info.xadvance = (x_next - x) / subpixel_scale;
|
||||
|
||||
#ifdef FONT_RENDERER_DEBUG
|
||||
glyph_info.ybaseline = pixels_height - 1 - y_baseline;
|
||||
#endif
|
||||
if (glyph_info.x1 > glyph_info.x0) {
|
||||
glyph_lut_convolution(ren_buf, lcd_lut, cover_swap_buffer, glyph_info);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ extern "C" {
|
|||
typedef struct {
|
||||
unsigned short x0, y0, x1, y1;
|
||||
float xoff, yoff, xadvance;
|
||||
#ifdef FONT_RENDERER_DEBUG
|
||||
int ybaseline;
|
||||
#endif
|
||||
} GlyphBitmapInfo;
|
||||
|
||||
struct FontRendererImpl;
|
||||
|
|
|
@ -152,6 +152,22 @@ void debug_bitmap_draw_rect(RenImage *image, GlyphBitmapInfo *glyph) {
|
|||
c[y * w].g = c[y * w].g >> 1;
|
||||
c[y * w].b = c[y * w].b >> 1;
|
||||
}
|
||||
c = image->pixels + glyph->ybaseline * w;
|
||||
for (int x = x0 * subpixel; x < x1 * subpixel; x++) {
|
||||
c[x].g = c[x].g >> 1;
|
||||
c[x].r = c[x].r >> 1;
|
||||
}
|
||||
const int x_or = x0 - glyph->xoff, y_or = y0 - glyph->yoff;
|
||||
c = image->pixels + y_or * w;
|
||||
for (int x = x_or * subpixel; x < x1 * subpixel; x++) {
|
||||
c[x].b = c[x].b >> 1;
|
||||
c[x].r = c[x].r >> 1;
|
||||
}
|
||||
c = image->pixels + x_or * subpixel;
|
||||
for (int y = y_or; y < y1; y++) {
|
||||
c[y * w].b = c[y * w].b >> 1;
|
||||
c[y * w].r = c[y * w].r >> 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue