Commit Graph

3 Commits

Author SHA1 Message Date
Jaroslav Beneš 4dabcaa13c Strip the font bundle to 59 KB and replace the polling sweep with a hook
The bundle was built by rewriting the Korean translation mod's asset bundle, so
it still carried everything that mod needed and we did not: three unused font
assets, their materials and textures, and a .resS stream holding two 2048x2048
atlases. Deleted those, dropped the stream, and rewrote m_Container and
m_PreloadTable to reference only the four surviving objects. 862 KB -> 59 KB,
verified by reloading: the embedded font still round-trips as Cabin with full
Slovak coverage and the Gill Sans MT metrics.

The 2s sweep existed to catch labels whose font the game reassigns without any
text change, which happens on a language switch. A postfix on the Text.font
setter catches exactly that, at the moment it happens rather than up to two
seconds later, and costs nothing when idle. Re-entry is safe: our own assignment
fires the hook once, which finds the state already correct and returns.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 21:46:47 +02:00
Jaroslav Beneš 2268334c30 Draw menu carons with the game's own typeface, per font rather than per label
The previous commit claimed this was fixed; it was not. It hooked
UIStyleManager.GetMenuFont, GetTranslatorFont, GetShipLogFont and
GetShipLogCardFont — all four of which are dead code with no callers anywhere in
Assembly-CSharp. Fonts are assigned straight onto the Text components in the
scene data, so nothing the mod did was ever consulted.

Three further things were wrong and are fixed here:

- The language check reflected into the Localization Utility for TryGetLanguage,
  which the installed version does not have, so it could only ever fail. It now
  uses the utility's own definition instead: custom languages are numbered past
  Language.TOTAL. No reflection, nothing to fail silently.
- The substitution was decided per label, from whether that label's own string
  needed a glyph, which left menus mixing two typefaces line by line. It is now
  decided per font: a face that cannot draw Slovak is replaced everywhere it is
  used. Faces that can — Futura PT for dialogue, Space Mono for the translator —
  are still never touched.
- The menu font was assumed to be Gill Sans MT. Logging the fonts actually in
  use showed the menus are Adobe - SerifGothicStd, which had been listed as a
  stylised face to leave alone. Gill Sans is the HUD prompts.

The replacement now prefers the game's own dynamic cut of the same typeface
(Adobe - SerifGothicStd_Dynamic and friends), matched by name prefix so bold
variants resolve too, which keeps the menu looking like vanilla. Bundled Cabin
is the fallback where the game ships no dynamic sibling, and the new
preferGameTypeface setting forces Cabin everywhere.

Hooks are Text.OnEnable, the Text.text setter, TextTranslation.SetLanguage and
scene load, plus a 2s sweep for menus built lazily after all of those.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 21:39:19 +02:00
Jaroslav Beneš 645b8b070b Render Slovak carons in menus and HUD without disturbing the other text
The stock menu font (Gill Sans MT Menu) is a static 243-glyph atlas with no
Latin Extended-A, so "Pokračovať" rendered as "Pokra ova" and "Podrž" as
"Podr". Dialogue, the Nomai translator and the ship log were always fine —
they use Futura PT (663) and Space Mono (612), both of which cover Slovak.

Registering a language font via AddLanguageFont fixes the menus but flips
TextTranslation.IsLanguageLatin() to false, and the game uses that flag to
decide whether dialogue, the translator and the ship log keep their own fonts
or fall back to the language font. So the blanket fix dragged all three onto
the wrong font, oversized and clipping.

Instead: register no language font at all, and postfix only the font getters
(UIStyleManager, PromptManager, GameOverController). Each result goes through
SlovakFont.Fix, which probes the font with Font.HasCharacter and returns it
untouched unless it genuinely cannot draw Slovak — so nothing that already
renders correctly is ever replaced, and the patches are inert in every other
language.

The substitute is Cabin (SIL OFL 1.1), a humanist sans in the Gill Sans
lineage, shipped as a dynamic font with its vertical metrics rewritten to Gill
Sans MT's exact ratios so line height matches and text does not clip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 09:02:56 +02:00