Class SingleFontSpec
Represents a user's choice of a single font.
Assembly: Dalamud.dllβ
public record SingleFontSpec : IFontSpec, IEquatable<SingleFontSpec>
Implements:
Dalamud.Interface.FontIdentifier.IFontSpec, System.IEquatable<Dalamud.Interface.FontIdentifier.SingleFontSpec>
Propertiesβ
EqualityContractβ
protected virtual Type EqualityContract { get; }
FontIdβ
Gets the font id.
[JsonProperty]
public required IFontId FontId { get; init; }
SizePxβ
Gets the font size in pixels.
[JsonProperty]
public float SizePx { get; init; }
SizePtβ
Gets the font size in points.
[JsonIgnore]
public float SizePt { get; init; }
LineHeightPxβ
Gets the line height in pixels.
[JsonIgnore]
public float LineHeightPx { get; }
LineHeightβ
Gets the line height ratio to the font size.
[JsonProperty]
public float LineHeight { get; init; }
GlyphOffsetβ
Gets the glyph offset in pixels.
[JsonProperty]
public Vector2 GlyphOffset { get; init; }
LetterSpacingβ
Gets the letter spacing in pixels.
[JsonProperty]
public float LetterSpacing { get; init; }
GlyphRangesβ
Gets the glyph ranges.
[JsonProperty]
public ushort[]? GlyphRanges { get; init; }
FontNoβ
Gets the font face index within a TrueType Collection (TTC) file.
[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.
public string ToLocalizedString(string localeCode)
Returnsβ
System.String: The value.
Parametersβ
| Type | Name | Description |
|---|---|---|
System.String | localeCode | The locale code. Must be in lowercase(invariant). |
ToString()β
public override string ToString()
Returnsβ
System.String
CreateFontHandle(IFontAtlas, FontAtlasBuildStepDelegate?)β
Creates a font handle corresponding to this font specification.
public IFontHandle CreateFontHandle(IFontAtlas atlas, FontAtlasBuildStepDelegate? callback = null)
Returnsβ
Dalamud.Interface.ManagedFontAtlas.IFontHandle: The new font handle.
Parametersβ
| Type | Name | Description |
|---|---|---|
| Dalamud.Interface.ManagedFontAtlas.IFontAtlas | atlas | The atlas to bind this font handle to. |
| Dalamud.Interface.ManagedFontAtlas.FontAtlasBuildStepDelegate | callback | Optional 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.
public ImFontPtr AddToBuildToolkit(IFontAtlasBuildToolkitPreBuild tk, ImFontPtr mergeFont = default)
Returnsβ
Dalamud.Bindings.ImGui.ImFontPtr: The added font.
Parametersβ
| Type | Name | Description |
|---|---|---|
| Dalamud.Interface.ManagedFontAtlas.IFontAtlasBuildToolkitPreBuild | tk | The font build toolkit. |
Dalamud.Bindings.ImGui.ImFontPtr | mergeFont | The font to merge to. |
PrintMembers(StringBuilder)β
protected virtual bool PrintMembers(StringBuilder builder)
Returnsβ
System.Boolean
Parametersβ
| Type | Name |
|---|---|
System.Text.StringBuilder | builder |
GetHashCode()β
public override int GetHashCode()
Returnsβ
System.Int32
Equals(object?)β
public override bool Equals(object? obj)
Returnsβ
System.Boolean
Parametersβ
| Type | Name |
|---|---|
System.Object | obj |
Equals(SingleFontSpec?)β
public virtual bool Equals(SingleFontSpec? other)
Returnsβ
System.Boolean
Parametersβ
| Type | Name |
|---|---|
| Dalamud.Interface.FontIdentifier.SingleFontSpec | other |
Implementsβ
- Dalamud.Interface.FontIdentifier.IFontSpec
System.IEquatable<Dalamud.Interface.FontIdentifier.SingleFontSpec>