LibGUI/EmojiInputDialog: Skip multi code point emojis for now

These will require some tweaking here and elsewhere in LibGUI, to handle
both rendering of the emojis as single glyphs consistently, and faking
key events with multiple code points after selecting one.
This commit is contained in:
Linus Groh 2022-02-22 23:34:17 +00:00
parent 8b790c4ff8
commit 2c1252b92e
Notes: sideshowbarker 2024-07-17 18:20:41 +09:00

View File

@ -30,6 +30,9 @@ static Vector<u32> supported_emoji_code_points()
auto basename = lexical_path.basename();
if (!basename.starts_with("U+"))
continue;
// FIXME: Handle multi code point emojis.
if (basename.contains('_'))
continue;
u32 code_point = strtoul(basename.to_string().characters() + 2, nullptr, 16);
code_points.append(code_point);
}
@ -68,6 +71,12 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
horizontal_layout.set_spacing(0);
for (size_t column = 0; column < columns; ++column) {
if (index < code_points.size()) {
// FIXME: Also emit U+FE0F for single code point emojis, currently
// they get shown as text glyphs if available.
// This will require buttons to don't calculate their length as 2,
// currently it just shows an ellipsis. It will also require some
// tweaking of the mechanism that is currently being used to insert
// which is a key event with a single code point.
StringBuilder builder;
builder.append(Utf32View(&code_points[index++], 1));
auto emoji_text = builder.to_string();