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 (GCHandle, int) _gameSymFont;
|
||||||
|
|
||||||
private readonly ImVector _ranges;
|
private readonly ImVector _ranges;
|
||||||
|
private readonly ImVector _jpRange;
|
||||||
private GCHandle _jpRange = GCHandle.Alloc(
|
|
||||||
GlyphRangesJapanese.GlyphRanges,
|
|
||||||
GCHandleType.Pinned
|
|
||||||
);
|
|
||||||
|
|
||||||
private GCHandle _symRange = GCHandle.Alloc(
|
private GCHandle _symRange = GCHandle.Alloc(
|
||||||
new ushort[] {
|
new ushort[] {
|
||||||
|
@ -74,11 +70,42 @@ internal sealed class PluginUi : IDisposable {
|
||||||
MergeMode = true,
|
MergeMode = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
|
void BuildRange(out ImVector result, IReadOnlyList<ushort>? chars, params IntPtr[] ranges) {
|
||||||
builder.AddRanges(ImGui.GetIO().Fonts.GetGlyphRangesDefault());
|
var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
|
||||||
builder.AddText("←→↑↓《》■※☀★★☆♥♡ヅツッシ☀☁☂℃℉°♀♂♠♣♦♣♧®©™€$£♯♭♪✓√◎◆◇♦■□〇●△▽▼▲‹›≤≥<«“”─\~Œœ");
|
// text
|
||||||
builder.BuildRanges(out this._ranges);
|
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();
|
this.SetUpUserFonts();
|
||||||
|
|
||||||
var gameSym = File.ReadAllBytes(Path.Combine(this.Plugin.Interface.DalamudAssetDirectory.FullName, "UIRes", "gamesym.ttf"));
|
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._italicFont.Item1.Free();
|
||||||
this._gameSymFont.Item1.Free();
|
this._gameSymFont.Item1.Free();
|
||||||
this._symRange.Free();
|
this._symRange.Free();
|
||||||
this._jpRange.Free();
|
|
||||||
this._fontCfg.Destroy();
|
this._fontCfg.Destroy();
|
||||||
this._fontCfgMerge.Destroy();
|
this._fontCfgMerge.Destroy();
|
||||||
}
|
}
|
||||||
|
@ -242,7 +268,7 @@ internal sealed class PluginUi : IDisposable {
|
||||||
this._jpFont.Item2,
|
this._jpFont.Item2,
|
||||||
this.Plugin.Config.JapaneseFontSize,
|
this.Plugin.Config.JapaneseFontSize,
|
||||||
this._fontCfgMerge,
|
this._fontCfgMerge,
|
||||||
this._jpRange.AddrOfPinnedObject()
|
this._jpRange.Data
|
||||||
);
|
);
|
||||||
|
|
||||||
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
|
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
|
||||||
|
@ -267,7 +293,7 @@ internal sealed class PluginUi : IDisposable {
|
||||||
this._jpFont.Item2,
|
this._jpFont.Item2,
|
||||||
this.Plugin.Config.JapaneseFontSize,
|
this.Plugin.Config.JapaneseFontSize,
|
||||||
this._fontCfgMerge,
|
this._fontCfgMerge,
|
||||||
this._jpRange.AddrOfPinnedObject()
|
this._jpRange.Data
|
||||||
);
|
);
|
||||||
|
|
||||||
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
|
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user