1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 15:55:07 +00:00
serenity/Userland/Libraries/LibGfx/Emoji.h
Linus Groh e1eb882b1c 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!
2022-02-23 21:53:30 +00:00

24 lines
522 B
C++

/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <AK/Types.h>
namespace Gfx {
class Bitmap;
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&);
};
}