diff --git a/icons/help.svg b/icons/help.svg new file mode 100644 index 00000000..bf89c454 --- /dev/null +++ b/icons/help.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/icons/help.svg.import b/icons/help.svg.import new file mode 100644 index 00000000..0a43add6 --- /dev/null +++ b/icons/help.svg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/help.svg-ab0e78fdbc27e34b7b2a494b462b374b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icons/help.svg" +dest_files=[ "res://.import/help.svg-ab0e78fdbc27e34b7b2a494b462b374b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/font-rect.png b/images/font-rect.png new file mode 100644 index 00000000..ae6ec04c Binary files /dev/null and b/images/font-rect.png differ diff --git a/images/font-rect.png.import b/images/font-rect.png.import new file mode 100644 index 00000000..cf96881b --- /dev/null +++ b/images/font-rect.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/font-rect.png-890c7bdb16b292867449fd0d1dbb3dd8.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/font-rect.png" +dest_files=[ "res://.import/font-rect.png-890c7bdb16b292867449fd0d1dbb3dd8.stex" ] + +[params] + +compress/mode=1 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/images/font-sizes.png b/images/font-sizes.png new file mode 100644 index 00000000..90ed9001 Binary files /dev/null and b/images/font-sizes.png differ diff --git a/images/font-sizes.png.import b/images/font-sizes.png.import new file mode 100644 index 00000000..c9960f59 --- /dev/null +++ b/images/font-sizes.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/font-sizes.png-5979e2fb93ab7e04e7276bb3d7a9e34d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/font-sizes.png" +dest_files=[ "res://.import/font-sizes.png-5979e2fb93ab7e04e7276bb3d7a9e34d.stex" ] + +[params] + +compress/mode=1 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/scenes/Catapult.tscn b/scenes/Catapult.tscn index 8144212f..4cafc3d9 100644 --- a/scenes/Catapult.tscn +++ b/scenes/Catapult.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=30 format=2] +[gd_scene load_steps=32 format=2] [ext_resource path="res://icons/info.svg" type="Texture" id=1] [ext_resource path="res://icons/download.svg" type="Texture" id=2] @@ -28,6 +28,8 @@ [ext_resource path="res://scenes/InlineIconButton.tscn" type="PackedScene" id=26] [ext_resource path="res://scripts/FontsUI.gd" type="Script" id=27] [ext_resource path="res://scripts/FontManager.gd" type="Script" id=28] +[ext_resource path="res://scenes/FontSizeHelpDialog.tscn" type="PackedScene" id=29] +[ext_resource path="res://icons/help.svg" type="Texture" id=30] [sub_resource type="ButtonGroup" id=1] @@ -122,11 +124,12 @@ margin_bottom = 91.0 ]] margin_top = 97.0 margin_right = 784.0 -margin_bottom = 418.0 +margin_bottom = 682.0 tab_align = 0 script = ExtResource( 16 ) [node name="Game" type="VBoxContainer" parent="Main/Tabs"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -586,7 +589,6 @@ current_dir = "/mnt/data/Godot/Catapult/Project" current_path = "/mnt/data/Godot/Catapult/Project/" [node name="Fonts" type="VBoxContainer" parent="Main/Tabs"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 7.5 @@ -597,11 +599,11 @@ script = ExtResource( 27 ) [node name="FontSelection" type="HBoxContainer" parent="Main/Tabs/Fonts"] margin_right = 769.0 -margin_bottom = 428.0 +margin_bottom = 432.0 [node name="RightPane" type="VBoxContainer" parent="Main/Tabs/Fonts/FontSelection"] margin_right = 299.0 -margin_bottom = 428.0 +margin_bottom = 432.0 size_flags_horizontal = 3 size_flags_stretch_ratio = 2.0 @@ -623,9 +625,9 @@ items = [ "Item 0", null, false, "Item 1", null, false, "Item 2", null, false, " allow_reselect = true [node name="Buttons" type="VBoxContainer" parent="Main/Tabs/Fonts/FontSelection/RightPane"] -margin_top = 310.0 +margin_top = 312.0 margin_right = 299.0 -margin_bottom = 409.0 +margin_bottom = 411.0 size_flags_vertical = 6 [node name="Grid" type="GridContainer" parent="Main/Tabs/Fonts/FontSelection/RightPane/Buttons"] @@ -670,12 +672,12 @@ text = "Reset All Fonts" [node name="VSeparator" type="VSeparator" parent="Main/Tabs/Fonts/FontSelection"] margin_left = 305.0 margin_right = 313.0 -margin_bottom = 428.0 +margin_bottom = 432.0 [node name="LeftPane" type="VBoxContainer" parent="Main/Tabs/Fonts/FontSelection"] margin_left = 319.0 margin_right = 769.0 -margin_bottom = 428.0 +margin_bottom = 432.0 size_flags_horizontal = 3 size_flags_stretch_ratio = 3.0 custom_constants/separation = 4 @@ -712,19 +714,39 @@ margin_right = 450.0 margin_bottom = 230.0 custom_constants/separation = 0 -[node name="Label2" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] -margin_left = 145.0 +[node name="HBoxContainer" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] margin_top = 234.0 -margin_right = 304.0 -margin_bottom = 263.0 +margin_right = 450.0 +margin_bottom = 234.0 +custom_constants/separation = 0 + +[node name="OtherSettings" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] +margin_left = 152.0 +margin_top = 238.0 +margin_right = 298.0 +margin_bottom = 267.0 +size_flags_horizontal = 4 +size_flags_vertical = 4 + +[node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/OtherSettings"] +margin_right = 120.0 +margin_bottom = 29.0 size_flags_horizontal = 4 -text = "Other font settings:" +text = "Other settings" align = 1 +[node name="HelpIcon" parent="Main/Tabs/Fonts/FontSelection/LeftPane/OtherSettings" instance=ExtResource( 26 )] +margin_left = 126.0 +margin_top = 4.0 +margin_right = 146.0 +margin_bottom = 24.0 +rect_min_size = Vector2( 20, 20 ) +texture_normal = ExtResource( 30 ) + [node name="FontSizeUI" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] -margin_top = 267.0 +margin_top = 271.0 margin_right = 450.0 -margin_bottom = 296.0 +margin_bottom = 300.0 size_flags_vertical = 6 [node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeUI"] @@ -742,9 +764,9 @@ max_value = 64.0 value = 8.0 [node name="FontSizeMap" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] -margin_top = 300.0 +margin_top = 304.0 margin_right = 450.0 -margin_bottom = 329.0 +margin_bottom = 333.0 size_flags_vertical = 6 [node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeMap"] @@ -762,9 +784,9 @@ max_value = 64.0 value = 8.0 [node name="FontSizeOvermap" type="HBoxContainer" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] -margin_top = 333.0 +margin_top = 337.0 margin_right = 450.0 -margin_bottom = 362.0 +margin_bottom = 366.0 size_flags_vertical = 6 [node name="Label" type="Label" parent="Main/Tabs/Fonts/FontSelection/LeftPane/FontSizeOvermap"] @@ -782,29 +804,29 @@ max_value = 64.0 value = 8.0 [node name="FontBlending" type="CheckButton" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] -margin_top = 366.0 +margin_top = 370.0 margin_right = 450.0 -margin_bottom = 395.0 +margin_bottom = 399.0 text = "Font blending" [node name="BtnSaveFontOptions" type="Button" parent="Main/Tabs/Fonts/FontSelection/LeftPane"] margin_left = 198.0 -margin_top = 399.0 +margin_top = 403.0 margin_right = 251.0 -margin_bottom = 428.0 +margin_bottom = 432.0 size_flags_horizontal = 4 text = "Save" [node name="HSeparator" type="HSeparator" parent="Main/Tabs/Fonts"] -margin_top = 434.0 +margin_top = 438.0 margin_right = 769.0 -margin_bottom = 434.0 +margin_bottom = 438.0 custom_constants/separation = 0 [node name="FontConfigInfo" type="RichTextLabel" parent="Main/Tabs/Fonts"] -margin_top = 440.0 +margin_top = 444.0 margin_right = 769.0 -margin_bottom = 528.0 +margin_bottom = 532.0 custom_fonts/bold_italics_font = ExtResource( 24 ) custom_fonts/italics_font = ExtResource( 23 ) custom_fonts/bold_font = ExtResource( 22 ) @@ -820,6 +842,13 @@ text = "Existing font configuration will be shown here. ..." fit_content_height = true +[node name="FontSizeHelpDialog" parent="Main/Tabs/Fonts" instance=ExtResource( 29 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 538.0 +margin_right = 769.0 +margin_bottom = 539.0 + [node name="Settings" type="VBoxContainer" parent="Main/Tabs"] visible = false anchor_right = 1.0 @@ -1088,7 +1117,7 @@ size_flags_horizontal = 4 text = "Print a random Tip of the Day" [node name="Log" type="RichTextLabel" parent="Main"] -margin_top = 424.0 +margin_top = 688.0 margin_right = 784.0 margin_bottom = 984.0 focus_mode = 2 @@ -1152,12 +1181,15 @@ __meta__ = { [node name="Fonts" type="Node" parent="."] script = ExtResource( 28 ) +__meta__ = { +"_editor_description_": "Installs fonts from launcher's internal storage to the game directory, reads, manipulates and saves font-related settings." +} [connection signal="meta_clicked" from="Main/GameInfo/Description" to="." method="_on_Description_meta_clicked"] -[connection signal="tab_changed" from="Main/Tabs" to="." method="_on_Tabs_tab_changed"] -[connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Soundpacks" method="_on_Tabs_tab_changed"] [connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Fonts" method="_on_Tabs_tab_changed"] [connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Mods" method="_on_Tabs_tab_changed"] +[connection signal="tab_changed" from="Main/Tabs" to="Main/Tabs/Soundpacks" method="_on_Tabs_tab_changed"] +[connection signal="tab_changed" from="Main/Tabs" to="." method="_on_Tabs_tab_changed"] [connection signal="item_selected" from="Main/Tabs/Game/Builds/BuildsList" to="." method="_on_BuildsList_item_selected"] [connection signal="pressed" from="Main/Tabs/Game/Builds/BtnRefresh" to="." method="_on_BtnRefresh_pressed"] [connection signal="pressed" from="Main/Tabs/Game/BtnInstall" to="." method="_on_BtnInstall_pressed"] @@ -1193,6 +1225,7 @@ script = ExtResource( 28 ) [connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/Grid/BtnSetFontAll" to="Main/Tabs/Fonts" method="_on_BtnSetFontX_pressed" binds= [ true, true, true ]] [connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/RightPane/Buttons/BtnResetFont" to="Main/Tabs/Fonts" method="_on_BtnResetFont_pressed"] [connection signal="toggled" from="Main/Tabs/Fonts/FontSelection/LeftPane/PreviewCyrillic" to="Main/Tabs/Fonts" method="_on_PreviewCyrillic_toggled"] +[connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/LeftPane/OtherSettings/HelpIcon" to="Main/Tabs/Fonts" method="_on_HelpIcon_pressed"] [connection signal="pressed" from="Main/Tabs/Fonts/FontSelection/LeftPane/BtnSaveFontOptions" to="Main/Tabs/Fonts" method="_on_BtnSaveFontOptions_pressed"] [connection signal="toggled" from="Main/Tabs/Settings/ShowGameDesc" to="Main/Tabs/Settings" method="_on_ShowGameDesc_toggled"] [connection signal="toggled" from="Main/Tabs/Settings/PrintTips" to="Main/Tabs/Settings" method="_on_PrintTips_toggled"] diff --git a/scenes/FontSizeHelpDialog.tscn b/scenes/FontSizeHelpDialog.tscn new file mode 100644 index 00000000..9200bf3a --- /dev/null +++ b/scenes/FontSizeHelpDialog.tscn @@ -0,0 +1,96 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://fonts/OpenSans-Regular.tres" type="DynamicFont" id=1] +[ext_resource path="res://fonts/OpenSans-SemiboldItalic.tres" type="DynamicFont" id=2] +[ext_resource path="res://fonts/OpenSans-Italic.tres" type="DynamicFont" id=3] +[ext_resource path="res://fonts/OpenSans-Semibold.tres" type="DynamicFont" id=4] +[ext_resource path="res://scripts/FontSizeHelpDialog.gd" type="Script" id=5] + +[node name="FontSizeHelpDialog" type="WindowDialog"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Panel" type="PanelContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Margin" type="MarginContainer" parent="Panel"] +margin_left = 14.0 +margin_top = 14.0 +margin_right = 786.0 +margin_bottom = 986.0 +custom_constants/margin_top = 8 +custom_constants/margin_bottom = 8 + +[node name="VBox" type="VBoxContainer" parent="Panel/Margin"] +margin_top = 8.0 +margin_right = 772.0 +margin_bottom = 964.0 +custom_constants/separation = 16 + +[node name="Help" type="RichTextLabel" parent="Panel/Margin/VBox"] +margin_right = 772.0 +margin_bottom = 919.0 +size_flags_vertical = 3 +custom_fonts/bold_italics_font = ExtResource( 2 ) +custom_fonts/italics_font = ExtResource( 3 ) +custom_fonts/bold_font = ExtResource( 4 ) +custom_fonts/normal_font = ExtResource( 1 ) +bbcode_enabled = true +bbcode_text = "As you've probably already noticed, you can set a separate font for game UI, map and overmap. Additionally, each of these three fonts in Cataclysm has three size parameters that define how it is drawn. They can be set in the game under [i]Settings > Graphics > Font Settings[/i]. + +IMG_1 + +[b]Font Height[/b] and [b]Font Width[/b] define the pixel size of the rectangle the game reserves for each character. If this rectangle is too small, the letters will be clipped. If it is too large, they will be far apart and appear undersized. + +IMG_2 + +[b]Font Size[/b] is the actual size at which font glyphs will always be rendered, whether they fit into reserved space or not. + +For the default Cataclysm fonts, [i]Terminus[/i] and [i]Unifont[/i], these values have a very simple relationship: Font Height should be the same as Font Size, and Font Width should be half that for UI, and equal to Height for everything else (so that tiles are square). + +These ratios also work for many 3rd party fonts one may decide to use, but for some fonts a bit of tinkering is required to figure out a good-looking combination of font height, width and size. + +Fortunately, Catapult already knows good size ratios for the fonts it offers, so you only need to specify the desired [b]Font Size[/b], and it will calculate and apply the other two values automatically. They are also applied when you set a custom font in the left pane without changing the size. + +It is also recommended to turn on [b]Font Blending[/b] for smoother font rendering. + + +" +text = "As you've probably already noticed, you can set a separate font for game UI, map and overmap. Additionally, each of these three fonts in Cataclysm has three size parameters that define how it is drawn. They can be set in the game under Settings > Graphics > Font Settings. + +IMG_1 + +Font Height and Font Width define the pixel size of the rectangle the game reserves for each character. If this rectangle is too small, the letters will be clipped. If it is too large, they will be far apart and appear undersized. + +IMG_2 + +Font Size is the actual size at which font glyphs will always be rendered, whether they fit into reserved space or not. + +For the default Cataclysm fonts, Terminus and Unifont, these values have a very simple relationship: Font Height should be the same as Font Size, and Font Width should be half that for UI, and equal to Height for everything else (so that tiles are square). + +These ratios also work for many 3rd party fonts one may decide to use, but for some fonts a bit of tinkering is required to figure out a good-looking combination of font height, width and size. + +Fortunately, Catapult already knows good size ratios for the fonts it offers, so you only need to specify the desired Font Size, and it will calculate and apply the other two values automatically. They are also applied when you set a custom font in the left pane without changing the size. + +It is also recommended to turn on Font Blending for smoother font rendering. + + +" + +[node name="BtnOK" type="Button" parent="Panel/Margin/VBox"] +margin_left = 345.0 +margin_top = 935.0 +margin_right = 427.0 +margin_bottom = 972.0 +size_flags_horizontal = 4 +text = "Close" + +[connection signal="pressed" from="Panel/Margin/VBox/BtnOK" to="." method="_on_BtnOK_pressed"] diff --git a/scenes/ModReinstallDialog.tscn b/scenes/ModReinstallDialog.tscn index 1039adbf..d7f72c9e 100644 --- a/scenes/ModReinstallDialog.tscn +++ b/scenes/ModReinstallDialog.tscn @@ -3,7 +3,6 @@ [ext_resource path="res://scripts/ModReinstallDialog.gd" type="Script" id=1] [node name="ModReinstallDialog" type="WindowDialog"] -visible = true anchor_right = 1.0 anchor_bottom = 0.268 size_flags_horizontal = 3 diff --git a/scripts/FontSizeHelpDialog.gd b/scripts/FontSizeHelpDialog.gd new file mode 100644 index 00000000..8fad92c2 --- /dev/null +++ b/scripts/FontSizeHelpDialog.gd @@ -0,0 +1,38 @@ +extends WindowDialog + + +const _IMG1_RES := "res://images/font-sizes.png" +const _IMG2_RES := "res://images/font-rect.png" + +const _IMG1_SZ := 200 +const _IMG2_SZ := 450 + +var _text := "" + +onready var _geom := $"/root/WindowGeometry" +onready var _label := $Panel/Margin/VBox/Help + + +func _ready() -> void: + + _text = _label.bbcode_text + + +func open() -> void: + + var text := _text + var img1_size := int(_IMG1_SZ * _geom.scale) + var img2_size := int(_IMG2_SZ * _geom.scale) + text = text.replace("IMG_1", "[img=%s]%s[/img]" % [img1_size, _IMG1_RES]) + text = text.replace("IMG_2", "[img=%s]%s[/img]" % [img2_size, _IMG2_RES]) + _label.bbcode_text = text + _label.scroll_to_line(0) +# + rect_min_size = get_tree().root.size * Vector2(0.9, 0.9) + set_as_minsize() + popup_centered() + + +func _on_BtnOK_pressed() -> void: + + hide() diff --git a/scripts/FontsUI.gd b/scripts/FontsUI.gd index df205500..72c88b0d 100644 --- a/scripts/FontsUI.gd +++ b/scripts/FontsUI.gd @@ -69,6 +69,7 @@ onready var _sb_font_ui := $FontSelection/LeftPane/FontSizeUI/sbFontSizeUI onready var _sb_font_map := $FontSelection/LeftPane/FontSizeMap/sbFontSizeMap onready var _sb_font_om := $FontSelection/LeftPane/FontSizeOvermap/sbFontSizeOM onready var _cbtn_blending := $FontSelection/LeftPane/FontBlending +onready var _help_dlg := $FontSizeHelpDialog func _make_preview_string(cyrillic: bool = false) -> String: @@ -200,3 +201,8 @@ func _on_BtnSaveFontOptions_pressed() -> void: _fonts.set_game_option("FONT_BLENDING", str(_cbtn_blending.pressed)) _fonts.write_game_options() + + +func _on_HelpIcon_pressed() -> void: + + _help_dlg.open()