diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-09-06 08:50:08 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-09-06 08:50:08 +0300 |
commit | 1cb63fc719e770c75f0c97747dbcae966eee7b00 (patch) | |
tree | 95ea33c869c9aadece300c760d51b52895fe7dd9 /modules/text_server_adv | |
parent | 332bc469c46e1372cdf3222bd3d31c382afc2784 (diff) | |
download | redot-engine-1cb63fc719e770c75f0c97747dbcae966eee7b00.tar.gz |
[TextServer] Use locale or first span language to select preferred direction for neutral text.
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 85e98eac76..3850fc4518 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -5880,8 +5880,11 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) { sd->para_direction = (direction == UBIDI_RTL) ? DIRECTION_RTL : DIRECTION_LTR; sd->base_para_direction = direction; } else { - sd->para_direction = DIRECTION_LTR; - sd->base_para_direction = UBIDI_DEFAULT_LTR; + const String &lang = (sd->spans.is_empty() || sd->spans[0].language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : sd->spans[0].language; + bool lang_rtl = _is_locale_right_to_left(lang); + + sd->para_direction = lang_rtl ? DIRECTION_RTL : DIRECTION_LTR; + sd->base_para_direction = lang_rtl ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR; } } break; } |