You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-21 14:57:09 +00:00
[TextServer] Fix some emoji sequences and add missing ICU emoji property data.
This commit is contained in:
@@ -32,17 +32,21 @@
|
||||
|
||||
// This implementation is derived from ICU: icu4c/source/extra/scrptrun/scrptrun.cpp
|
||||
|
||||
inline constexpr UChar32 ZERO_WIDTH_JOINER = 0x200d;
|
||||
inline constexpr UChar32 VARIATION_SELECTOR_15 = 0xfe0e;
|
||||
inline constexpr UChar32 VARIATION_SELECTOR_16 = 0xfe0f;
|
||||
|
||||
inline bool ScriptIterator::same_script(int32_t p_script_one, int32_t p_script_two) {
|
||||
return p_script_one <= USCRIPT_INHERITED || p_script_two <= USCRIPT_INHERITED || p_script_one == p_script_two;
|
||||
}
|
||||
|
||||
inline bool ScriptIterator::is_emoji(UChar32 p_c, UChar32 p_next) {
|
||||
if (p_next == 0xFE0E) { // Variation Selector-15
|
||||
if (p_next == VARIATION_SELECTOR_15 && (u_hasBinaryProperty(p_c, UCHAR_EMOJI) || u_hasBinaryProperty(p_c, UCHAR_EXTENDED_PICTOGRAPHIC))) {
|
||||
return false;
|
||||
} else if (p_next == 0xFE0F) { // Variation Selector-16
|
||||
} else if (p_next == VARIATION_SELECTOR_16 && (u_hasBinaryProperty(p_c, UCHAR_EMOJI) || u_hasBinaryProperty(p_c, UCHAR_EXTENDED_PICTOGRAPHIC))) {
|
||||
return true;
|
||||
} else {
|
||||
return u_hasBinaryProperty(p_c, UCHAR_EMOJI) || u_hasBinaryProperty(p_c, UCHAR_EMOJI_PRESENTATION) || u_hasBinaryProperty(p_c, UCHAR_EMOJI_MODIFIER) || u_hasBinaryProperty(p_c, UCHAR_REGIONAL_INDICATOR) || u_hasBinaryProperty(p_c, UCHAR_EXTENDED_PICTOGRAPHIC);
|
||||
return u_hasBinaryProperty(p_c, UCHAR_EMOJI_PRESENTATION) || u_hasBinaryProperty(p_c, UCHAR_EMOJI_MODIFIER) || u_hasBinaryProperty(p_c, UCHAR_REGIONAL_INDICATOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +123,7 @@ ScriptIterator::ScriptIterator(const String &p_string, int p_start, int p_length
|
||||
}
|
||||
|
||||
if (script_code == USCRIPT_SYMBOLS_EMOJI && script_code != sc) {
|
||||
UCharCategory cat = (UCharCategory)u_charType(ch);
|
||||
if ((cat >= U_SPACE_SEPARATOR && cat <= U_CONTROL_CHAR) || (cat >= U_DASH_PUNCTUATION && cat <= U_OTHER_PUNCTUATION) || (cat >= U_INITIAL_PUNCTUATION && cat <= U_FINAL_PUNCTUATION)) {
|
||||
if (ch == VARIATION_SELECTOR_15 || n == VARIATION_SELECTOR_15 || !(is_emoji(ch, n) || ch == ZERO_WIDTH_JOINER || ch == VARIATION_SELECTOR_16 || u_hasBinaryProperty(ch, UCHAR_EXTENDED_PICTOGRAPHIC))) {
|
||||
break;
|
||||
}
|
||||
} else if (same_script(script_code, sc)) {
|
||||
|
||||
2
thirdparty/icu4c/godot_data.json
vendored
2
thirdparty/icu4c/godot_data.json
vendored
@@ -7,5 +7,7 @@
|
||||
misc: include
|
||||
normalization: include
|
||||
confusables: include
|
||||
uemoji: include
|
||||
uprops: include
|
||||
}
|
||||
}
|
||||
|
||||
BIN
thirdparty/icu4c/icudt_godot.dat
vendored
BIN
thirdparty/icu4c/icudt_godot.dat
vendored
Binary file not shown.
Reference in New Issue
Block a user