|
@@ -1848,9 +1848,17 @@ void RichTextLabel::push_font(const Ref<Font> &p_font) {
|
|
|
ItemFont *item = memnew(ItemFont);
|
|
|
|
|
|
item->font = p_font;
|
|
|
+ item->owner = get_instance_id();
|
|
|
+ item->font->connect("changed", this, "_invalidate_fonts", Vector<Variant>(), CONNECT_REFERENCE_COUNTED);
|
|
|
+
|
|
|
_add_item(item, true);
|
|
|
}
|
|
|
|
|
|
+void RichTextLabel::_invalidate_fonts() {
|
|
|
+ main->first_invalid_line = 0; //invalidate ALL
|
|
|
+ update();
|
|
|
+}
|
|
|
+
|
|
|
void RichTextLabel::push_normal() {
|
|
|
Ref<Font> normal_font = get_font("normal_font");
|
|
|
ERR_FAIL_COND(normal_font.is_null());
|
|
@@ -2927,6 +2935,8 @@ void RichTextLabel::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("get_effects"), &RichTextLabel::get_effects);
|
|
|
ClassDB::bind_method(D_METHOD("install_effect", "effect"), &RichTextLabel::install_effect);
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("_invalidate_fonts"), &RichTextLabel::_invalidate_fonts);
|
|
|
+
|
|
|
ADD_GROUP("BBCode", "bbcode_");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bbcode_text", PROPERTY_HINT_MULTILINE_TEXT), "set_bbcode", "get_bbcode");
|