From f1824a524d7a8d19ab2f96ba5a30a6d267be864c Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 9 Nov 2023 07:50:54 +0100 Subject: [PATCH] LibAccelGfx: Add 1px padding between glyphs in prepare_glyph_texture() This fixes bug when tiny slice of another glyph appearing along with the required glyph. --- Userland/Libraries/LibAccelGfx/Painter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibAccelGfx/Painter.cpp b/Userland/Libraries/LibAccelGfx/Painter.cpp index af98d9f090..7e344c5d35 100644 --- a/Userland/Libraries/LibAccelGfx/Painter.cpp +++ b/Userland/Libraries/LibAccelGfx/Painter.cpp @@ -256,15 +256,16 @@ void Painter::prepare_glyph_texture(HashMap> co int current_y = 0; int row_height = 0; int texture_width = 512; + int padding = 1; for (auto const& glyphs_texture_key : glyphs_sorted_by_height) { auto const& bitmap = *glyph_bitmaps.get(glyphs_texture_key); if (current_x + bitmap->width() > texture_width) { current_x = 0; - current_y += row_height; + current_y += row_height + padding; row_height = 0; } m_glyphs_texture_map.set(glyphs_texture_key, { current_x, current_y, bitmap->width(), bitmap->height() }); - current_x += bitmap->width(); + current_x += bitmap->width() + padding; row_height = max(row_height, bitmap->height()); }