Skip to main content

Interface IFontHandle

Represents a reference counting handle for fonts.

Not intended for plugins to implement.

Assembly: Dalamud.dll
Declaration
public interface IFontHandle : IDisposable

Properties

LoadException

Gets the load exception, if it failed to load. Otherwise, it is null.

Declaration
Exception? LoadException { get; }

Available

Gets a value indicating whether this font is ready for use.

Declaration
bool Available { get; }

Methods

TryLock(out string?)

Attempts to lock the fully constructed instance of Dalamud.Bindings.ImGui.ImFontPtr corresponding to the this Dalamud.Interface.ManagedFontAtlas.IFontHandle, for use in any thread.

Modification of the font will exhibit undefined behavior if some other thread also uses the font.

Declaration
ILockedImFont? TryLock(out string? errorMessage)
Returns

Dalamud.Interface.ManagedFontAtlas.ILockedImFont: An instance of Dalamud.Interface.ManagedFontAtlas.ILockedImFont that <b>must</b> be disposed after use on success; null with <code class="paramref">errorMessage</code> populated on failure.

Parameters
TypeNameDescription
System.StringerrorMessageThe error message, if any.

Lock()

Locks the fully constructed instance of Dalamud.Bindings.ImGui.ImFontPtr corresponding to the this Dalamud.Interface.ManagedFontAtlas.IFontHandle, for use in any thread.

Modification of the font will exhibit undefined behavior if some other thread also uses the font.

Declaration
ILockedImFont Lock()
Returns

Dalamud.Interface.ManagedFontAtlas.ILockedImFont: An instance of Dalamud.Interface.ManagedFontAtlas.ILockedImFont that <b>must</b> be disposed after use.

Exceptions

System.InvalidOperationException
If Dalamud.Interface.ManagedFontAtlas.IFontHandle.Available is false.

Push()

Pushes the current font into ImGui font stack, if available.

Use Dalamud.Bindings.ImGui.ImGui.GetFont to access the current font.

You may not access the font once you dispose this object.

Declaration
IDisposable Push()
Returns

System.IDisposable: A disposable object that will pop the font on dispose.

Exceptions

System.InvalidOperationException
If called outside the main thread.

Pop()

Pops the font pushed to ImGui using Dalamud.Interface.ManagedFontAtlas.IFontHandle.Push(), cleaning up any extra information as needed.

Declaration
void Pop()

WaitAsync()

Waits for Dalamud.Interface.ManagedFontAtlas.IFontHandle.Available to become true.

Declaration
Task<IFontHandle> WaitAsync()
Returns

System.Threading.Tasks.Task<Dalamud.Interface.ManagedFontAtlas.IFontHandle>: A task containing this Dalamud.Interface.ManagedFontAtlas.IFontHandle.

WaitAsync(CancellationToken)

Waits for Dalamud.Interface.ManagedFontAtlas.IFontHandle.Available to become true.

Declaration
Task<IFontHandle> WaitAsync(CancellationToken cancellationToken)
Returns

System.Threading.Tasks.Task<Dalamud.Interface.ManagedFontAtlas.IFontHandle>: A task containing this Dalamud.Interface.ManagedFontAtlas.IFontHandle.

Parameters
TypeNameDescription
System.Threading.CancellationTokencancellationTokenThe cancellation token.

Events

ImFontChanged

Called when the built instance of Dalamud.Bindings.ImGui.ImFontPtr has been changed.

This event can be invoked outside the main thread.

Declaration
event IFontHandle.ImFontChangedDelegate ImFontChanged
Event Type

Dalamud.Interface.ManagedFontAtlas.IFontHandle.ImFontChangedDelegate