mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
Fix adding supplemental language fonts for GamePrebakedFontHandle
This commit is contained in:
parent
e7c7cdaa29
commit
77536429d6
4 changed files with 55 additions and 13 deletions
|
|
@ -1,7 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using Dalamud.Interface.Utility;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.ManagedFontAtlas;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -58,6 +61,25 @@ public static class FontAtlasBuildToolkitUtilities
|
|||
bool addEllipsisCodepoints = true) =>
|
||||
@string.AsSpan().ToGlyphRange(addFallbackCodepoints, addEllipsisCodepoints);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the corresponding <see cref="ImFontConfigPtr"/> in
|
||||
/// <see cref="IFontAtlasBuildToolkit.NewImAtlas"/>.<see cref="ImFontAtlasPtr.ConfigData"/> that corresponds to the
|
||||
/// specified font <paramref name="fontPtr"/>.
|
||||
/// </summary>
|
||||
/// <param name="toolkit">The toolkit.</param>
|
||||
/// <param name="fontPtr">The font.</param>
|
||||
/// <returns>The relevant config pointer, or empty config pointer if not found.</returns>
|
||||
public static unsafe ImFontConfigPtr FindConfigPtr(this IFontAtlasBuildToolkit toolkit, ImFontPtr fontPtr)
|
||||
{
|
||||
foreach (ref var c in toolkit.NewImAtlas.ConfigDataWrapped().DataSpan)
|
||||
{
|
||||
if (c.DstFont == fontPtr.NativePtr)
|
||||
return new((nint)Unsafe.AsPointer(ref c));
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes <paramref name="action"/>
|
||||
/// if <see cref="IFontAtlasBuildToolkit.BuildStep"/> of <paramref name="toolkit"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue