fix font loading, and support for relative URLs in fonts

This commit is contained in:
Face
2025-09-09 18:00:31 +03:00
parent 55db8438bb
commit bb0f4f102a
3 changed files with 10 additions and 5 deletions

View File

@@ -407,7 +407,7 @@ static func apply_margin_styles_to_container(margin_container: MarginContainer,
if margin_val != null:
margin_container.add_theme_constant_override(theme_key, margin_val)
static func apply_styles_to_label(label: Control, styles: Dictionary, element: HTMLParser.HTMLElement, parser, text_override: String = "") -> void:
static func apply_styles_to_label(label: Control, styles: Dictionary, element: HTMLParser.HTMLElement, parser, text_override: String = "", is_refresh: bool = false) -> void:
if label is Button:
apply_font_to_button(label, styles)
return
@@ -415,6 +415,10 @@ static func apply_styles_to_label(label: Control, styles: Dictionary, element: H
if not label is RichTextLabel:
return
if not is_refresh and styles.has("font-family") and styles["font-family"] not in ["sans-serif", "serif", "monospace"]:
var main_node = Engine.get_main_loop().current_scene
main_node.register_font_dependent_element(label, styles, element, parser)
var text = text_override if text_override != "" else (element.get_preserved_text() if element.tag_name == "pre" else element.get_bbcode_formatted_text(parser))
var font_size = 24 # default