1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:27:45 +00:00

LibGfx: Add Emoji::emoji_for_code_point_iterator(Utf8CodePointIterator&)

In the common case of text rendering rather than getting the emoji
bitmap for a fixed number of code points, we don't know how many code
points make one emoji. As far as I can tell, the longest ones are up to
ten code points, so we try to consume all of them and do a lookup during
each iteration, and return the emoji for the longest chain of code
points. Quite basic and definitely room for improvement, but it works!
This commit is contained in:
Linus Groh 2022-02-22 21:45:56 +00:00
parent 514f3e9c74
commit e1eb882b1c
2 changed files with 46 additions and 0 deletions

View file

@ -18,6 +18,7 @@ class Emoji {
public:
static Gfx::Bitmap const* emoji_for_code_point(u32 code_point);
static Gfx::Bitmap const* emoji_for_code_points(Span<u32> const&);
static Gfx::Bitmap const* emoji_for_code_point_iterator(Utf8CodePointIterator&);
};
}