diff --git a/src/font_renderer.cpp b/src/font_renderer.cpp index 32b4a916..58c50013 100644 --- a/src/font_renderer.cpp +++ b/src/font_renderer.cpp @@ -68,7 +68,7 @@ int FontRendererBakeFontBitmap(FontRenderer *fr_, int font_height, glyph_info.x1 = x_next_i; glyph_info.y1 = pixels_height - (y_baseline + descender_px - pad_y); glyph_info.xoff = 0; - glyph_info.yoff = -ascender * font_height; + glyph_info.yoff = -pad_y; glyph_info.xadvance = x_next - x; #if 0 fprintf(stderr, diff --git a/src/renderer.c b/src/renderer.c index 4b6fe01d..7fe9fc00 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -129,14 +129,8 @@ retry: goto retry; } - // TODO: consider if this is still needed. - /* adjust glyph yoffsets and xadvance */ - int ascent, descent, linegap; - stbtt_GetFontVMetrics(&font->stbfont, &ascent, &descent, &linegap); - float scale = stbtt_ScaleForMappingEmToPixels(&font->stbfont, font->size); - int scaled_ascent = ascent * scale + 0.5; + /* adjust glyph's xadvance */ for (int i = 0; i < 256; i++) { - set->glyphs[i].yoff += scaled_ascent; set->glyphs[i].xadvance = floor(set->glyphs[i].xadvance); }