Skip to main content
Version: 14.x (API 14) [Legacy]

Class SingleFontSpec

Represents a user's choice of a single font.

Assembly: Dalamud.dll
Declaration
public record SingleFontSpec : IFontSpec, IEquatable<SingleFontSpec>

Implements:
Dalamud.Interface.FontIdentifier.IFontSpec, System.IEquatable<Dalamud.Interface.FontIdentifier.SingleFontSpec>

Properties

EqualityContract

Declaration
protected virtual Type EqualityContract { get; }

FontId

Gets the font id.

Declaration
[JsonProperty]
public required IFontId FontId { get; init; }

SizePx

Gets the font size in pixels.

Declaration
[JsonProperty]
public float SizePx { get; init; }

SizePt

Gets the font size in points.

Declaration
[JsonIgnore]
public float SizePt { get; init; }

LineHeightPx

Gets the line height in pixels.

Declaration
[JsonIgnore]
public float LineHeightPx { get; }

LineHeight

Gets the line height ratio to the font size.

Declaration
[JsonProperty]
public float LineHeight { get; init; }

GlyphOffset

Gets the glyph offset in pixels.

Declaration
[JsonProperty]
public Vector2 GlyphOffset { get; init; }

LetterSpacing

Gets the letter spacing in pixels.

Declaration
[JsonProperty]
public float LetterSpacing { get; init; }

GlyphRanges

Gets the glyph ranges.

Declaration
[JsonProperty]
public ushort[]? GlyphRanges { get; init; }

FontNo

Gets the font face index within a TrueType Collection (TTC) file.

Declaration
[JsonProperty]
public int FontNo { get; init; }
Remarks

This property only applies to Dalamud.DalamudAsset.NotoSansCjkRegular and Dalamud.DalamudAsset.NotoSansCjkMedium, which are TTC fonts bundling multiple language-specific CJK glyph sets (Japanese, Traditional Chinese, Simplified Chinese, Korean) into a single file.

The index corresponds to the font face order in the TTC:

<ul><li>0 = Japanese</li><li>1 = Traditional Chinese</li><li>2 = Simplified Chinese</li><li>3 = Korean</li></ul>

This value is ignored for all other Dalamud.DalamudAsset entries. Only one glyph set can be active at a time. In most cases, you can omit this— Dalamud automatically selects the appropriate face based on the UI language.

Methods

ToLocalizedString(string)

Represents this font specification, preferrably in the requested locale.

Declaration
public string ToLocalizedString(string localeCode)
Returns

System.String: The value.

Parameters
TypeNameDescription
System.StringlocaleCodeThe locale code. Must be in lowercase(invariant).

ToString()

Declaration
public override string ToString()
Returns

System.String

CreateFontHandle(IFontAtlas, FontAtlasBuildStepDelegate?)

Creates a font handle corresponding to this font specification.

Declaration
public IFontHandle CreateFontHandle(IFontAtlas atlas, FontAtlasBuildStepDelegate? callback = null)
Returns

Dalamud.Interface.ManagedFontAtlas.IFontHandle: The new font handle.

Parameters
TypeNameDescription
Dalamud.Interface.ManagedFontAtlas.IFontAtlasatlasThe atlas to bind this font handle to.
Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildStepDelegatecallbackOptional callback to be called after creating the font handle.
Remarks

Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkit.Font will be set when <code class="paramref">callback</code> is invoked.

AddToBuildToolkit(IFontAtlasBuildToolkitPreBuild, ImFontPtr)

Adds this font to the given font build toolkit.

Declaration
public ImFontPtr AddToBuildToolkit(IFontAtlasBuildToolkitPreBuild tk, ImFontPtr mergeFont = default)
Returns

Dalamud.Bindings.ImGui.ImFontPtr: The added font.

Parameters
TypeNameDescription
Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuildtkThe font build toolkit.
Dalamud.Bindings.ImGui.ImFontPtrmergeFontThe font to merge to.

PrintMembers(StringBuilder)

Declaration
protected virtual bool PrintMembers(StringBuilder builder)
Returns

System.Boolean

Parameters
TypeName
System.Text.StringBuilderbuilder

GetHashCode()

Declaration
public override int GetHashCode()
Returns

System.Int32

Equals(object?)

Declaration
public override bool Equals(object? obj)
Returns

System.Boolean

Parameters
TypeName
System.Objectobj

Equals(SingleFontSpec?)

Declaration
public virtual bool Equals(SingleFontSpec? other)
Returns

System.Boolean

Parameters
TypeName
Dalamud.Interface.FontIdentifier.SingleFontSpecother

Implements