fix(fonts): broaden font fallback catch to handle atlas-toolkit throws (G2)

The atlas-toolkit pipeline can throw InvalidOperationException or
ArgumentException when a configured font is structurally broken (e.g.
unreadable header, unsupported glyph table). Previously only IO-shaped
throws routed to the NotoSansCjkRegular fallback, so a corrupt font
config would take down the entire atlas build instead of degrading
gracefully. The warning log now carries the exception type name so the
diagnostic path can tell which class of throw triggered the fallback.
This commit is contained in:
2026-05-12 17:19:28 +02:00
parent df3d5d78d6
commit b9d3ff8f26
+12 -2
View File
@@ -226,11 +226,21 @@ public class FontManager
return fontId.AddToBuildToolkit(tk, config); return fontId.AddToBuildToolkit(tk, config);
} }
catch (Exception e) catch (Exception e)
when (e is FileNotFoundException or DirectoryNotFoundException or IOException) when (e
is FileNotFoundException
or DirectoryNotFoundException
or IOException
or InvalidOperationException
or ArgumentException
)
{ {
// Atlas-toolkit throws span IO and validation failures; routing the
// wider set through the fallback keeps a corrupt font config from
// taking down the whole atlas build.
Plugin.Log.Warning( Plugin.Log.Warning(
e, e,
$"Configured {slot} font unavailable, falling back to NotoSansCjkRegular" $"Configured {slot} font failed to load ({e.GetType().Name}), "
+ "falling back to NotoSansCjkRegular"
); );
var fallback = new DalamudAssetFontAndFamilyId(DalamudAsset.NotoSansCjkRegular); var fallback = new DalamudAssetFontAndFamilyId(DalamudAsset.NotoSansCjkRegular);
return fallback.AddToBuildToolkit(tk, config); return fallback.AddToBuildToolkit(tk, config);