@@ -5877,7 +5877,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
58775877 } else if (subtag[1 ] == " bottom" || subtag[1 ] == " b" ) {
58785878 alignment |= INLINE_ALIGNMENT_TO_BOTTOM;
58795879 }
5880- } else if (subtag.size () > 0 ) {
5880+ } else if (! subtag.is_empty () ) {
58815881 if (subtag[0 ] == " top" || subtag[0 ] == " t" ) {
58825882 alignment = INLINE_ALIGNMENT_TOP;
58835883 } else if (subtag[0 ] == " center" || subtag[0 ] == " c" ) {
@@ -5958,7 +5958,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
59585958 } else if (subtag[1 ] == " bottom" || subtag[1 ] == " b" ) {
59595959 alignment |= INLINE_ALIGNMENT_TO_BOTTOM;
59605960 }
5961- } else if (subtag.size () > 0 ) {
5961+ } else if (! subtag.is_empty () ) {
59625962 if (subtag[0 ] == " top" || subtag[0 ] == " t" ) {
59635963 alignment = INLINE_ALIGNMENT_TOP;
59645964 } else if (subtag[0 ] == " center" || subtag[0 ] == " c" ) {
@@ -6026,18 +6026,18 @@ void RichTextLabel::append_text(const String &p_bbcode) {
60266026 Vector<String> subtag = fnt_ftr.split (" ," );
60276027 _normalize_subtags (subtag);
60286028
6029- if (subtag.size () > 0 ) {
6030- Ref<Font> font = theme_cache.normal_font ;
6031- DefaultFont def_font = RTL_NORMAL_FONT;
6029+ Ref<Font> font = theme_cache.normal_font ;
6030+ DefaultFont def_font = RTL_NORMAL_FONT;
60326031
6033- ItemFont *font_it = _find_font (current);
6034- if (font_it) {
6035- if (font_it->font .is_valid ()) {
6036- font = font_it->font ;
6037- def_font = font_it->def_font ;
6038- }
6032+ ItemFont *font_it = _find_font (current);
6033+ if (font_it) {
6034+ if (font_it->font .is_valid ()) {
6035+ font = font_it->font ;
6036+ def_font = font_it->def_font ;
60396037 }
6040- Dictionary features;
6038+ }
6039+ Dictionary features;
6040+ if (!subtag.is_empty ()) {
60416041 for (int i = 0 ; i < subtag.size (); i++) {
60426042 Vector<String> subtag_a = subtag[i].split (" =" );
60436043 _normalize_subtags (subtag_a);
@@ -6048,19 +6048,19 @@ void RichTextLabel::append_text(const String &p_bbcode) {
60486048 features[TS->name_to_tag (subtag_a[0 ])] = 1 ;
60496049 }
60506050 }
6051+ }
6052+ Ref<FontVariation> fc;
6053+ fc.instantiate ();
60516054
6052- Ref<FontVariation> fc;
6053- fc.instantiate ();
6054-
6055- fc->set_base_font (font);
6056- fc->set_opentype_features (features);
6055+ fc->set_base_font (font);
6056+ fc->set_opentype_features (features);
60576057
6058- if (def_font != RTL_CUSTOM_FONT) {
6059- _push_def_font_var (def_font, fc);
6060- } else {
6061- push_font (fc);
6062- }
6058+ if (def_font != RTL_CUSTOM_FONT) {
6059+ _push_def_font_var (def_font, fc);
6060+ } else {
6061+ push_font (fc);
60636062 }
6063+
60646064 pos = brk_end + 1 ;
60656065 tag_stack.push_front (tag.substr (0 , value_pos));
60666066
@@ -6070,6 +6070,8 @@ void RichTextLabel::append_text(const String &p_bbcode) {
60706070 Ref<Font> fc = ResourceLoader::load (fnt, " Font" );
60716071 if (fc.is_valid ()) {
60726072 push_font (fc);
6073+ } else {
6074+ push_font (theme_cache.normal_font );
60736075 }
60746076
60756077 pos = brk_end + 1 ;
@@ -6220,9 +6222,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
62206222
62216223 } else if (tag.begins_with (" outline_size=" )) {
62226224 int fnt_size = _get_tag_value (tag).to_int ();
6223- if (fnt_size > 0 ) {
6224- push_outline_size (fnt_size);
6225- }
6225+ push_outline_size (MAX (0 , fnt_size));
62266226 pos = brk_end + 1 ;
62276227 tag_stack.push_front (" outline_size" );
62286228
0 commit comments