From ae56a0f4b4bbdd0b91f1a20c68f0fb265ae9e835 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Mon, 2 May 2022 07:52:45 -0700 Subject: [PATCH] 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). --- src/fnl_render.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fnl_render.c b/src/fnl_render.c index af56ed9..a3d1277 100644 --- a/src/fnl_render.c +++ b/src/fnl_render.c @@ -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)