diff --git a/material_maker/globals.gd b/material_maker/globals.gd index be003b1229..cdbd2767aa 100644 --- a/material_maker/globals.gd +++ b/material_maker/globals.gd @@ -71,6 +71,10 @@ const DEFAULT_CONFIG : Dictionary = { ui_3d_preview_generated_mesh = true, nearest_filter_reference = false, sub_node_items = [], + ui_use_system_font = false, + ui_font_size = 16, + ui_code_font_size = 12, + ui_font_enable_msdf = true, } @@ -246,3 +250,6 @@ func ui_scale_factor() -> float: func is_custom_theme() -> bool: return config.get_value("window", "theme") == "custom" + +func is_classic_theme() -> bool: + return "classic" in mm_globals.main_window.theme.resource_path diff --git a/material_maker/main_window.gd b/material_maker/main_window.gd index 406d12a4f3..08f24aac19 100644 --- a/material_maker/main_window.gd +++ b/material_maker/main_window.gd @@ -165,6 +165,11 @@ func _ready() -> void: if mm_globals.config.has_section_key("window", "size"): get_window().size = mm_globals.config.get_value("window", "size") + # Update fonts + FontUtils.rebuild_fonts() + theme.default_font = FontUtils.main_font + theme.default_font_size = FontUtils.ui_font_size + # Restore the theme var theme_name: String = "default dark" if mm_globals.config.has_section_key("window", "theme"): @@ -661,6 +666,7 @@ func change_theme(theme_name : String) -> void: theme = _theme ThemeUtils.setup_clear_color() $NodeFactory.on_theme_changed() + FontUtils.setup_theme_fonts(theme, theme_name) func _on_SetTheme_id_pressed(id : int) -> void: var theme_name : String = ThemeUtils.THEMES[id].to_lower() diff --git a/material_maker/nodes/base.gd b/material_maker/nodes/base.gd index ec8a871170..54380dddb9 100644 --- a/material_maker/nodes/base.gd +++ b/material_maker/nodes/base.gd @@ -240,7 +240,7 @@ func _draw() -> void: draw_style_box(get_theme_stylebox("node_highlight"), Rect2(Vector2.ZERO, size)) if generator.rendering_time > 0: var time_color : Color = get_rendering_time_color(generator.rendering_time) - var buffer_timing_font : Font = preload("res://material_maker/theme/font_rubik/Rubik-416.ttf") + var buffer_timing_font : FontVariation = FontUtils.medium_font @warning_ignore_start("narrowing_conversion") draw_string_outline(buffer_timing_font, Vector2i(0, size.y+12), str(generator.rendering_time)+"ms", HORIZONTAL_ALIGNMENT_CENTER, size.x, 12, 4, Color.BLACK) draw_string(buffer_timing_font, Vector2i(0, size.y+12), str(generator.rendering_time)+"ms", HORIZONTAL_ALIGNMENT_CENTER, size.x, 12, time_color) diff --git a/material_maker/nodes/generic/generic.gd b/material_maker/nodes/generic/generic.gd index f5d06343eb..38324264a4 100644 --- a/material_maker/nodes/generic/generic.gd +++ b/material_maker/nodes/generic/generic.gd @@ -433,7 +433,7 @@ func do_update_preview() -> void: func update_title() -> void: title = TranslationServer.translate(generator.get_type_name()) if generator == null or generator.minimized: - var font : Font = get_theme_font("default_font") + var font : Font = FontUtils.medium_font var max_title_width = 28 if font.get_string_size(title).x > max_title_width: for i in range(1, title.length()-1): @@ -455,6 +455,8 @@ func update_node() -> void: if mm_globals.get_config(SETTINGS_NODE_CLOSE_BUTTON) else false) # Rebuild node update_title() + var title_label : Label = get_titlebar_hbox().get_child(0) + title_label.add_theme_font_override("font", FontUtils.medium_font) # Resize to minimum size = Vector2(0, 0) # Regex for labels diff --git a/material_maker/nodes/minimal.gd b/material_maker/nodes/minimal.gd index d26a2eca0a..c6b87dd1ea 100644 --- a/material_maker/nodes/minimal.gd +++ b/material_maker/nodes/minimal.gd @@ -19,6 +19,8 @@ func _ready() -> void: buttons = HBoxContainer.new() var space : Control = Control.new() buttons.add_theme_constant_override("separation", 1) + var title_label : Label = get_titlebar_hbox().get_child(0) + title_label.add_theme_font_override("font", FontUtils.medium_font) space.custom_minimum_size = Vector2(4, 0) buttons.add_child(space) get_titlebar_hbox().add_child(buttons) diff --git a/material_maker/nodes/portal/portal.gd b/material_maker/nodes/portal/portal.gd index 59ba9e23b6..77e9050186 100644 --- a/material_maker/nodes/portal/portal.gd +++ b/material_maker/nodes/portal/portal.gd @@ -1,7 +1,7 @@ extends MMGraphNodeMinimal class_name MMGraphPortal -const LABEL_FONT = preload("res://material_maker/theme/font_rubik/Rubik-416.ttf") +var label_font : FontVariation = FontUtils.medium_font ## Whether portal's link is being edited ## (i.e. its associated LineEdit is visible) @@ -34,7 +34,7 @@ func _draw() -> void: var label_pos : Vector2 = size * 0.5 var label_color : Color = generator.color var label_draw_pos : Vector2 = label_pos - var label_size : Vector2 = LABEL_FONT.get_string_size( + var label_size : Vector2 = label_font.get_string_size( get_link(), HORIZONTAL_ALIGNMENT_CENTER, -1, label_font_size) if not is_editing: @@ -43,8 +43,8 @@ func _draw() -> void: else: label_draw_pos -= Vector2(label_size.x * 0.5, label_y_offset) - draw_string_outline(LABEL_FONT, label_draw_pos, get_link(), HORIZONTAL_ALIGNMENT_CENTER, -1, label_font_size, 5, Color.BLACK) - draw_string(LABEL_FONT, label_draw_pos, get_link(), HORIZONTAL_ALIGNMENT_CENTER, -1, label_font_size, label_color) + draw_string_outline(label_font, label_draw_pos, get_link(), HORIZONTAL_ALIGNMENT_CENTER, -1, label_font_size, 5, Color.BLACK) + draw_string(label_font, label_draw_pos, get_link(), HORIZONTAL_ALIGNMENT_CENTER, -1, label_font_size, label_color) # label dragger %Dragger.mouse_filter = MOUSE_FILTER_IGNORE if is_editing else MOUSE_FILTER_PASS @@ -339,7 +339,7 @@ func setup_portal_edit() -> void: var old_link : String = get_link() var graph : MMGraphEdit = get_parent() var edit : LineEdit = LineEdit.new() - edit.add_theme_font_override("font", LABEL_FONT) + edit.add_theme_font_override("font", label_font) edit.alignment = HORIZONTAL_ALIGNMENT_CENTER edit.max_length = 64 edit.expand_to_text_length = true diff --git a/material_maker/panels/graph_edit/graph_zoom_menu.gd b/material_maker/panels/graph_edit/graph_zoom_menu.gd index 19fe28e595..046092c3d5 100644 --- a/material_maker/panels/graph_edit/graph_zoom_menu.gd +++ b/material_maker/panels/graph_edit/graph_zoom_menu.gd @@ -40,3 +40,7 @@ func update_zoom() -> void: if graph_edit: graph_edit.zoom = zoom_level mm_globals.set_config(SETTING_GRAPH_ZOOM_LEVEL, zoom_level) + +func _notification(what : int) -> void: + if what == NOTIFICATION_THEME_CHANGED: + %ZoomLabel.add_theme_font_override("font", FontUtils.main_font) diff --git a/material_maker/panels/library/library.gd b/material_maker/panels/library/library.gd index 3ecf3f1efa..755418dc1f 100644 --- a/material_maker/panels/library/library.gd +++ b/material_maker/panels/library/library.gd @@ -13,8 +13,6 @@ var category_buttons = {} @onready var filter_line_edit : LineEdit = %Filter @onready var item_menu : PopupMenu = %ItemMenu -var section_font = preload("res://material_maker/theme/font_rubik/Rubik-416.ttf") - const MINIMUM_ITEM_HEIGHT : int = 30 const MENU_CREATE_LIBRARY : int = 1000 @@ -153,7 +151,7 @@ func update_tree() -> void: for section : TreeItem in tree.get_root().get_children(): if section.get_children().size(): - section.set_custom_font(0, section_font) + section.set_custom_font(0, FontUtils.medium_font) tree.queue_redraw() func add_item(item, library_index : int, item_name : String, item_icon = null, item_parent = null, force_expand = false) -> TreeItem: diff --git a/material_maker/panels/preview_2d/export_menu.gd b/material_maker/panels/preview_2d/export_menu.gd index 5d4efb1f6d..68e80955a9 100644 --- a/material_maker/panels/preview_2d/export_menu.gd +++ b/material_maker/panels/preview_2d/export_menu.gd @@ -24,6 +24,8 @@ func _notification(what: int) -> void: %ExportFolderButton.icon = get_theme_icon("folder", "MM_Icons") %ExportFileResultLabel.add_theme_color_override("font_color", get_theme_color("font_color", "Label").lerp(Color.ORANGE, 0.5)) %ExportNotificationLabel.add_theme_color_override("font_color", get_theme_color("font_color", "Label").lerp(get_theme_color("icon_pressed_color", "Button"), 0.5)) + %ExportFileResultLabel.add_theme_font_override("font", + FontUtils.create_italic_variation(FontUtils.main_font)) func _open() -> void: diff --git a/material_maker/panels/preview_3d/export_menu.gd b/material_maker/panels/preview_3d/export_menu.gd index 21d1661160..4885abecd8 100644 --- a/material_maker/panels/preview_3d/export_menu.gd +++ b/material_maker/panels/preview_3d/export_menu.gd @@ -100,3 +100,10 @@ func interpret_map_file_name(file_name: String, path:="") -> String: func _on_map_file_type_item_selected(_index: int) -> void: update_generate_map_file_label() + +func _notification(what: int) -> void: + if what == NOTIFICATION_THEME_CHANGED: + if not is_node_ready(): + await ready + MapExportFileResultLabel.add_theme_font_override("font", + FontUtils.create_italic_variation(FontUtils.main_font)) diff --git a/material_maker/theme/classic.tres b/material_maker/theme/classic.tres index ee33073366..c5c391144f 100644 --- a/material_maker/theme/classic.tres +++ b/material_maker/theme/classic.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" script_class="EnhancedTheme" load_steps=4 format=3 uid="uid://wuddtc1fglln"] +[gd_resource type="Theme" script_class="EnhancedTheme" format=3 uid="uid://wuddtc1fglln"] [ext_resource type="Theme" uid="uid://w487nirev8y5" path="res://material_maker/theme/classic_base.tres" id="1_meah8"] [ext_resource type="Script" uid="uid://3ga2k3abkk0d" path="res://material_maker/theme/enhanced_theme_system/color_swap.gd" id="5_qpu3p"] diff --git a/material_maker/theme/default.tres b/material_maker/theme/default.tres index 67966383ed..2a48bb65be 100644 --- a/material_maker/theme/default.tres +++ b/material_maker/theme/default.tres @@ -1402,8 +1402,8 @@ GraphNode/styles/titlebar = SubResource("StyleBoxFlat_imqse") GraphNode/styles/titlebar_selected = SubResource("StyleBoxFlat_ru0kh") GraphNodeTitleLabel/colors/font_outline_color = Color(0.168627, 0.176471, 0.192157, 1) GraphNodeTitleLabel/colors/font_shadow_color = Color(0.168627, 0.176471, 0.192157, 1) -GraphNodeTitleLabel/constants/outline_size = 5 -GraphNodeTitleLabel/constants/shadow_outline_size = 6 +GraphNodeTitleLabel/constants/outline_size = 6 +GraphNodeTitleLabel/constants/shadow_outline_size = 7 GraphNodeTitleLabel/fonts/font = ExtResource("2_5e0gw") HScrollBar/styles/grabber = SubResource("StyleBoxFlat_fs6qc") HScrollBar/styles/grabber_highlight = SubResource("StyleBoxFlat_70aex") @@ -1669,6 +1669,8 @@ TabContainer/styles/tab_unselected = SubResource("StyleBoxFlat_e07v0") TextEdit/colors/selection_color = Color(0.5, 0.5, 0.5, 1) TextEdit/styles/focus = SubResource("StyleBoxEmpty_asgc8") TooltipLabel/font_sizes/font_size = 15 +TooltipLabel/fonts/font = ExtResource("1_5tfb1") +TooltipPanel/fonts/title_font = ExtResource("1_5tfb1") TooltipPanel/styles/panel = SubResource("StyleBoxFlat_5rnro") Tree/colors/font_color = Color(0.7, 0.7, 0.7, 1) Tree/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) diff --git a/material_maker/theme/fonts/system/system_bold_font.tres b/material_maker/theme/fonts/system/system_bold_font.tres new file mode 100644 index 0000000000..0ee6053369 --- /dev/null +++ b/material_maker/theme/fonts/system/system_bold_font.tres @@ -0,0 +1,14 @@ +[gd_resource type="FontVariation" format=3 uid="uid://ch4d2bwcn5a"] + +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="1_ub2cf"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="2_ml3ku"] + +[sub_resource type="SystemFont" id="SystemFont_ouejq"] +font_names = PackedStringArray("Sans-Serif") +font_weight = 800 +multichannel_signed_distance_field = true +msdf_pixel_range = 32 + +[resource] +fallbacks = Array[Font]([ExtResource("1_ub2cf"), ExtResource("2_ml3ku")]) +base_font = SubResource("SystemFont_ouejq") diff --git a/material_maker/theme/fonts/system/system_code_font.tres b/material_maker/theme/fonts/system/system_code_font.tres new file mode 100644 index 0000000000..9f7795d149 --- /dev/null +++ b/material_maker/theme/fonts/system/system_code_font.tres @@ -0,0 +1,13 @@ +[gd_resource type="FontVariation" format=3 uid="uid://dhfia0y843i1y"] + +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="1_tb5d5"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="2_qhq60"] + +[sub_resource type="SystemFont" id="SystemFont_ouejq"] +font_names = PackedStringArray("Monospace") +multichannel_signed_distance_field = true +msdf_pixel_range = 32 + +[resource] +fallbacks = Array[Font]([ExtResource("1_tb5d5"), ExtResource("2_qhq60")]) +base_font = SubResource("SystemFont_ouejq") diff --git a/material_maker/theme/fonts/system/system_main_font.tres b/material_maker/theme/fonts/system/system_main_font.tres new file mode 100644 index 0000000000..693bcc095f --- /dev/null +++ b/material_maker/theme/fonts/system/system_main_font.tres @@ -0,0 +1,13 @@ +[gd_resource type="FontVariation" format=3 uid="uid://bke5ujsr368cv"] + +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="1_dcm08"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="2_dulnh"] + +[sub_resource type="SystemFont" id="SystemFont_ouejq"] +font_names = PackedStringArray("Sans-Serif") +multichannel_signed_distance_field = true +msdf_pixel_range = 32 + +[resource] +fallbacks = Array[Font]([ExtResource("1_dcm08"), ExtResource("2_dulnh")]) +base_font = SubResource("SystemFont_ouejq") diff --git a/material_maker/theme/fonts/system/system_medium_font.tres b/material_maker/theme/fonts/system/system_medium_font.tres new file mode 100644 index 0000000000..28ce67581e --- /dev/null +++ b/material_maker/theme/fonts/system/system_medium_font.tres @@ -0,0 +1,14 @@ +[gd_resource type="FontVariation" format=3 uid="uid://6k785eldqigf"] + +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="1_qyurx"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="2_wh3pl"] + +[sub_resource type="SystemFont" id="SystemFont_ouejq"] +font_names = PackedStringArray("Sans-Serif") +font_weight = 600 +multichannel_signed_distance_field = true +msdf_pixel_range = 32 + +[resource] +fallbacks = Array[Font]([ExtResource("1_qyurx"), ExtResource("2_wh3pl")]) +base_font = SubResource("SystemFont_ouejq") diff --git a/material_maker/theme/fonts/ui/bold_font.tres b/material_maker/theme/fonts/ui/bold_font.tres new file mode 100644 index 0000000000..f5c15a74d0 --- /dev/null +++ b/material_maker/theme/fonts/ui/bold_font.tres @@ -0,0 +1,8 @@ +[gd_resource type="FontVariation" format=3 uid="uid://cfoeywyltjuo2"] + +[ext_resource type="FontFile" uid="uid://dq4ssdyyfotag" path="res://material_maker/theme/font_rubik/Rubik-Bold.ttf" id="1_v3ac0"] +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="2_bhm15"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="3_bhm15"] + +[resource] +fallbacks = Array[Font]([ExtResource("1_v3ac0"), ExtResource("2_bhm15"), ExtResource("3_bhm15")]) diff --git a/material_maker/theme/fonts/ui/classic_font.tres b/material_maker/theme/fonts/ui/classic_font.tres new file mode 100644 index 0000000000..333c5f18ae --- /dev/null +++ b/material_maker/theme/fonts/ui/classic_font.tres @@ -0,0 +1,7 @@ +[gd_resource type="FontVariation" format=3 uid="uid://cukrxt4w03iac"] + +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="2_em5my"] + +[resource] +fallbacks = Array[Font]([ExtResource("2_em5my")]) +base_font = ExtResource("2_em5my") diff --git a/material_maker/theme/fonts/ui/code_font.tres b/material_maker/theme/fonts/ui/code_font.tres new file mode 100644 index 0000000000..98eee92b0b --- /dev/null +++ b/material_maker/theme/fonts/ui/code_font.tres @@ -0,0 +1,8 @@ +[gd_resource type="FontVariation" format=3 uid="uid://cjc2c8qp5r5x0"] + +[ext_resource type="FontFile" uid="uid://c4vhxy5kgdp8s" path="res://material_maker/fonts/hack.ttf" id="1_w2v43"] +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="2_nv7dv"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="3_nv7dv"] + +[resource] +fallbacks = Array[Font]([ExtResource("1_w2v43"), ExtResource("2_nv7dv"), ExtResource("3_nv7dv")]) diff --git a/material_maker/theme/fonts/ui/main_font.tres b/material_maker/theme/fonts/ui/main_font.tres new file mode 100644 index 0000000000..6a00143556 --- /dev/null +++ b/material_maker/theme/fonts/ui/main_font.tres @@ -0,0 +1,8 @@ +[gd_resource type="FontVariation" format=3 uid="uid://b3d8p401jppew"] + +[ext_resource type="FontFile" uid="uid://lro0qdrhfytt" path="res://material_maker/theme/font_rubik/Rubik-Light.ttf" id="1_c62ru"] +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="2_waneu"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="3_waneu"] + +[resource] +fallbacks = Array[Font]([ExtResource("1_c62ru"), ExtResource("2_waneu"), ExtResource("3_waneu")]) diff --git a/material_maker/theme/fonts/ui/medium_font.tres b/material_maker/theme/fonts/ui/medium_font.tres new file mode 100644 index 0000000000..9e8327b28a --- /dev/null +++ b/material_maker/theme/fonts/ui/medium_font.tres @@ -0,0 +1,8 @@ +[gd_resource type="FontVariation" format=3 uid="uid://clmqa2fxntpp4"] + +[ext_resource type="FontFile" uid="uid://bn648prik7soq" path="res://material_maker/theme/font_rubik/Rubik-416.ttf" id="1_22i4t"] +[ext_resource type="FontFile" uid="uid://btybkvkb8rtol" path="res://material_maker/fonts/DroidSansFallback.ttf" id="2_k8ftl"] +[ext_resource type="FontFile" uid="uid://buwvapsuukd0n" path="res://material_maker/fonts/DroidSansJapanese.ttf" id="3_k8ftl"] + +[resource] +fallbacks = Array[Font]([ExtResource("1_22i4t"), ExtResource("2_k8ftl"), ExtResource("3_k8ftl")]) diff --git a/material_maker/theme/utils/font_utils.gd b/material_maker/theme/utils/font_utils.gd new file mode 100644 index 0000000000..1fdeb74137 --- /dev/null +++ b/material_maker/theme/utils/font_utils.gd @@ -0,0 +1,92 @@ +class_name FontUtils +extends RefCounted + +static var main_font : FontVariation = preload("res://material_maker/theme/fonts/ui/main_font.tres") +static var medium_font : FontVariation = preload("res://material_maker/theme/fonts/ui/medium_font.tres") +static var bold_font : FontVariation = preload("res://material_maker/theme/fonts/ui/bold_font.tres") +static var code_font : FontVariation = preload("res://material_maker/theme/fonts/ui/code_font.tres") + +static var classic_font : FontVariation = preload("res://material_maker/theme/fonts/ui/classic_font.tres") + +static var ui_font_size : int +static var ui_code_font_size : int + +const SETTINGS_UI_FONT_SIZE : String = "ui_font_size" +const SETTINGS_UI_CODE_FONT_SIZE : String = "ui_code_font_size" +const SETTINGS_UI_USE_SYSTEM_FONT : String = "ui_use_system_font" + +static func create_italic_variation(font : FontVariation) -> FontVariation: + var f : FontVariation = font.duplicate() + f.variation_transform = Transform2D( + Vector2(1.0, 0.22), Vector2(0.0, 1.0), Vector2.ZERO) + return f + +static func _has_font_config(config : String) -> bool: + return (mm_globals.has_config(config) + and not mm_globals.get_config(config).is_empty()) + +static func _setup_rendering(font : FontVariation) -> void: + if mm_globals.get_config("ui_font_enable_msdf"): + font.base_font.msdf_pixel_range = 32 + font.base_font.msdf_size = 48 + font.base_font.multichannel_signed_distance_field = true + else: + font.base_font.multichannel_signed_distance_field = false + +static func rebuild_fonts() -> void: + if mm_globals.has_config(SETTINGS_UI_FONT_SIZE): + ui_font_size = mm_globals.get_config(SETTINGS_UI_FONT_SIZE) + + if mm_globals.has_config(SETTINGS_UI_CODE_FONT_SIZE): + ui_code_font_size = mm_globals.get_config(SETTINGS_UI_CODE_FONT_SIZE) + + if mm_globals.get_config(SETTINGS_UI_USE_SYSTEM_FONT): + main_font = load("res://material_maker/theme/fonts/system/system_main_font.tres") + medium_font = load("res://material_maker/theme/fonts/system/system_medium_font.tres") + bold_font = load("res://material_maker/theme/fonts/system/system_bold_font.tres") + code_font = load("res://material_maker/theme/fonts/system/system_code_font.tres") + + var config : Dictionary[FontVariation, Dictionary] = { + main_font : { "weight": 400, "name": "Segoe UI" }, + medium_font : { "weight": 600, "name": "Segoe UI" }, + bold_font : { "weight": 800, "name": "Segoe UI" }, + code_font : { "weight": 400, "name": "Consolas" } + } + + for font_var : FontVariation in config: + var cfg : Dictionary = config[font_var] + if OS.get_name() == "Windows": + font_var.base_font = SystemFont.new() + font_var.base_font.font_names.append(cfg.name) + font_var.base_font.font_weight = cfg.weight + _setup_rendering(font_var) + return + + var fonts : Dictionary[String, FontVariation] = { + "main_font": main_font, + "medium_font": medium_font, + "bold_font": bold_font, + "code_font": code_font + } + + for font : String in fonts: + var font_variation : FontVariation = fonts[font] + var custom_font_path : String = mm_globals.get_config(font) + if _has_font_config(font) and FileAccess.file_exists(custom_font_path): + font_variation.base_font = FontFile.new() + font_variation.base_font.load_dynamic_font(custom_font_path) + font_variation.base_font.emit_changed() + else: + mm_globals.set_config(font, "") + font_variation.base_font = load(font_variation.fallbacks[0].resource_path) + font_variation.base_font.emit_changed() + _setup_rendering(font_variation) + +static func setup_theme_fonts(theme : Theme, theme_name : String) -> void: + var font : FontVariation = main_font + if "classic" in theme_name and not _has_font_config("main_font"): + font = classic_font + + theme.default_font = font + theme.set_font("title_font", "TooltipPanel", font) + theme.set_font("font", "TooltipLabel", font) diff --git a/material_maker/theme/utils/font_utils.gd.uid b/material_maker/theme/utils/font_utils.gd.uid new file mode 100644 index 0000000000..bbfe459b2e --- /dev/null +++ b/material_maker/theme/utils/font_utils.gd.uid @@ -0,0 +1 @@ +uid://c50net8nr1iig diff --git a/material_maker/widgets/float_edit/float_edit.gd b/material_maker/widgets/float_edit/float_edit.gd index 649faf89bd..0419165c26 100644 --- a/material_maker/widgets/float_edit/float_edit.gd +++ b/material_maker/widgets/float_edit/float_edit.gd @@ -298,6 +298,8 @@ func update() -> void: $Edit.add_theme_color_override("font_uneditable_color", get_theme_color("font_color")) else: $Edit.remove_theme_color_override("font_uneditable_color") + $Edit.add_theme_font_size_override("font_size", FontUtils.ui_font_size) + $Edit.add_theme_font_override("font", FontUtils.main_font) $Edit.queue_redraw() func _ready() -> void: diff --git a/material_maker/widgets/splines_edit/splines_editor.gd b/material_maker/widgets/splines_edit/splines_editor.gd index 15fed136e8..0be15d83d0 100644 --- a/material_maker/widgets/splines_edit/splines_editor.gd +++ b/material_maker/widgets/splines_edit/splines_editor.gd @@ -17,7 +17,7 @@ var mode : Modes = Modes.DRAW var progressive : bool = false -var spline_font = preload("res://material_maker/theme/font_rubik/Rubik-Bold.ttf") +var spline_font : FontVariation = FontUtils.bold_font var font_size = 16 var text_bg_width = 12 diff --git a/material_maker/windows/material_editor/export_editor.tscn b/material_maker/windows/material_editor/export_editor.tscn index 5bd2df39a4..2752774566 100644 --- a/material_maker/windows/material_editor/export_editor.tscn +++ b/material_maker/windows/material_editor/export_editor.tscn @@ -203,6 +203,7 @@ size_flags_vertical = 3 mouse_default_cursor_shape = 0 [node name="Custom Script" type="TextEdit" parent="MarginContainer/VBoxContainer/TabBar"] +unique_name_in_owner = true visible = false custom_minimum_size = Vector2(100, 200) layout_mode = 2 diff --git a/material_maker/windows/preferences/file_option.gd b/material_maker/windows/preferences/file_option.gd new file mode 100644 index 0000000000..8661bbd6eb --- /dev/null +++ b/material_maker/windows/preferences/file_option.gd @@ -0,0 +1,33 @@ +class_name FileOption +extends HBoxContainer + +@export var config_variable : String +@export var file_picker_filters : PackedStringArray + +func _ready() -> void: + for f in file_picker_filters: + $FilePickerButton.add_filter(f) + $FilePickerButton.tooltip_text = tooltip_text + +func init_from_config(config : ConfigFile) -> void: + if config.has_section_key("config", config_variable): + $FilePickerButton.path = config.get_value("config", config_variable) + if not $FilePickerButton.path.is_empty(): + $FilePickerButton.tooltip_text = $FilePickerButton.path + set_reset_button() + +func update_config(config : ConfigFile) -> void: + config.set_value("config", config_variable, $FilePickerButton.path) + +func _on_reset_pressed() -> void: + $FilePickerButton.path = "" + $FilePickerButton.tooltip_text = "" + set_reset_button() + +func set_reset_button() -> void: + $Reset.disabled = $FilePickerButton.path == "" + if $FilePickerButton.path == "": + $FilePickerButton.text = "Default" + +func _on_file_picker_button_file_selected(_f : Variant) -> void: + set_reset_button() diff --git a/material_maker/windows/preferences/file_option.gd.uid b/material_maker/windows/preferences/file_option.gd.uid new file mode 100644 index 0000000000..ae398e14f2 --- /dev/null +++ b/material_maker/windows/preferences/file_option.gd.uid @@ -0,0 +1 @@ +uid://bv04peqautr3c diff --git a/material_maker/windows/preferences/file_option.tscn b/material_maker/windows/preferences/file_option.tscn new file mode 100644 index 0000000000..dbeb5f2bc1 --- /dev/null +++ b/material_maker/windows/preferences/file_option.tscn @@ -0,0 +1,31 @@ +[gd_scene format=3 uid="uid://b7ko0gpbs5mqa"] + +[ext_resource type="Script" uid="uid://bv04peqautr3c" path="res://material_maker/windows/preferences/file_option.gd" id="1_3nbpc"] +[ext_resource type="PackedScene" uid="uid://cfyio0a1b27t0" path="res://material_maker/widgets/file_picker_button/file_picker_button.tscn" id="2_8arj1"] +[ext_resource type="Texture2D" uid="uid://1s0c37uoj4rf" path="res://material_maker/theme/default_theme_icons.svg" id="2_wpo6d"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_0r3o7"] +atlas = ExtResource("2_wpo6d") +region = Rect2(96, 192, 16, 16) + +[node name="FileOption" type="HBoxContainer" unique_id=1399365702] +offset_right = 94.0 +offset_bottom = 31.0 +size_flags_horizontal = 3 +script = ExtResource("1_3nbpc") +config_variable = "code_font" + +[node name="Reset" type="Button" parent="." unique_id=1833752383] +unique_name_in_owner = true +custom_minimum_size = Vector2(25, 0) +layout_mode = 2 +icon = SubResource("AtlasTexture_0r3o7") + +[node name="FilePickerButton" parent="." unique_id=275857412 instance=ExtResource("2_8arj1")] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 + +[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"] +[connection signal="pressed" from="Reset" to="." method="_on_reset_pressed"] +[connection signal="file_selected" from="FilePickerButton" to="." method="_on_file_picker_button_file_selected"] diff --git a/material_maker/windows/preferences/font_file_option.gd b/material_maker/windows/preferences/font_file_option.gd new file mode 100644 index 0000000000..2db2851777 --- /dev/null +++ b/material_maker/windows/preferences/font_file_option.gd @@ -0,0 +1,17 @@ +class_name FontFileOption +extends FileOption + +func _ready() -> void: + super._ready() + $FilePickerButton.file_selected.connect(file_selected) + +func init_from_config(config : ConfigFile) -> void: + super.init_from_config(config) + file_selected.call_deferred($FilePickerButton.path) + +func file_selected(file_path : String) -> void: + if FileAccess.file_exists(file_path): + var f : FontFile = FontFile.new() + var err : Error = f.load_dynamic_font(file_path) + if err == OK: + $FilePickerButton.text = f.get_font_name() diff --git a/material_maker/windows/preferences/font_file_option.gd.uid b/material_maker/windows/preferences/font_file_option.gd.uid new file mode 100644 index 0000000000..4d39fc7f59 --- /dev/null +++ b/material_maker/windows/preferences/font_file_option.gd.uid @@ -0,0 +1 @@ +uid://b1ltffcmm50pn diff --git a/material_maker/windows/preferences/preferences.tscn b/material_maker/windows/preferences/preferences.tscn index 7c381d3cc9..041712914c 100644 --- a/material_maker/windows/preferences/preferences.tscn +++ b/material_maker/windows/preferences/preferences.tscn @@ -7,8 +7,14 @@ [ext_resource type="Script" uid="uid://b6irr1ykhui6l" path="res://material_maker/windows/preferences/preferences_tree.gd" id="3_mlqij"] [ext_resource type="Script" uid="uid://gmystrme5ayw" path="res://material_maker/windows/preferences/lang_option.gd" id="4"] [ext_resource type="Script" uid="uid://d3h4xmek7b2vq" path="res://material_maker/windows/preferences/enum_option.gd" id="5_vp06c"] +[ext_resource type="PackedScene" uid="uid://b7ko0gpbs5mqa" path="res://material_maker/windows/preferences/file_option.tscn" id="7_mqpoi"] [ext_resource type="PackedScene" uid="uid://dk7ygrwx0h1k3" path="res://material_maker/windows/preferences/color_option.tscn" id="8_btfio"] [ext_resource type="Script" uid="uid://kac4whp71a8" path="res://material_maker/windows/preferences/enum_checklist.gd" id="9_7kd1x"] +[ext_resource type="Script" uid="uid://b1ltffcmm50pn" path="res://material_maker/windows/preferences/font_file_option.gd" id="10_0na6q"] + +[sub_resource type="LabelSettings" id="LabelSettings_btfio"] +outline_size = 2 +shadow_size = 0 [node name="Preferences" type="Window" unique_id=906006602] oversampling_override = 1.0 @@ -215,61 +221,6 @@ config_variable = "ui_single_window_mode" custom_minimum_size = Vector2(0, 10) layout_mode = 2 -[node name="GuiCustomThemeBase" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer" unique_id=2087466635] -layout_mode = 2 - -[node name="LabelThemeBaseCol" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer/GuiCustomThemeBase" unique_id=666414407] -layout_mode = 2 -text = "Custom theme base color" - -[node name="GuiCustomThemeBase" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer/GuiCustomThemeBase" unique_id=2141949997 instance=ExtResource("8_btfio")] -custom_minimum_size = Vector2(200, 25) -layout_mode = 2 -size_flags_horizontal = 10 -tooltip_text = "Base color used when deriving the custom theme." -edit_intensity = false -config_variable = "custom_theme_base_color" - -[node name="GuiCustomThemeAccent" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer" unique_id=1496726889] -layout_mode = 2 - -[node name="LabelThemeBaseAccent" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer/GuiCustomThemeAccent" unique_id=820405633] -layout_mode = 2 -text = "Custom theme accent" - -[node name="GuiCustomThemeAccent" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer/GuiCustomThemeAccent" unique_id=381059430 instance=ExtResource("8_btfio")] -custom_minimum_size = Vector2(200, 25) -layout_mode = 2 -size_flags_horizontal = 10 -tooltip_text = "Accent used for highlighted ui elements. -This includes text selections, icon colors in pressed/hovered buttons etc." -edit_intensity = false -config_variable = "custom_theme_accent_color" - -[node name="GuiCustomThemeContrast" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer" unique_id=132933454] -layout_mode = 2 - -[node name="LabelThemeContrast" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer/GuiCustomThemeContrast" unique_id=1590947111] -layout_mode = 2 -text = "Custom theme contrast" - -[node name="GuiCustomThemeContrast" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer/GuiCustomThemeContrast" unique_id=1058520305 instance=ExtResource("3")] -custom_minimum_size = Vector2(200, 24) -layout_mode = 2 -size_flags_horizontal = 10 -tooltip_text = "Contrast used when deriving base color for the custom theme. -Postive values create darker colors." -config_variable = "custom_theme_contrast" -value = 0.8 -min_value = -2.0 -max_value = 2.0 -step = 0.01 -float_only = true - -[node name="Spacer5" type="Control" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer" unique_id=1191755573] -custom_minimum_size = Vector2(0, 10) -layout_mode = 2 - [node name="Gui3DPreviewResolution" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/General/VBoxContainer" unique_id=581828549] layout_mode = 2 @@ -447,12 +398,224 @@ float_only = true custom_minimum_size = Vector2(0, 10) layout_mode = 2 -[node name="Bake" type="ScrollContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer" unique_id=660237356] +[node name="Theme" type="ScrollContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer" unique_id=1111133403] visible = false layout_mode = 2 theme_type_variation = &"MM_PreferenceTab" metadata/_tab_index = 1 +[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme" unique_id=1231307394] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="SectionColor" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=316720492] +layout_mode = 2 +text = "Colors" +label_settings = SubResource("LabelSettings_btfio") + +[node name="GuiCustomThemeBase" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1501240832] +layout_mode = 2 + +[node name="LabelThemeBaseCol" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiCustomThemeBase" unique_id=704666187] +layout_mode = 2 +text = "Custom theme base color" + +[node name="GuiCustomThemeBase" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiCustomThemeBase" unique_id=2141949997 instance=ExtResource("8_btfio")] +custom_minimum_size = Vector2(200, 25) +layout_mode = 2 +size_flags_horizontal = 10 +tooltip_text = "Base color used when deriving the custom theme." +edit_intensity = false +config_variable = "custom_theme_base_color" + +[node name="GuiCustomThemeAccent" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1315429715] +layout_mode = 2 + +[node name="LabelThemeBaseAccent" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiCustomThemeAccent" unique_id=366579792] +layout_mode = 2 +text = "Custom theme accent" + +[node name="GuiCustomThemeAccent" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiCustomThemeAccent" unique_id=1521101009 instance=ExtResource("8_btfio")] +custom_minimum_size = Vector2(200, 25) +layout_mode = 2 +size_flags_horizontal = 10 +tooltip_text = "Accent used for highlighted ui elements. +This includes text selections, icon colors in pressed/hovered buttons etc." +edit_intensity = false +config_variable = "custom_theme_accent_color" + +[node name="GuiCustomThemeContrast" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1217306784] +layout_mode = 2 + +[node name="LabelThemeContrast" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiCustomThemeContrast" unique_id=1951935188] +layout_mode = 2 +text = "Custom theme contrast" + +[node name="GuiCustomThemeContrast" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiCustomThemeContrast" unique_id=1806930641 instance=ExtResource("3")] +custom_minimum_size = Vector2(200, 24) +layout_mode = 2 +size_flags_horizontal = 10 +tooltip_text = "Contrast used when deriving base color for the custom theme. +Postive values create darker colors." +config_variable = "custom_theme_contrast" +value = 0.8 +min_value = -2.0 +max_value = 2.0 +step = 0.01 +float_only = true + +[node name="Spacer3" type="Control" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1906220719] +custom_minimum_size = Vector2(0, 10) +layout_mode = 2 + +[node name="SectionFont" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=486879697] +layout_mode = 2 +text = "Display Fonts (requires restart)" +label_settings = SubResource("LabelSettings_btfio") + +[node name="GuiInterfaceMainFont" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=758900584] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceMainFont" unique_id=1822476730] +layout_mode = 2 +text = "Main font" + +[node name="FontFileOption" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceMainFont" unique_id=1399365702 instance=ExtResource("7_mqpoi")] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 10 +script = ExtResource("10_0na6q") +config_variable = "main_font" +file_picker_filters = PackedStringArray("*.ttf; TrueType Font file", "*.otf; OpenType Font file", "*.woff2; Web Open Font file") + +[node name="GuiInterfaceMediumFont" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=34572927] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceMediumFont" unique_id=914702841] +layout_mode = 2 +text = "Medium font" + +[node name="FontFileOption" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceMediumFont" unique_id=1544432129 instance=ExtResource("7_mqpoi")] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 10 +script = ExtResource("10_0na6q") +config_variable = "medium_font" +file_picker_filters = PackedStringArray("*.ttf; TrueType Font file", "*.otf; OpenType Font file", "*.woff2; Web Open Font file") + +[node name="GuiInterfaceBoldFont" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1462088612] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceBoldFont" unique_id=1490863117] +layout_mode = 2 +text = "Bold font" + +[node name="FontFileOption" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceBoldFont" unique_id=945782835 instance=ExtResource("7_mqpoi")] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 10 +script = ExtResource("10_0na6q") +config_variable = "bold_font" +file_picker_filters = PackedStringArray("*.ttf; TrueType Font file", "*.otf; OpenType Font file", "*.woff2; Web Open Font file") + +[node name="GuiInterfaceCodeFont" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1481852751] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceCodeFont" unique_id=1662114990] +layout_mode = 2 +text = "Code font" + +[node name="FontFileOption" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceCodeFont" unique_id=1735527225 instance=ExtResource("7_mqpoi")] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 10 +script = ExtResource("10_0na6q") +file_picker_filters = PackedStringArray("*.ttf; TrueType Font file", "*.otf; OpenType Font file", "*.woff2; Web Open Font file") + +[node name="GuiInterfaceUseSystemFonts" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1096584127] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceUseSystemFonts" unique_id=817621155] +layout_mode = 2 +text = "Use system fonts" + +[node name="UiUseSystemFonts" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceUseSystemFonts" unique_id=270406247 instance=ExtResource("1")] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 10 +tooltip_text = "When enabled, system fonts will be used instead of Material Maker's built-in fonts or custom fonts set in preferences." +text = "On" +flat = false +config_variable = "ui_use_system_font" + +[node name="Spacer1" type="Control" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1988482743] +custom_minimum_size = Vector2(0, 10) +layout_mode = 2 + +[node name="GuiInterfaceFontMSDF" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=2144824696] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceFontMSDF" unique_id=177195979] +layout_mode = 2 +text = "MSDF Rendering" + +[node name="UiFontUseMSDF" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceFontMSDF" unique_id=609117319 instance=ExtResource("1")] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 10 +tooltip_text = "Enables MSDF(Multichannel Signed Distance Field) for font rendering. +This makes text look crisp at any scale but is prone to artifacts if font glyphs have overlapping shapes." +text = "On" +flat = false +config_variable = "ui_font_enable_msdf" + +[node name="Spacer2" type="Control" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1657519221] +custom_minimum_size = Vector2(0, 10) +layout_mode = 2 + +[node name="GuiInterfaceFontSize" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=197296407] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceFontSize" unique_id=83511662] +layout_mode = 2 +text = "UI font size" + +[node name="UiFontSize" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceFontSize" unique_id=2037581063 instance=ExtResource("3")] +custom_minimum_size = Vector2(200, 24) +layout_mode = 2 +size_flags_horizontal = 10 +config_variable = "ui_font_size" +value = 16.0 +min_value = 16.0 +max_value = 48.0 +step = 1.0 +float_only = true + +[node name="GuiInterfaceCodeFontSize" type="HBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer" unique_id=1343680422] +layout_mode = 2 + +[node name="Label" type="Label" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceCodeFontSize" unique_id=1460436146] +layout_mode = 2 +text = "Code font size" + +[node name="UiCodeFontSize" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Theme/VBoxContainer/GuiInterfaceCodeFontSize" unique_id=336987241 instance=ExtResource("3")] +custom_minimum_size = Vector2(200, 24) +layout_mode = 2 +size_flags_horizontal = 10 +config_variable = "ui_code_font_size" +value = 16.0 +min_value = 16.0 +max_value = 48.0 +step = 1.0 +float_only = true + +[node name="Bake" type="ScrollContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer" unique_id=660237356] +visible = false +layout_mode = 2 +theme_type_variation = &"MM_PreferenceTab" +metadata/_tab_index = 2 + [node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Bake" unique_id=1589724560] layout_mode = 2 size_flags_horizontal = 3 @@ -532,7 +695,7 @@ float_only = true visible = false layout_mode = 2 theme_type_variation = &"MM_PreferenceTab" -metadata/_tab_index = 2 +metadata/_tab_index = 3 [node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Graph" unique_id=798147459] layout_mode = 2 @@ -668,7 +831,7 @@ metadata/_custom_type_script = "uid://kac4whp71a8" visible = false layout_mode = 2 theme_type_variation = &"MM_PreferenceTab" -metadata/_tab_index = 3 +metadata/_tab_index = 4 [node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/PreferencesPanel/VBoxContainer/TabContainer/Export" unique_id=969038621] layout_mode = 2 diff --git a/material_maker/windows/preferences/preferences_tree.gd b/material_maker/windows/preferences/preferences_tree.gd index e819d1a4f0..7c10ad653c 100644 --- a/material_maker/windows/preferences/preferences_tree.gd +++ b/material_maker/windows/preferences/preferences_tree.gd @@ -18,6 +18,7 @@ func update_tree() -> void: var item: TreeItem = create_item() item.set_text(0, " %s " % tr(child.name)) item.set_metadata(0, child.get_index()) + item.set_custom_font(0, FontUtils.medium_font) sections.append(item) set_selected(sections[selected_section_id], 0)