From 632252e1d150a1ff8c34c2f8e3c09d0674207c72 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 6 Aug 2023 12:07:43 +0200 Subject: [PATCH] libui: Render font characters properly with no spacing, matching the width calculations --- libui/src/Font.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libui/src/Font.cpp b/libui/src/Font.cpp index c1291757..36cc3e0c 100644 --- a/libui/src/Font.cpp +++ b/libui/src/Font.cpp @@ -65,8 +65,6 @@ namespace ui void Font::render(wchar_t codepoint, ui::Color color, ui::Canvas& canvas) { - check(canvas.width == m_psf_header.width && canvas.height == m_psf_header.height); - const wchar_t str[] = { codepoint, 0 }; render(str, color, canvas); } @@ -98,7 +96,7 @@ namespace ui m_font_data.data() + (codepoint > 0 && codepoint < (wchar_t)m_psf_header.numglyph ? codepoint : 0) * m_psf_header.bytesperglyph; - u32 offset = (u32)i * (m_psf_header.width + 1) * BYTES_PER_PIXEL; + u32 offset = (u32)i * m_psf_header.width * BYTES_PER_PIXEL; for (int y = 0; y < height; y++) { u32 line = offset;