mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fulfill BuildLookupTable preconditions (#1507)
This commit is contained in:
parent
e5e9622974
commit
f60e7b7a86
3 changed files with 21 additions and 3 deletions
|
|
@ -169,7 +169,7 @@ internal class GameFontManager : IServiceType
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rebuildLookupTable && fontPtr.Glyphs.Size > 0)
|
if (rebuildLookupTable && fontPtr.Glyphs.Size > 0)
|
||||||
fontPtr.BuildLookupTable();
|
fontPtr.BuildLookupTableNonstandard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1028,7 +1028,7 @@ internal class InterfaceManager : IDisposable, IServiceType
|
||||||
if (font.FindGlyphNoFallback(Fallback1Codepoint).NativePtr != null)
|
if (font.FindGlyphNoFallback(Fallback1Codepoint).NativePtr != null)
|
||||||
font.FallbackChar = Fallback1Codepoint;
|
font.FallbackChar = Fallback1Codepoint;
|
||||||
|
|
||||||
font.BuildLookupTable();
|
font.BuildLookupTableNonstandard();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Verbose("[FONT] Invoke OnAfterBuildFonts");
|
Log.Verbose("[FONT] Invoke OnAfterBuildFonts");
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,25 @@ public static class ImGuiHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rebuildLookupTable && target.Value!.Glyphs.Size > 0)
|
if (rebuildLookupTable && target.Value!.Glyphs.Size > 0)
|
||||||
target.Value!.BuildLookupTable();
|
target.Value!.BuildLookupTableNonstandard();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call ImFont::BuildLookupTable, after attempting to fulfill some preconditions.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="font">The font.</param>
|
||||||
|
public static unsafe void BuildLookupTableNonstandard(this ImFontPtr font)
|
||||||
|
{
|
||||||
|
// ImGui resolves ' ' with FindGlyph, which uses FallbackGlyph.
|
||||||
|
// FallbackGlyph is resolved after resolving ' '.
|
||||||
|
// On the first call of BuildLookupTable, called from BuildFonts, FallbackGlyph is set to null,
|
||||||
|
// making FindGlyph return nullptr.
|
||||||
|
// On our secondary calls of BuildLookupTable, FallbackGlyph is set to some value that is not null,
|
||||||
|
// making ImGui attempt to treat whatever was there as a ' '.
|
||||||
|
// This may cause random glyphs to be sized randomly, if not an access violation exception.
|
||||||
|
font.NativePtr->FallbackGlyph = null;
|
||||||
|
|
||||||
|
font.BuildLookupTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue