mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Change the font of the interface from the properties
This commit is contained in:
parent
120bd9a7df
commit
91f0b26245
|
@ -210,6 +210,20 @@ var integer_zoom := false:
|
||||||
|
|
||||||
## Found in Preferences. The scale of the interface.
|
## Found in Preferences. The scale of the interface.
|
||||||
var shrink := 1.0
|
var shrink := 1.0
|
||||||
|
var theme_font := loaded_fonts[theme_font_index]:
|
||||||
|
set(value):
|
||||||
|
theme_font = value
|
||||||
|
if is_instance_valid(control) and is_instance_valid(control.theme):
|
||||||
|
control.theme.default_font = theme_font
|
||||||
|
## Found in Preferences. The index of the font used by the interface.
|
||||||
|
var theme_font_index := 1:
|
||||||
|
set(value):
|
||||||
|
theme_font_index = value
|
||||||
|
if theme_font_index < loaded_fonts.size():
|
||||||
|
theme_font = loaded_fonts[theme_font_index]
|
||||||
|
else:
|
||||||
|
var font_name := get_available_font_names()[theme_font_index]
|
||||||
|
theme_font = find_font_from_name(font_name)
|
||||||
## Found in Preferences. The font size used by the interface.
|
## Found in Preferences. The font size used by the interface.
|
||||||
var font_size := 16
|
var font_size := 16
|
||||||
## Found in Preferences. If [code]true[/code], the interface dims on popups.
|
## Found in Preferences. If [code]true[/code], the interface dims on popups.
|
||||||
|
@ -277,6 +291,7 @@ var tool_button_size := ButtonSize.SMALL:
|
||||||
return
|
return
|
||||||
tool_button_size = value
|
tool_button_size = value
|
||||||
Tools.set_button_size(tool_button_size)
|
Tools.set_button_size(tool_button_size)
|
||||||
|
## Found in Preferences.
|
||||||
var share_options_between_tools := false:
|
var share_options_between_tools := false:
|
||||||
set(value):
|
set(value):
|
||||||
share_options_between_tools = value
|
share_options_between_tools = value
|
||||||
|
|
|
@ -43,6 +43,8 @@ func remove_theme(theme: Theme) -> void:
|
||||||
func change_theme(id: int) -> void:
|
func change_theme(id: int) -> void:
|
||||||
theme_index = id
|
theme_index = id
|
||||||
var theme := themes[id]
|
var theme := themes[id]
|
||||||
|
if theme.default_font != Global.theme_font:
|
||||||
|
theme.default_font = Global.theme_font
|
||||||
theme.default_font_size = Global.font_size
|
theme.default_font_size = Global.font_size
|
||||||
theme.set_font_size("font_size", "HeaderSmall", Global.font_size + 2)
|
theme.set_font_size("font_size", "HeaderSmall", Global.font_size + 2)
|
||||||
var icon_color := theme.get_color("modulate_color", "Icons")
|
var icon_color := theme.get_color("modulate_color", "Icons")
|
||||||
|
|
|
@ -9,6 +9,7 @@ var preferences: Array[Preference] = [
|
||||||
),
|
),
|
||||||
Preference.new("ffmpeg_path", "Startup/StartupContainer/FFMPEGPath", "text", ""),
|
Preference.new("ffmpeg_path", "Startup/StartupContainer/FFMPEGPath", "text", ""),
|
||||||
Preference.new("shrink", "%ShrinkSlider", "value", 1.0),
|
Preference.new("shrink", "%ShrinkSlider", "value", 1.0),
|
||||||
|
Preference.new("theme_font_index", "%FontOptionButton", "selected", 1),
|
||||||
Preference.new("font_size", "%FontSizeSlider", "value", 16),
|
Preference.new("font_size", "%FontSizeSlider", "value", 16),
|
||||||
Preference.new(
|
Preference.new(
|
||||||
"dim_on_popup", "Interface/InterfaceOptions/DimCheckBox", "button_pressed", true
|
"dim_on_popup", "Interface/InterfaceOptions/DimCheckBox", "button_pressed", true
|
||||||
|
@ -292,6 +293,10 @@ func _ready() -> void:
|
||||||
language.add_child(button)
|
language.add_child(button)
|
||||||
button.pressed.connect(_on_language_pressed.bind(button.get_index()))
|
button.pressed.connect(_on_language_pressed.bind(button.get_index()))
|
||||||
|
|
||||||
|
# Add fonts to the font option button
|
||||||
|
for font_name in Global.get_available_font_names():
|
||||||
|
%FontOptionButton.add_item(font_name)
|
||||||
|
|
||||||
for pref in preferences:
|
for pref in preferences:
|
||||||
if not right_side.has_node(pref.node_path):
|
if not right_side.has_node(pref.node_path):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -205,6 +205,15 @@ layout_mode = 2
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
text = "Apply"
|
text = "Apply"
|
||||||
|
|
||||||
|
[node name="FontLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Font:"
|
||||||
|
|
||||||
|
[node name="FontOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="DimLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
[node name="DimLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
Loading…
Reference in a new issue