1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 19:05:07 +00:00

LibDraw: Store emojis in a HashMap<u32, RefPtr<GraphicsBitmap>>

Get rid of the dedicated Emoji class to make it easier to store a null
value signifying a failed lookup.

This allows us to remember failed lookups, making subsequent failures
for the same codepoint much faster. :^)
This commit is contained in:
Andreas Kling 2019-10-19 18:36:45 +02:00
parent b3a63e1d50
commit 0d8aaaaa44
5 changed files with 19 additions and 29 deletions

View file

@ -181,10 +181,10 @@ int Font::glyph_or_emoji_width(u32 codepoint) const
if (m_fixed_width)
return m_glyph_width;
auto emoji = Emoji::emoji_for_codepoint(codepoint);
auto* emoji = Emoji::emoji_for_codepoint(codepoint);
if (emoji == nullptr)
return glyph_width('?');
return emoji->bitmap().size().width();
return emoji->size().width();
}
int Font::width(const StringView& string) const