mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 00:54:18 +08:00
add internal api: _unicode_normalize_script
This commit is contained in:
@@ -289,5 +289,30 @@ int GUIAPI UCharScriptTypeFromISO15924 (Uint32 iso15924)
|
||||
return UCHAR_SCRIPT_UNKNOWN;
|
||||
}
|
||||
|
||||
/*
|
||||
* https://www.w3.org/TR/css-text-3/#script-tagging
|
||||
*/
|
||||
UCharScriptType _unicode_normalize_script(LanguageCode cl,
|
||||
UCharScriptType ws)
|
||||
{
|
||||
if (cl == LANGCODE_zh && ws == UCHAR_SCRIPT_INVALID_CODE) {
|
||||
return UCHAR_SCRIPT_HAN;
|
||||
}
|
||||
else if (ws == UCHAR_SCRIPT_BOPOMOFO) {
|
||||
return UCHAR_SCRIPT_HAN;
|
||||
}
|
||||
else if (cl == LANGCODE_ja && ws == UCHAR_SCRIPT_INVALID_CODE) {
|
||||
return UCHAR_SCRIPT_KATAKANA;
|
||||
}
|
||||
else if (cl == LANGCODE_ko && ws == UCHAR_SCRIPT_INVALID_CODE) {
|
||||
return UCHAR_SCRIPT_HANGUL;
|
||||
}
|
||||
else if (cl == LANGCODE_unknown || ws == UCHAR_SCRIPT_INVALID_CODE) {
|
||||
return UCHAR_SCRIPT_INVALID_CODE;
|
||||
}
|
||||
|
||||
return ws;
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
|
||||
|
||||
@@ -58,6 +58,9 @@ BOOL _unicode_is_emoji_emoji_default(Uchar32 ch);
|
||||
BOOL _unicode_is_emoji_keycap_base(Uchar32 ch);
|
||||
BOOL _unicode_is_regional_indicator(Uchar32 ch);
|
||||
|
||||
UCharScriptType _unicode_normalize_script(LanguageCode content_language,
|
||||
UCharScriptType writing_system);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -104,6 +104,8 @@ int GUIAPI GetShapedGlyphsBasic(LOGFONT* logfont,
|
||||
return 0;
|
||||
}
|
||||
|
||||
writing_system = _unicode_normalize_script(content_language, writing_system);
|
||||
|
||||
/*
|
||||
* TODO: tailor break opportunties according to the content languages.
|
||||
*/
|
||||
@@ -170,7 +172,7 @@ int GUIAPI GetShapedGlyphsBasic(LOGFONT* logfont,
|
||||
pos_v2l[i] = i;
|
||||
}
|
||||
|
||||
if (content_language == LANGCODE_ar) {
|
||||
if (writing_system == UCHAR_SCRIPT_ARABIC) {
|
||||
/* Arabic joining */
|
||||
if (nr_ucs < LOCAL_ARRAY_SIZE)
|
||||
ar_props = local_ar_props;
|
||||
|
||||
Reference in New Issue
Block a user