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:
parent
b3a63e1d50
commit
0d8aaaaa44
5 changed files with 19 additions and 29 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue