[3.x, RTL] Track external changes in the custom fonts set by BBCode / push_font.

This commit is contained in:
Pāvels Nadtočajevs
2025-04-11 09:31:04 +03:00
parent 9fccb6b2d7
commit 3c8e71b429
2 changed files with 22 additions and 0 deletions

View File

@ -164,7 +164,17 @@ private:
struct ItemFont : public Item {
Ref<Font> font;
ObjectID owner;
ItemFont() { type = ITEM_FONT; }
~ItemFont() {
if (font.is_valid()) {
RichTextLabel *owner_rtl = ObjectDB::get_instance<RichTextLabel>(owner);
if (owner_rtl) {
font->disconnect("changed", owner_rtl, "_invalidate_fonts");
}
}
}
};
struct ItemColor : public Item {
@ -348,6 +358,8 @@ private:
void _add_item(Item *p_item, bool p_enter = false, bool p_ensure_newline = false);
void _remove_item(Item *p_item, const int p_line, const int p_subitem_line);
void _invalidate_fonts();
struct ProcessState {
int line_width;
};