diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-01-17 10:54:45 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-01-17 14:23:36 +0200 |
commit | e02a097280094801659ad123e6b9ac097cc70102 (patch) | |
tree | e5291758e72cda0d31a88d88678c69fffbefd520 /scene/gui | |
parent | 5d238468eaf579695ee16d5a4c0696c8a18c5a58 (diff) |
[TextServer] Implement locale and context sensitive case conversion functions.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/label.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 861b70f17e..a3878fe7ed 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -83,6 +83,7 @@ void Label::_shape() { int width = (get_size().width - style->get_minimum_size().width); if (dirty) { + String lang = (!language.is_empty()) ? language : TranslationServer::get_singleton()->get_tool_locale(); TS->shaped_text_clear(text_rid); if (text_direction == Control::TEXT_DIRECTION_INHERITED) { TS->shaped_text_set_direction(text_rid, is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR); @@ -92,11 +93,11 @@ void Label::_shape() { const Ref<Font> &font = get_theme_font(SNAME("font")); int font_size = get_theme_font_size(SNAME("font_size")); ERR_FAIL_COND(font.is_null()); - String text = (uppercase) ? xl_text.to_upper() : xl_text; + String text = (uppercase) ? TS->string_to_upper(xl_text, lang) : xl_text; if (visible_chars >= 0 && visible_chars_behavior == VC_CHARS_BEFORE_SHAPING) { text = text.substr(0, visible_chars); } - TS->shaped_text_add_string(text_rid, text, font->get_rids(), font_size, opentype_features, (!language.is_empty()) ? language : TranslationServer::get_singleton()->get_tool_locale()); + TS->shaped_text_add_string(text_rid, text, font->get_rids(), font_size, opentype_features, lang); TS->shaped_text_set_bidi_override(text_rid, structured_text_parser(st_parser, st_args, text)); dirty = false; lines_dirty = true; |