fnl: Fix reported width of tab character

The reported size of the tab character seems to be roughly 2.88x the
size of the glyph in the font.

This fixes a text layout issue with the commander info (HP, Job, etc).
This commit is contained in:
Nunuhara Cabbage
2022-05-02 07:54:43 -07:00
parent 6e05874ee1
commit ae56a0f4b4
+4 -1
View File
@@ -312,7 +312,10 @@ static float _fnl_size_char(struct fnl_render_size *size, uint16_t code)
return 0.0;
if (!size->bitmap->face->glyphs[index].data_pos)
return 0.0;
return (float)size->bitmap->face->glyphs[index].real_width / (float)size->denominator;
float r = (float)size->bitmap->face->glyphs[index].real_width / (float)size->denominator;
if (code == '\t')
r *= 2.88;
return r;
}
float fnl_size_char(struct text_style *ts, uint16_t code)