diff --git a/docs/ART_STYLE.md b/docs/ART_STYLE.md index 08431bbd..01bd06a9 100644 --- a/docs/ART_STYLE.md +++ b/docs/ART_STYLE.md @@ -69,7 +69,7 @@ slope, height and world-space noise, so any heightfield is shaded for free. Concord field equipment uses steel-blue chamfered plates, subtle outlines and cyan instrument lamps. Orange marks warnings. `HudStyle`, `PlateStyle` and `HudTheme` provide the shared controls; `UiTheme` applies the stock-control theme -before screens are built. Chakra Petch supplies body, button and heading weights. +before screens are built. Saira supplies body, button and heading weights. Its SIL Open Font Licence is bundled under `game/assets/fonts/OFL.txt`, included in exports and displayed in Credits. @@ -84,3 +84,8 @@ The title keeps its main play actions in a vertical stack, with secondary action in a compact two-column group. Heading size and spacing adapt to shorter windows; the supported 1152×648 layout fits at 100% and 130% UI scale without a scrollbar. Very short windows retain an emergency scrolling fallback so actions stay reachable. + +Typography uses Saira at normal width (100): regular 400 for body text, medium +500 for buttons, and semibold 600 for headings. Help pages and mission briefings +use 16 px text with 4 px extra line spacing. The bundled variable font and +SIL Open Font License live in `game/assets/fonts/`. diff --git a/game/assets/fonts/ChakraPetch-Medium.ttf b/game/assets/fonts/ChakraPetch-Medium.ttf deleted file mode 100644 index 2e2d8da5..00000000 Binary files a/game/assets/fonts/ChakraPetch-Medium.ttf and /dev/null differ diff --git a/game/assets/fonts/ChakraPetch-Regular.ttf b/game/assets/fonts/ChakraPetch-Regular.ttf deleted file mode 100644 index c1167ce4..00000000 Binary files a/game/assets/fonts/ChakraPetch-Regular.ttf and /dev/null differ diff --git a/game/assets/fonts/ChakraPetch-Regular.ttf.import b/game/assets/fonts/ChakraPetch-Regular.ttf.import deleted file mode 100644 index 9d3f4b6e..00000000 --- a/game/assets/fonts/ChakraPetch-Regular.ttf.import +++ /dev/null @@ -1,36 +0,0 @@ -[remap] - -importer="font_data_dynamic" -type="FontFile" -uid="uid://ddh628q0xmbce" -path="res://.godot/imported/ChakraPetch-Regular.ttf-da050ac5f5f58524f1048d8edddf525b.fontdata" - -[deps] - -source_file="res://assets/fonts/ChakraPetch-Regular.ttf" -dest_files=["res://.godot/imported/ChakraPetch-Regular.ttf-da050ac5f5f58524f1048d8edddf525b.fontdata"] - -[params] - -Rendering=null -antialiasing=1 -generate_mipmaps=false -disable_embedded_bitmaps=true -multichannel_signed_distance_field=false -msdf_pixel_range=8 -msdf_size=48 -allow_system_fallback=true -force_autohinter=false -modulate_color_glyphs=false -hinting=3 -subpixel_positioning=4 -keep_rounding_remainders=true -oversampling=0.0 -Fallbacks=null -fallbacks=[] -Compress=null -compress=true -preload=[] -language_support={} -script_support={} -opentype_features={} diff --git a/game/assets/fonts/ChakraPetch-SemiBold.ttf b/game/assets/fonts/ChakraPetch-SemiBold.ttf deleted file mode 100644 index 802d5987..00000000 Binary files a/game/assets/fonts/ChakraPetch-SemiBold.ttf and /dev/null differ diff --git a/game/assets/fonts/ChakraPetch-SemiBold.ttf.import b/game/assets/fonts/ChakraPetch-SemiBold.ttf.import deleted file mode 100644 index 01fb92c7..00000000 --- a/game/assets/fonts/ChakraPetch-SemiBold.ttf.import +++ /dev/null @@ -1,36 +0,0 @@ -[remap] - -importer="font_data_dynamic" -type="FontFile" -uid="uid://dqeqfwbhftt4i" -path="res://.godot/imported/ChakraPetch-SemiBold.ttf-87a6da42122dc6ad3132f6ee6c79d8d9.fontdata" - -[deps] - -source_file="res://assets/fonts/ChakraPetch-SemiBold.ttf" -dest_files=["res://.godot/imported/ChakraPetch-SemiBold.ttf-87a6da42122dc6ad3132f6ee6c79d8d9.fontdata"] - -[params] - -Rendering=null -antialiasing=1 -generate_mipmaps=false -disable_embedded_bitmaps=true -multichannel_signed_distance_field=false -msdf_pixel_range=8 -msdf_size=48 -allow_system_fallback=true -force_autohinter=false -modulate_color_glyphs=false -hinting=3 -subpixel_positioning=4 -keep_rounding_remainders=true -oversampling=0.0 -Fallbacks=null -fallbacks=[] -Compress=null -compress=true -preload=[] -language_support={} -script_support={} -opentype_features={} diff --git a/game/assets/fonts/OFL.txt b/game/assets/fonts/OFL.txt index 4b4c452c..6522de0e 100644 --- a/game/assets/fonts/OFL.txt +++ b/game/assets/fonts/OFL.txt @@ -1,8 +1,9 @@ -Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) +Copyright 2020 The Saira Project Authors (https://github.com/Omnibus-Type/Saira) + This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL +https://scripts.sil.org/OFL ----------------------------------------------------------- diff --git a/game/assets/fonts/Saira-Medium.tres b/game/assets/fonts/Saira-Medium.tres new file mode 100644 index 00000000..19be69b1 --- /dev/null +++ b/game/assets/fonts/Saira-Medium.tres @@ -0,0 +1,10 @@ +[gd_resource type="FontVariation" load_steps=2 format=3] + +[ext_resource type="FontFile" path="res://assets/fonts/Saira.ttf" id="1"] + +[resource] +base_font = ExtResource("1") +variation_opentype = { +2003265652: 500.0, +2003072104: 100.0 +} diff --git a/game/assets/fonts/Saira-Regular.tres b/game/assets/fonts/Saira-Regular.tres new file mode 100644 index 00000000..41487487 --- /dev/null +++ b/game/assets/fonts/Saira-Regular.tres @@ -0,0 +1,10 @@ +[gd_resource type="FontVariation" load_steps=2 format=3] + +[ext_resource type="FontFile" path="res://assets/fonts/Saira.ttf" id="1"] + +[resource] +base_font = ExtResource("1") +variation_opentype = { +2003265652: 400.0, +2003072104: 100.0 +} diff --git a/game/assets/fonts/Saira-SemiBold.tres b/game/assets/fonts/Saira-SemiBold.tres new file mode 100644 index 00000000..8c1a91d5 --- /dev/null +++ b/game/assets/fonts/Saira-SemiBold.tres @@ -0,0 +1,10 @@ +[gd_resource type="FontVariation" load_steps=2 format=3] + +[ext_resource type="FontFile" path="res://assets/fonts/Saira.ttf" id="1"] + +[resource] +base_font = ExtResource("1") +variation_opentype = { +2003265652: 600.0, +2003072104: 100.0 +} diff --git a/game/assets/fonts/Saira.ttf b/game/assets/fonts/Saira.ttf new file mode 100644 index 00000000..b7e017b3 Binary files /dev/null and b/game/assets/fonts/Saira.ttf differ diff --git a/game/assets/fonts/ChakraPetch-Medium.ttf.import b/game/assets/fonts/Saira.ttf.import similarity index 60% rename from game/assets/fonts/ChakraPetch-Medium.ttf.import rename to game/assets/fonts/Saira.ttf.import index ac97191c..67ba2889 100644 --- a/game/assets/fonts/ChakraPetch-Medium.ttf.import +++ b/game/assets/fonts/Saira.ttf.import @@ -2,13 +2,13 @@ importer="font_data_dynamic" type="FontFile" -uid="uid://dte7co0h0a4mr" -path="res://.godot/imported/ChakraPetch-Medium.ttf-78a016a08515eee6e20491208eeba7e4.fontdata" +uid="uid://quqms5mdgun0" +path="res://.godot/imported/Saira.ttf-36935d665899663006e89e28bf9c9c7d.fontdata" [deps] -source_file="res://assets/fonts/ChakraPetch-Medium.ttf" -dest_files=["res://.godot/imported/ChakraPetch-Medium.ttf-78a016a08515eee6e20491208eeba7e4.fontdata"] +source_file="res://assets/fonts/Saira.ttf" +dest_files=["res://.godot/imported/Saira.ttf-36935d665899663006e89e28bf9c9c7d.fontdata"] [params] @@ -22,8 +22,8 @@ msdf_size=48 allow_system_fallback=true force_autohinter=false modulate_color_glyphs=false -hinting=3 -subpixel_positioning=4 +hinting=1 +subpixel_positioning=1 keep_rounding_remainders=true oversampling=0.0 Fallbacks=null diff --git a/game/tests/ui/test_typography.gd b/game/tests/ui/test_typography.gd new file mode 100644 index 00000000..c1e1888a --- /dev/null +++ b/game/tests/ui/test_typography.gd @@ -0,0 +1,24 @@ +extends GutTest +## The variable font must select real body/button/heading weights, not its Thin default. + + +func test_saira_roles_keep_normal_width_and_readable_weights() -> void: + var roles: Dictionary = { + HudStyle.FONT_BODY: 400.0, HudStyle.FONT_BUTTON: 500.0, HudStyle.FONT_HEADING: 600.0 + } + for path: String in roles: + var font: FontVariation = HudStyle.font(path) as FontVariation + assert_not_null(font, path) + var weight: float = font.variation_opentype[2003265652] + var expected: float = roles[path] + assert_eq(weight, expected) + var width: float = font.variation_opentype[2003072104] + assert_eq(width, 100.0) + for character: String in ["A", "a", "0", "1", "·", "…", "—"]: + assert_true(font.has_char(character.unicode_at(0)), character) + + +func test_credits_include_the_bundled_saira_license() -> void: + var license_text: String = FileAccess.get_file_as_string("res://assets/fonts/OFL.txt") + assert_true(license_text.contains("Saira Project Authors")) + assert_true(license_text.contains("SIL OPEN FONT LICENSE Version 1.1")) diff --git a/game/tests/ui/test_typography.gd.uid b/game/tests/ui/test_typography.gd.uid new file mode 100644 index 00000000..5d031110 --- /dev/null +++ b/game/tests/ui/test_typography.gd.uid @@ -0,0 +1 @@ +uid://crduy73wi2e4a diff --git a/game/ui/briefing_panel.gd b/game/ui/briefing_panel.gd index 517225bf..90fab85d 100644 --- a/game/ui/briefing_panel.gd +++ b/game/ui/briefing_panel.gd @@ -56,7 +56,8 @@ func _ready() -> void: var body := VBoxContainer.new() body.add_theme_constant_override(&"separation", 10) column.add_scroll(body) - _text = HudStyle.make_label(14, HudStyle.TEXT_COLOR) + _text = HudStyle.make_label(16, HudStyle.TEXT_COLOR) + _text.add_theme_constant_override(&"line_spacing", 4) _text.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART _text.custom_minimum_size = Vector2(WIDTH, 0) body.add_child(_text) diff --git a/game/ui/hud_style.gd b/game/ui/hud_style.gd index 7b25c1d9..38806dac 100644 --- a/game/ui/hud_style.gd +++ b/game/ui/hud_style.gd @@ -34,11 +34,11 @@ const PANEL_CUT := 10.0 const BUTTON_CUT := 6.0 ## Labels this large or larger are set in the heading weight. const HEADING_SIZE := 18 -## The typeface (Chakra Petch, SIL Open Font License) by weight. Loaded on first use, +## The typeface (Saira, SIL Open Font License) by weight. Loaded on first use, ## not preloaded: a fresh checkout parses this script before the fonts are imported. -const FONT_BODY: String = "res://assets/fonts/ChakraPetch-Regular.ttf" -const FONT_BUTTON: String = "res://assets/fonts/ChakraPetch-Medium.ttf" -const FONT_HEADING: String = "res://assets/fonts/ChakraPetch-SemiBold.ttf" +const FONT_BODY: String = "res://assets/fonts/Saira-Regular.tres" +const FONT_BUTTON: String = "res://assets/fonts/Saira-Medium.tres" +const FONT_HEADING: String = "res://assets/fonts/Saira-SemiBold.tres" ## The font at `path` (FONT_BODY, FONT_BUTTON, FONT_HEADING). diff --git a/game/ui/info_panel.gd b/game/ui/info_panel.gd index 6e92f374..cfaa13c0 100644 --- a/game/ui/info_panel.gd +++ b/game/ui/info_panel.gd @@ -55,7 +55,8 @@ func _ready() -> void: column.add_child(_kicker) _heading = HudStyle.make_label(26, HudStyle.TEXT_COLOR) column.add_child(_heading) - _body = HudStyle.make_label(13, HudStyle.TEXT_COLOR) + _body = HudStyle.make_label(16, HudStyle.TEXT_COLOR) + _body.add_theme_constant_override(&"line_spacing", 4) _body.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART _body.size_flags_horizontal = Control.SIZE_EXPAND_FILL _scroll = column.add_scroll(_body, HEIGHT) @@ -311,9 +312,9 @@ static func credits_text() -> String: ), 'GUT, the Godot Unit Test framework, by Tom "Butch" Wesley and contributors, MIT licence.', "gdtoolkit (gdformat, gdlint), by Pawel Lampe and contributors, MIT licence.", - "Chakra Petch, Copyright 2018 The Chakra Petch Project Authors, SIL Open Font Licence 1.1.", + "Saira, Copyright 2020 The Saira Project Authors, SIL Open Font Licence 1.1.", "", - "CHAKRA PETCH FONT LICENCE", + "SAIRA FONT LICENCE", FileAccess.get_file_as_string("res://assets/fonts/OFL.txt").strip_edges(), "", "GODOT ENGINE LICENCE", diff --git a/game/ui/save_load_panel.gd b/game/ui/save_load_panel.gd index 3c56ef33..e0bc05f1 100644 --- a/game/ui/save_load_panel.gd +++ b/game/ui/save_load_panel.gd @@ -40,16 +40,16 @@ func _ready() -> void: panel.add_theme_stylebox_override(&"panel", HudStyle.solid_panel_style()) panel.mouse_filter = Control.MOUSE_FILTER_STOP centre.add_child(panel) - var column := VBoxContainer.new() + var column := FitColumn.new(8) column.custom_minimum_size = Vector2(WIDTH, 0) - column.add_theme_constant_override(&"separation", 8) + column.outer_margin = 48.0 + panel.get_theme_stylebox(&"panel").get_minimum_size().y panel.add_child(column) column.add_child(HudStyle.make_label(11, HudStyle.ACCENT_COLOR, "THE CONCORD SURVEY")) _heading = HudStyle.make_label(26, HudStyle.TEXT_COLOR, "Save") column.add_child(_heading) _rows = VBoxContainer.new() _rows.add_theme_constant_override(&"separation", 6) - column.add_child(_rows) + column.add_scroll(_rows) for slot: StringName in SaveSlots.slots(): var button: Button = HudStyle.make_small_button("") button.custom_minimum_size = Vector2(WIDTH, 46) diff --git a/game/ui/subtitle_line.gd b/game/ui/subtitle_line.gd index 6f891f51..317bdfa0 100644 --- a/game/ui/subtitle_line.gd +++ b/game/ui/subtitle_line.gd @@ -11,7 +11,7 @@ const MIN_SECONDS: float = 1.5 const MAX_SECONDS: float = 8.0 const MAX_WAITING: int = 3 ## Pixels from the bottom of the screen to the band's bottom: above the command card. -const BOTTOM_GAP: float = 236.0 +const BOTTOM_GAP: float = 256.0 const FONT_SIZES: Dictionary[StringName, int] = {&"normal": 16, &"large": 22} ## The widest the text runs before it wraps. const MAX_TEXT_WIDTH: float = 680.0 diff --git a/tools/web_tests/deployment.spec.cjs b/tools/web_tests/deployment.spec.cjs index 741eae92..880606c0 100644 --- a/tools/web_tests/deployment.spec.cjs +++ b/tools/web_tests/deployment.spec.cjs @@ -32,7 +32,7 @@ if (process.env.WEB_DEPLOYMENT_URL && !process.env.WEB_DEPLOYMENT_PUBLIC_ONLY) { const landing = page.waitForEvent('console', { predicate: entry => entry.text().includes('kessel_proving: 18 resource nodes and the bases placed'), timeout: 90000, }); - await page.mouse.click(850, 522, { delay: 80 }); + await page.mouse.click(850, 572, { delay: 80 }); await landing; await page.mouse.click(580, 385, { delay: 80 }); expect(await page.evaluate(() => window.farlanding.errors)).toEqual([]); diff --git a/tools/web_tests/game.spec.cjs b/tools/web_tests/game.spec.cjs index 24e2f416..735660d9 100644 --- a/tools/web_tests/game.spec.cjs +++ b/tools/web_tests/game.spec.cjs @@ -66,7 +66,7 @@ test('release starts on WebGL2 and uses real menu input', async ({ page }, info) await page.screenshot({ path: info.outputPath('release-menu.png') }); await page.mouse.click(600, 285, { delay: 80 }); const landing = page.waitForEvent('console', { predicate: entry => entry.text().includes('kessel_proving: 18 resource nodes and the bases placed'), timeout: 90000 }); - await page.mouse.click(850, 522, { delay: 80 }); + await page.mouse.click(850, 572, { delay: 80 }); await landing; await page.mouse.click(580, 385, { delay: 80 }); await page.screenshot({ path: info.outputPath('release-landing.png') });