1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:58:14 +00:00

LibGfx: draw_glyph_or_emoji fix check for available glyph

This would cause question marks to be rendered when a ttf with fewer
glyphs than the value of the code_point was used.
This commit is contained in:
Stephan Unverwerth 2021-01-03 19:24:59 +01:00 committed by Andreas Kling
parent 6948f9ca55
commit 3b67b55c84
4 changed files with 5 additions and 3 deletions

View file

@ -58,6 +58,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(); }
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;