summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-04-22 14:25:28 -0400
committerAndreas Kling <kling@serenityos.org>2021-04-23 11:08:11 +0200
commitcc7744f6cabec3d76008d71677c62ff7c4acf7c1 (patch)
tree17f5a15e4bb58987f971ba821513ece0ff2758f6 /Userland/Libraries/LibGfx
parent0664fbd58462cafd1277290814ca34652154cd74 (diff)
downloadserenity-cc7744f6cabec3d76008d71677c62ff7c4acf7c1.zip
LibGfx+FontEditor: Account for raw width when painting glyphs
Fixes hidden glyphs being painted in editor and map, and '?' subsitute glyphs being overdrawn in the system.
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/BitmapFont.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp
index 3c50a0c17f..eeac6e9055 100644
--- a/Userland/Libraries/LibGfx/BitmapFont.cpp
+++ b/Userland/Libraries/LibGfx/BitmapFont.cpp
@@ -241,8 +241,12 @@ Glyph BitmapFont::glyph(u32 code_point) const
int BitmapFont::glyph_or_emoji_width(u32 code_point) const
{
- if (code_point < m_glyph_count)
- return glyph_width(code_point);
+ if (code_point < m_glyph_count) {
+ if (m_glyph_widths[code_point] > 0)
+ return glyph_width(code_point);
+ else
+ return glyph_width('?');
+ }
if (m_fixed_width)
return m_glyph_width;