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
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
T DisposeAfterBuild<T>(T disposable) where T : IDisposable
Returns
<T>
: The same <code class="paramref">disposable</code>.
Parameters
Type | Name | Description |
---|---|---|
<T> | disposable | The disposable. |
Type Parameters
Name | Description |
---|---|
T | Disposable type. |
DisposeAfterBuild(GCHandle)
Queues an item to be disposed after the whole build process gets complete, successful or not.
View Source
GCHandle DisposeAfterBuild(GCHandle gcHandle)
Returns
System.Runtime.InteropServices.GCHandle
: The same <code class="paramref">gcHandle</code>.
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.InteropServices.GCHandle | gcHandle | The gc handle. |
DisposeAfterBuild(Action)
Queues an item to be disposed after the whole build process gets complete, successful or not.
View Source
void DisposeAfterBuild(Action action)
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | The action to run on dispose. |
SetFontScaleMode(ImFontPtr, FontScaleMode)
Sets the scaling mode for the given font.
View Source
ImFontPtr SetFontScaleMode(ImFontPtr fontPtr, FontScaleMode mode)
Returns
ImGuiNET.ImFontPtr: <code class="paramref">fontPtr</code>.
Parameters
Type | Name | Description |
---|---|---|
ImGuiNET.ImFontPtr | fontPtr | The 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
FontScaleMode GetFontScaleMode(ImFontPtr fontPtr)
Returns
Dalamud.Interface.ManagedFontAtlas.FontScaleMode: The scaling mode.
Parameters
Type | Name | Description |
---|---|---|
ImGuiNET.ImFontPtr | fontPtr | The font. |
RegisterPostBuild(Action)
Registers a function to be run after build.
View Source
void RegisterPostBuild(Action action)
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | The 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
ImFontPtr AddFontFromImGuiHeapAllocatedMemory(nint dataPointer, int dataSize, in SafeFontConfig fontConfig, bool freeOnException, string debugTag)
Returns
ImGuiNET.ImFontPtr: The newly added font.
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | dataPointer | Memory address for the data allocated using Dalamud.Interface.Utility.ImGuiHelpers.AllocateMemory(int). |
System.Int32 | dataSize | The size of the font file.. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The font config. |
System.Boolean | freeOnException | Free <code class="paramref">dataPointer</code> if an exception happens. |
System.String | debugTag | A 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
ImFontPtr AddFontFromImGuiHeapAllocatedMemory(void* dataPointer, int dataSize, in SafeFontConfig fontConfig, bool freeOnException, string debugTag)
Returns
ImGuiNET.ImFontPtr: The newly added font.
Parameters
Type | Name | Description |
---|---|---|
System.Void* | dataPointer | Memory address for the data allocated using Dalamud.Interface.Utility.ImGuiHelpers.AllocateMemory(int). |
System.Int32 | dataSize | The size of the font file.. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The font config. |
System.Boolean | freeOnException | Free <code class="paramref">dataPointer</code> if an exception happens. |
System.String | debugTag | A debug tag. |
AddFontFromFile(string, in SafeFontConfig)
Adds a font from a file.
View Source
ImFontPtr AddFontFromFile(string path, in SafeFontConfig fontConfig)
Returns
ImGuiNET.ImFontPtr: The newly added font.
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file path to create a new font from. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The font config. |
AddFontFromStream(Stream, in SafeFontConfig, bool, string)
Adds a font from a stream.
View Source
ImFontPtr AddFontFromStream(Stream stream, in SafeFontConfig fontConfig, bool leaveOpen, string debugTag)
Returns
ImGuiNET.ImFontPtr: The newly added font.
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to create a new font from. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The font config. |
System.Boolean | leaveOpen | Dispose when this function returns or throws. |
System.String | debugTag | A debug tag. |
AddFontFromMemory(ReadOnlySpan<byte>, in SafeFontConfig, string)
Adds a font from memory.
View Source
ImFontPtr AddFontFromMemory(ReadOnlySpan<byte> span, in SafeFontConfig fontConfig, string debugTag)
Returns
ImGuiNET.ImFontPtr: The newly added font.
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | span | The span to create from. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The font config. |
System.String | debugTag | A 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
ImFontPtr AddDalamudDefaultFont(float sizePx, ushort[]? glyphRanges = null)
Returns
ImGuiNET.ImFontPtr: A font returned from ImGuiNET.ImFontAtlasPtr.AddFont(ImGuiNET.ImFontConfigPtr).
Parameters
Type | Name | Description |
---|---|---|
System.Single | sizePx | Font 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[] | glyphRanges | The 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
ImFontPtr AddDalamudAssetFont(DalamudAsset asset, in SafeFontConfig fontConfig)
Returns
ImGuiNET.ImFontPtr: The added font.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.DalamudAsset | asset | The font type. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The 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
ImFontPtr AddFontAwesomeIconFont(in SafeFontConfig fontConfig)
Returns
ImGuiNET.ImFontPtr: The added font.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The 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
ImFontPtr AddGameSymbol(in SafeFontConfig fontConfig)
Returns
ImGuiNET.ImFontPtr: The added font.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The font config. |
AddGameGlyphs(GameFontStyle, ushort[]?, ImFontPtr)
Adds the game glyphs to the font.
View Source
ImFontPtr AddGameGlyphs(GameFontStyle gameFontStyle, ushort[]? glyphRanges, ImFontPtr mergeFont)
Returns
ImGuiNET.ImFontPtr: The added font.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.GameFonts.GameFontStyle | gameFontStyle | The font style. |
System.UInt16[] | glyphRanges | The glyph ranges. |
ImGuiNET.ImFontPtr | mergeFont | The 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
void AttachWindowsDefaultFont(CultureInfo cultureInfo, in SafeFontConfig fontConfig, int weight = 400, int stretch = 5, int style = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | cultureInfo | The culture info. |
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The 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
void AttachExtraGlyphsForDalamudLanguage(in SafeFontConfig fontConfig)
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.ManagedFontAtlas.SafeFontConfig | fontConfig | The 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})