summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-04-18 21:18:58 +0300
committerAndreas Kling <kling@serenityos.org>2021-04-18 22:10:25 +0200
commit397269d21e363c59f0b661d749e515838fc1846d (patch)
tree3456d3862ac46b42c63980d37ce1c0312e432eaa /Userland/Libraries/LibGfx
parent18ae37439a4fdd65d98b94c75c5d64480a827289 (diff)
downloadserenity-397269d21e363c59f0b661d749e515838fc1846d.zip
LibGfx: Report font glyph presence based on glyph's specific width
This uses the per glyph width to determine if the glyph is actually present in the font, and not just inside the range the font can covers This means that characters that are in the font's range but that are missing a glyph will show up as the missing character glyph instead of being invisible.
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/BitmapFont.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h
index 67f7354e9c..38a078a8e8 100644
--- a/Userland/Libraries/LibGfx/BitmapFont.h
+++ b/Userland/Libraries/LibGfx/BitmapFont.h
@@ -63,7 +63,7 @@ public:
void set_weight(u16 weight) { m_weight = weight; }
Glyph glyph(u32 code_point) const;
- bool contains_glyph(u32 code_point) const { return code_point < (u32)glyph_count(); }
+ bool contains_glyph(u32 code_point) const { return code_point < (u32)glyph_count() && m_glyph_widths[code_point] > 0; }
u8 glyph_width(size_t ch) const { return m_fixed_width ? m_glyph_width : m_glyph_widths[ch]; }
int glyph_or_emoji_width(u32 code_point) const;