fix: include more glyphs in jp font
This commit is contained in:
parent
4779ed0f48
commit
90d9818f94
|
@ -38,11 +38,7 @@ internal sealed class PluginUi : IDisposable {
|
|||
private (GCHandle, int) _gameSymFont;
|
||||
|
||||
private readonly ImVector _ranges;
|
||||
|
||||
private GCHandle _jpRange = GCHandle.Alloc(
|
||||
GlyphRangesJapanese.GlyphRanges,
|
||||
GCHandleType.Pinned
|
||||
);
|
||||
private readonly ImVector _jpRange;
|
||||
|
||||
private GCHandle _symRange = GCHandle.Alloc(
|
||||
new ushort[] {
|
||||
|
@ -74,11 +70,42 @@ internal sealed class PluginUi : IDisposable {
|
|||
MergeMode = true,
|
||||
};
|
||||
|
||||
var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
|
||||
builder.AddRanges(ImGui.GetIO().Fonts.GetGlyphRangesDefault());
|
||||
builder.AddText("←→↑↓《》■※☀★★☆♥♡ヅツッシ☀☁☂℃℉°♀♂♠♣♦♣♧®©™€$£♯♭♪✓√◎◆◇♦■□〇●△▽▼▲‹›≤≥<«“”─\~Œœ");
|
||||
builder.BuildRanges(out this._ranges);
|
||||
void BuildRange(out ImVector result, IReadOnlyList<ushort>? chars, params IntPtr[] ranges) {
|
||||
var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
|
||||
// text
|
||||
foreach (var range in ranges) {
|
||||
builder.AddRanges(range);
|
||||
}
|
||||
|
||||
// chars
|
||||
if (chars != null) {
|
||||
for (var i = 0; i < chars.Count; i += 2) {
|
||||
if (chars[i] == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (var j = (uint) chars[i]; j <= chars[i + 1]; j++) {
|
||||
builder.AddChar((ushort) j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// various symbols
|
||||
builder.AddText("←→↑↓《》■※☀★★☆♥♡ヅツッシ☀☁☂℃℉°♀♂♠♣♦♣♧®©™€$£♯♭♪✓√◎◆◇♦■□〇●△▽▼▲‹›≤≥<«“”─\~Œœ");
|
||||
|
||||
// "Enclosed Alphanumerics" (partial) https://www.compart.com/en/unicode/block/U+2460
|
||||
for (var i = 0x2460; i <= 0x24B5; i++) {
|
||||
builder.AddChar((char) i);
|
||||
}
|
||||
|
||||
builder.AddChar('⓪');
|
||||
|
||||
builder.BuildRanges(out result);
|
||||
builder.Destroy();
|
||||
}
|
||||
|
||||
BuildRange(out this._ranges, null, ImGui.GetIO().Fonts.GetGlyphRangesDefault());
|
||||
BuildRange(out this._jpRange, GlyphRangesJapanese.GlyphRanges);
|
||||
this.SetUpUserFonts();
|
||||
|
||||
var gameSym = File.ReadAllBytes(Path.Combine(this.Plugin.Interface.DalamudAssetDirectory.FullName, "UIRes", "gamesym.ttf"));
|
||||
|
@ -109,7 +136,6 @@ internal sealed class PluginUi : IDisposable {
|
|||
this._italicFont.Item1.Free();
|
||||
this._gameSymFont.Item1.Free();
|
||||
this._symRange.Free();
|
||||
this._jpRange.Free();
|
||||
this._fontCfg.Destroy();
|
||||
this._fontCfgMerge.Destroy();
|
||||
}
|
||||
|
@ -242,7 +268,7 @@ internal sealed class PluginUi : IDisposable {
|
|||
this._jpFont.Item2,
|
||||
this.Plugin.Config.JapaneseFontSize,
|
||||
this._fontCfgMerge,
|
||||
this._jpRange.AddrOfPinnedObject()
|
||||
this._jpRange.Data
|
||||
);
|
||||
|
||||
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
|
||||
|
@ -267,7 +293,7 @@ internal sealed class PluginUi : IDisposable {
|
|||
this._jpFont.Item2,
|
||||
this.Plugin.Config.JapaneseFontSize,
|
||||
this._fontCfgMerge,
|
||||
this._jpRange.AddrOfPinnedObject()
|
||||
this._jpRange.Data
|
||||
);
|
||||
|
||||
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
|
||||
|
|
Loading…
Reference in New Issue