Bundle the cross-platform interface font

This commit is contained in:
josh
2026-11-27 20:53:46 -05:00
parent ba7902dd5e
commit 75afa1c194
5 changed files with 29 additions and 1 deletions

Binary file not shown.

View File

@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 28a61adae8abf17e79c80cd8bb272cd6
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Liberation Sans
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
subsetRecipes: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -132,7 +132,7 @@ namespace Soundings
private static void Stepper(VisualElement parent, string value, string id, Action minus, Action plus, bool canMinus, bool canPlus) private static void Stepper(VisualElement parent, string value, string id, Action minus, Action plus, bool canMinus, bool canPlus)
{ {
var stepper = Add(parent, "stepper"); var stepper = Add(parent, "stepper");
Button down = Action("−", minus, "step", id + "-minus"); Button down = Action("-", minus, "step", id + "-minus");
down.tooltip = id == "fare" ? "Lower passenger fare by $50" : "Buy 10 fewer tons"; down.tooltip = id == "fare" ? "Lower passenger fare by $50" : "Buy 10 fewer tons";
down.SetEnabled(canMinus); down.SetEnabled(canMinus);
stepper.Add(down); stepper.Add(down);

View File

@@ -8,6 +8,7 @@ namespace Soundings
{ {
private const string SaveKey = "soundings.company.v1"; private const string SaveKey = "soundings.company.v1";
private static readonly string[] Pages = { "Operations", "Deck plans", "Shipyard", "Ports", "Finance" }; private static readonly string[] Pages = { "Operations", "Deck plans", "Shipyard", "Ports", "Finance" };
private static FontDefinition interfaceFont;
private Company company; private Company company;
private Harbor harbor; private Harbor harbor;
private PanelSettings panel; private PanelSettings panel;
@@ -39,6 +40,7 @@ namespace Soundings
harbor = gameObject.AddComponent<Harbor>(); harbor = gameObject.AddComponent<Harbor>();
harbor.Initialize(); harbor.Initialize();
displayFont = Resources.Load<Font>("Display"); displayFont = Resources.Load<Font>("Display");
interfaceFont = FontDefinition.FromFont(Resources.Load<Font>("Interface"));
panel = ScriptableObject.CreateInstance<PanelSettings>(); panel = ScriptableObject.CreateInstance<PanelSettings>();
panel.scaleMode = PanelScaleMode.ScaleWithScreenSize; panel.scaleMode = PanelScaleMode.ScaleWithScreenSize;
panel.referenceResolution = new Vector2Int(1440, 810); panel.referenceResolution = new Vector2Int(1440, 810);
@@ -49,6 +51,7 @@ namespace Soundings
document.panelSettings = panel; document.panelSettings = panel;
root = document.rootVisualElement; root = document.rootVisualElement;
root.style.flexGrow = 1; root.style.flexGrow = 1;
root.style.unityFontDefinition = interfaceFont;
root.styleSheets.Add(Resources.Load<StyleSheet>("Soundings")); root.styleSheets.Add(Resources.Load<StyleSheet>("Soundings"));
company = autoSmoke ? null : Load(); company = autoSmoke ? null : Load();
Render(); Render();
@@ -406,6 +409,7 @@ namespace Soundings
private static Label Text(string value, string classes) private static Label Text(string value, string classes)
{ {
var label = new Label(value) { pickingMode = PickingMode.Ignore }; var label = new Label(value) { pickingMode = PickingMode.Ignore };
label.style.unityFontDefinition = interfaceFont;
Classes(label, classes); Classes(label, classes);
return label; return label;
} }
@@ -427,6 +431,7 @@ namespace Soundings
private static Button Action(string text, Action clicked, string classes = "", string id = null) private static Button Action(string text, Action clicked, string classes = "", string id = null)
{ {
var button = new Button(clicked) { text = text, name = id ?? text }; var button = new Button(clicked) { text = text, name = id ?? text };
button.style.unityFontDefinition = interfaceFont;
Classes(button, "action " + classes); Classes(button, "action " + classes);
return button; return button;
} }

View File

@@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<title>{{{ PRODUCT_NAME }}}</title> <title>{{{ PRODUCT_NAME }}}</title>
<style> <style>
* { box-sizing: border-box; } * { box-sizing: border-box; }