1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +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

@ -929,9 +929,8 @@ void Painter::draw_emoji(const IntPoint& point, const Gfx::Bitmap& emoji, const
void Painter::draw_glyph_or_emoji(const IntPoint& point, u32 code_point, const Font& font, Color color)
{
if (code_point < (u32)font.glyph_count()) {
// This looks like a regular character.
draw_glyph(point, (size_t)code_point, font, color);
if (font.contains_glyph(code_point)) {
draw_glyph(point, code_point, font, color);
return;
}