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>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SlovakTranslation
|
||||
{
|
||||
@@ -68,14 +67,5 @@ namespace SlovakTranslation
|
||||
SlovakFont.ApplyToAll();
|
||||
}
|
||||
|
||||
/// <summary>Labels can be built long after a scene loads, so keep sweeping.</summary>
|
||||
private float _nextSweep;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!SlovakFont.Loaded || Time.unscaledTime < _nextSweep) return;
|
||||
_nextSweep = Time.unscaledTime + 2f;
|
||||
SlovakFont.ApplyToAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user