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:
@@ -226,11 +226,21 @@ public class FontManager
|
||||
return fontId.AddToBuildToolkit(tk, config);
|
||||
}
|
||||
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(
|
||||
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);
|
||||
return fallback.AddToBuildToolkit(tk, config);
|
||||
|
||||
Reference in New Issue
Block a user