Bundle the Hellion icon and Exo 2 font
Replace the inherited Chat 2 icon with the 1024×1024 Hellion logo from the Hellion Online Media brand assets so the plugin shows its real identity in Dalamud's plugin list. Bundle Exo 2 Variable (SIL Open Font License 1.1) as an embedded resource together with the OFL license text — keeps the license travelling with the font inside the assembly as the OFL requires. A new Configuration.UseHellionFont (default true) plus a checkbox in the Privacy tab Appearance section route FontManager's regular font handle through tk.AddFontFromMemory using the embedded TTF bytes when the toggle is on; flipping it off falls back to the existing AddFontWithFallback path so users who picked their own system font under Settings → Fonts keep that choice. Settings.cs now treats UseHellionFont as a font-changing setting so toggling it triggers FontManager.BuildFonts on save without needing a plugin reload.
This commit is contained in:
+24
-1
@@ -49,6 +49,27 @@ public class FontManager
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backing bytes for the bundled Hellion font (Exo 2, OFL-1.1). Lazily
|
||||
/// extracted from the assembly's manifest resources on first use; the
|
||||
/// load happens inside the font atlas build callback so we keep the
|
||||
/// allocation off the plugin constructor's hot path.
|
||||
/// </summary>
|
||||
private static byte[]? HellionFontBytes;
|
||||
|
||||
private static byte[] GetHellionFontBytes()
|
||||
{
|
||||
if (HellionFontBytes is not null)
|
||||
return HellionFontBytes;
|
||||
|
||||
using var stream = typeof(FontManager).Assembly.GetManifestResourceStream("HellionFont.ttf")
|
||||
?? throw new FileNotFoundException("Hellion font resource not embedded in the assembly");
|
||||
using var ms = new MemoryStream();
|
||||
stream.CopyTo(ms);
|
||||
HellionFontBytes = ms.ToArray();
|
||||
return HellionFontBytes;
|
||||
}
|
||||
|
||||
private unsafe void SetUpRanges()
|
||||
{
|
||||
ushort[] BuildRange(IReadOnlyList<ushort>? chars, params nint[] ranges)
|
||||
@@ -121,7 +142,9 @@ public class FontManager
|
||||
tk =>
|
||||
{
|
||||
var config = new SafeFontConfig {SizePt = Plugin.Config.GlobalFontV2.SizePt, GlyphRanges = Ranges};
|
||||
config.MergeFont = AddFontWithFallback(tk, Plugin.Config.GlobalFontV2.FontId, config, "global");
|
||||
config.MergeFont = Plugin.Config.UseHellionFont
|
||||
? tk.AddFontFromMemory(GetHellionFontBytes(), config, "Hellion-Exo2")
|
||||
: AddFontWithFallback(tk, Plugin.Config.GlobalFontV2.FontId, config, "global");
|
||||
|
||||
config.SizePt = Plugin.Config.JapaneseFontV2.SizePt;
|
||||
config.GlyphRanges = JpRange;
|
||||
|
||||
Reference in New Issue
Block a user