Struct SafeFontConfig
Managed version of Dalamud.Bindings.ImGui.ImFontConfig, to avoid unnecessary heap allocation and use of unsafe blocks.
Assembly: Dalamud.dllβ
public struct SafeFontConfig
Propertiesβ
FontNoβ
Gets or sets the font face index within a TrueType Collection (TTC) file.
public int FontNo { get; set; }
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.
SizePxβ
Gets or sets the desired size of the new font, in pixels.
Effectively, this is the line height.
Value is tied with Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.SizePt.
public float SizePx { get; set; }
SizePtβ
Gets or sets the desired size of the new font, in points.
Effectively, this is the line height.
Value is tied with Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.SizePx.
public float SizePt { get; set; }
OversampleHβ
Gets or sets the horizontal oversampling pixel count.
Rasterize at higher quality for sub-pixel positioning.
Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory.
Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
public int OversampleH { get; set; }
OversampleVβ
Gets or sets the vertical oversampling pixel count.
Rasterize at higher quality for sub-pixel positioning.
This is not really useful as we don't use sub-pixel positions on the Y axis.
public int OversampleV { get; set; }
PixelSnapHβ
Gets or sets a value indicating whether to align every glyph to pixel boundary.
Useful e.g. if you are merging a non-pixel aligned font with the default font.
If enabled, you can set Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.OversampleH and Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.OversampleV to 1.
public bool PixelSnapH { get; set; }
GlyphExtraSpacingβ
Gets or sets the extra spacing (in pixels) between glyphs.
Only X axis is supported for now.
Effectively, it is the letter spacing.
public Vector2 GlyphExtraSpacing { get; set; }
GlyphOffsetβ
Gets or sets the offset all glyphs from this font input.
Use this to offset fonts vertically when merging multiple fonts.
public Vector2 GlyphOffset { get; set; }
GlyphRangesβ
Gets or sets the glyph ranges, which is a user-provided list of Unicode range. Each range has 2 values, and values are inclusive.
The list must be zero-terminated.
If empty or null, then all the glyphs from the font that is in the range of UCS-2 will be added.
public ushort[]? GlyphRanges { readonly get; set; }
GlyphMinAdvanceXβ
Gets or sets the minimum AdvanceX for glyphs.
Set only Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphMinAdvanceX to align font icons.
Set both Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphMinAdvanceX/Dalamud.Interface.ManagedFontAtlas.SafeFontConfig.GlyphMaxAdvanceX to enforce mono-space font.
public float GlyphMinAdvanceX { get; set; }
GlyphMaxAdvanceXβ
Gets or sets the maximum AdvanceX for glyphs.
public float GlyphMaxAdvanceX { get; set; }
RasterizerMultiplyβ
Gets or sets a value that either brightens (>1.0f) or darkens (<1.0f) the font output.
Brightening small fonts may be a good workaround to make them more readable.
public float RasterizerMultiply { get; set; }
RasterizerGammaβ
Gets or sets the gamma value for fonts.
public float RasterizerGamma { get; set; }
EllipsisCharβ
Gets or sets a value explicitly specifying unicode codepoint of the ellipsis character.
When fonts are being merged first specified ellipsis will be used.
public char EllipsisChar { get; set; }
Nameβ
Gets or sets the desired name of the new font. Names longer than 40 bytes will be partially lost.
public string Name { get; set; }
MergeFontβ
Gets or sets the desired font to merge with, if set.
public ImFontPtr MergeFont { get; set; }
Fieldsβ
Rawβ
The raw config.
public ImFontConfigPtr Raw
Methodsβ
ThrowOnInvalidValues()β
Throws System.ArgumentException with appropriate messages,
if this Dalamud.Interface.ManagedFontAtlas.SafeFontConfig has invalid values.
public readonly void ThrowOnInvalidValues()