Skip to main content

Interface IFontAtlasBuildToolkitPreBuild

Toolkit for use when the build state is Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildStep.PreBuild.

Not intended for plugins to implement.

After Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildStepDelegate returns, either Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font must be set, or at least one font must have been added to the atlas using one of AddFont... functions.

Assembly: Dalamud.dll
View Source
Declaration
public interface IFontAtlasBuildToolkitPreBuild : IFontAtlasBuildToolkit

Methods

DisposeAfterBuild<T>(T)

Queues an item to be disposed after the whole build process gets complete, successful or not.

View Source
Declaration
T DisposeAfterBuild<T>(T disposable) where T : IDisposable
Returns

<T>: The same <code class="paramref">disposable</code>.

Parameters
TypeNameDescription
<T>disposableThe disposable.
Type Parameters
NameDescription
TDisposable type.

DisposeAfterBuild(GCHandle)

Queues an item to be disposed after the whole build process gets complete, successful or not.

View Source
Declaration
GCHandle DisposeAfterBuild(GCHandle gcHandle)
Returns

System.Runtime.InteropServices.GCHandle: The same <code class="paramref">gcHandle</code>.

Parameters
TypeNameDescription
System.Runtime.InteropServices.GCHandlegcHandleThe gc handle.

DisposeAfterBuild(Action)

Queues an item to be disposed after the whole build process gets complete, successful or not.

View Source
Declaration
void DisposeAfterBuild(Action action)
Parameters
TypeNameDescription
System.ActionactionThe action to run on dispose.

SetFontScaleMode(ImFontPtr, FontScaleMode)

Sets the scaling mode for the given font.

View Source
Declaration
ImFontPtr SetFontScaleMode(ImFontPtr fontPtr, FontScaleMode mode)
Returns

ImGuiNET.ImFontPtr: <code class="paramref">fontPtr</code>.

Parameters
TypeNameDescription
ImGuiNET.ImFontPtrfontPtrThe font, returned from Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuild.AddFontFromFile(System.String%2cDalamud.Interface.ManagedFontAtlas.SafeFontConfig%40) and alike.
Note that [Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font](../../Dalamud.Interface.ManagedFontAtlas/Interfaces/IFontAtlasBuildToolkit#font) property is not guaranteed to be automatically updated upon
calling font adding functions. Pass the return value from font adding functions, not
[Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font](../../Dalamud.Interface.ManagedFontAtlas/Interfaces/IFontAtlasBuildToolkit#font) property. |

| Dalamud.Interface.ManagedFontAtlas.FontScaleMode | mode | The scaling mode. |

GetFontScaleMode(ImFontPtr)

Gets the scaling mode for the given font.

View Source
Declaration
FontScaleMode GetFontScaleMode(ImFontPtr fontPtr)
Returns

Dalamud.Interface.ManagedFontAtlas.FontScaleMode: The scaling mode.

Parameters
TypeNameDescription
ImGuiNET.ImFontPtrfontPtrThe font.

RegisterPostBuild(Action)

Registers a function to be run after build.

View Source
Declaration
void RegisterPostBuild(Action action)
Parameters
TypeNameDescription
System.ActionactionThe action to run.

AddFontFromImGuiHeapAllocatedMemory(nint, int, in SafeFontConfig, bool, string)

Adds a font from memory region allocated using Dalamud.Interface.Utility.ImGuiHelpers.AllocateMemory(int).

<b>It WILL crash if you try to use a memory pointer allocated in some other way.</b>

<b> Do NOT call ImGuiNET.ImGuiNative.igMemFree(void*) on the <code class="paramref">dataPointer</code> once this function has been called, unless <code class="paramref">freeOnException</code> is set and the function has thrown an error. </b>

View Source
Declaration
ImFontPtr AddFontFromImGuiHeapAllocatedMemory(nint dataPointer, int dataSize, in SafeFontConfig fontConfig, bool freeOnException, string debugTag)
Returns

ImGuiNET.ImFontPtr: The newly added font.

Parameters
TypeNameDescription
System.IntPtrdataPointerMemory address for the data allocated using Dalamud.Interface.Utility.ImGuiHelpers.AllocateMemory(int).
System.Int32dataSizeThe size of the font file..
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.
System.BooleanfreeOnExceptionFree <code class="paramref">dataPointer</code> if an exception happens.
System.StringdebugTagA debug tag.

AddFontFromImGuiHeapAllocatedMemory(void*, int, in SafeFontConfig, bool, string)

Adds a font from memory region allocated using Dalamud.Interface.Utility.ImGuiHelpers.AllocateMemory(int).

<b>It WILL crash if you try to use a memory pointer allocated in some other way.</b>

<b> Do NOT call ImGuiNET.ImGuiNative.igMemFree(void*) on the <code class="paramref">dataPointer</code> once this function has been called, unless <code class="paramref">freeOnException</code> is set and the function has thrown an error. </b>

View Source
Declaration
ImFontPtr AddFontFromImGuiHeapAllocatedMemory(void* dataPointer, int dataSize, in SafeFontConfig fontConfig, bool freeOnException, string debugTag)
Returns

ImGuiNET.ImFontPtr: The newly added font.

Parameters
TypeNameDescription
System.Void*dataPointerMemory address for the data allocated using Dalamud.Interface.Utility.ImGuiHelpers.AllocateMemory(int).
System.Int32dataSizeThe size of the font file..
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.
System.BooleanfreeOnExceptionFree <code class="paramref">dataPointer</code> if an exception happens.
System.StringdebugTagA debug tag.

AddFontFromFile(string, in SafeFontConfig)

Adds a font from a file.

View Source
Declaration
ImFontPtr AddFontFromFile(string path, in SafeFontConfig fontConfig)
Returns

ImGuiNET.ImFontPtr: The newly added font.

Parameters
TypeNameDescription
System.StringpathThe file path to create a new font from.
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.

AddFontFromStream(Stream, in SafeFontConfig, bool, string)

Adds a font from a stream.

View Source
Declaration
ImFontPtr AddFontFromStream(Stream stream, in SafeFontConfig fontConfig, bool leaveOpen, string debugTag)
Returns

ImGuiNET.ImFontPtr: The newly added font.

Parameters
TypeNameDescription
System.IO.StreamstreamThe stream to create a new font from.
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.
System.BooleanleaveOpenDispose when this function returns or throws.
System.StringdebugTagA debug tag.

AddFontFromMemory(ReadOnlySpan<byte>, in SafeFontConfig, string)

Adds a font from memory.

View Source
Declaration
ImFontPtr AddFontFromMemory(ReadOnlySpan<byte> span, in SafeFontConfig fontConfig, string debugTag)
Returns

ImGuiNET.ImFontPtr: The newly added font.

Parameters
TypeNameDescription
System.ReadOnlySpan<System.Byte>spanThe span to create from.
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.
System.StringdebugTagA debug tag.

AddDalamudDefaultFont(float, ushort[]?)

Adds the default font known to the current font atlas.

Includes Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuild.AddFontAwesomeIconFont(Dalamud.Interface.ManagedFontAtlas.SafeFontConfig%40) and Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuild.AttachExtraGlyphsForDalamudLanguage(Dalamud.Interface.ManagedFontAtlas.SafeFontConfig%40).

As this involves adding multiple fonts, calling this function will set Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font as the return value of this function, if it was empty before.

View Source
Declaration
ImFontPtr AddDalamudDefaultFont(float sizePx, ushort[]? glyphRanges = null)
Returns

ImGuiNET.ImFontPtr: A font returned from ImGuiNET.ImFontAtlasPtr.AddFont(ImGuiNET.ImFontConfigPtr).

Parameters
TypeNameDescription
System.SinglesizePxFont size in pixels.
If a negative value is supplied,
(Dalamud.Interface.UiBuilder.DefaultFontSpec.Dalamud.Interface.FontIdentifier.IFontSpec.SizePx * <code class="paramref">sizePx</code>) will be
used as the font size. Specify -1 to use the default font size.
System.UInt16[]glyphRangesThe glyph ranges. Use Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildToolkitUtilities.ToGlyphRange to build.

AddDalamudAssetFont(DalamudAsset, in SafeFontConfig)

Adds a font that is shipped with Dalamud.

Note: if game symbols font file is requested but is unavailable, then it will take the glyphs from game's built-in fonts, and everything in <code class="paramref">fontConfig</code> will be ignored but Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.SizePx, Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.MergeFont, and Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphRanges.

View Source
Declaration
ImFontPtr AddDalamudAssetFont(DalamudAsset asset, in SafeFontConfig fontConfig)
Returns

ImGuiNET.ImFontPtr: The added font.

Parameters
TypeNameDescription
Dalamud.DalamudAssetassetThe font type.
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.

AddFontAwesomeIconFont(in SafeFontConfig)

Same with Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuild.AddDalamudAssetFont(Dalamud.DalamudAsset%2cDalamud.Interface.ManagedFontAtlas.SafeFontConfig%40)(Dalamud.DalamudAsset.FontAwesomeFreeSolid, ...), but using only FontAwesome icon ranges.

Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphRanges will be ignored.

View Source
Declaration
ImFontPtr AddFontAwesomeIconFont(in SafeFontConfig fontConfig)
Returns

ImGuiNET.ImFontPtr: The added font.

Parameters
TypeNameDescription
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.

AddGameSymbol(in SafeFontConfig)

Adds the game's symbols into the provided font.

Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphRanges will be ignored.

If the game symbol font file is unavailable, only Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.SizePx will be honored.

View Source
Declaration
ImFontPtr AddGameSymbol(in SafeFontConfig fontConfig)
Returns

ImGuiNET.ImFontPtr: The added font.

Parameters
TypeNameDescription
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config.

AddGameGlyphs(GameFontStyle, ushort[]?, ImFontPtr)

Adds the game glyphs to the font.

View Source
Declaration
ImFontPtr AddGameGlyphs(GameFontStyle gameFontStyle, ushort[]? glyphRanges, ImFontPtr mergeFont)
Returns

ImGuiNET.ImFontPtr: The added font.

Parameters
TypeNameDescription
Dalamud.Interface.GameFonts.GameFontStylegameFontStyleThe font style.
System.UInt16[]glyphRangesThe glyph ranges.
ImGuiNET.ImFontPtrmergeFontThe font to merge to. If empty, then a new font will be created.

AttachWindowsDefaultFont(CultureInfo, in SafeFontConfig, int, int, int)

Adds glyphs from the Windows default font for the given culture info into the provided font.

View Source
Declaration
void AttachWindowsDefaultFont(CultureInfo cultureInfo, in SafeFontConfig fontConfig, int weight = 400, int stretch = 5, int style = 0)
Parameters
TypeNameDescription
System.Globalization.CultureInfocultureInfoThe culture info.
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config. If Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.MergeFont is not set, then
[Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font](../../Dalamud.Interface.ManagedFontAtlas/Interfaces/IFontAtlasBuildToolkit#font) will be used as the target. If that is empty too, then it will do
nothing. |

| System.Int32 | weight | The font weight, in range from 1 to 1000. 400 is regular(normal). | | System.Int32 | stretch | The font stretch, in range from 1 to 9. 5 is medium(normal). | | System.Int32 | style | The font style, in range from 0 to 2. 0 is normal. |

AttachExtraGlyphsForDalamudLanguage(in SafeFontConfig)

Adds glyphs of extra languages into the provided font, depending on Dalamud Configuration.

Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphRanges will be ignored.

View Source
Declaration
void AttachExtraGlyphsForDalamudLanguage(in SafeFontConfig fontConfig)
Parameters
TypeNameDescription
Dalamud.Interface.ManagedFontAtlas.SafeFontConfigfontConfigThe font config. If Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.MergeFont is not set, then
[Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font](../../Dalamud.Interface.ManagedFontAtlas/Interfaces/IFontAtlasBuildToolkit#font) will be used as the target. If that is empty too, then it will do
nothing. |

Extension Methods

  • Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildToolkitUtilities.FindConfigPtr(ImGuiNET.ImFontPtr)
  • Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildToolkitUtilities.OnPostBuild(System.Action{Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPostBuild})
  • Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildToolkitUtilities.OnPreBuild(System.Action{Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuild})