Skip to main content

Struct SafeFontConfig

Managed version of ImGuiNET.ImFontConfig, to avoid unnecessary heap allocation and use of unsafe blocks.

Assembly: Dalamud.dll
View Source
Declaration
public struct SafeFontConfig

Properties

FontNo

Gets or sets the index of font within a TTF/OTF file.

View Source
Declaration
public int FontNo { get; set; }

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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
public float GlyphMinAdvanceX { get; set; }

GlyphMaxAdvanceX

Gets or sets the maximum AdvanceX for glyphs.

View Source
Declaration
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.

View Source
Declaration
public float RasterizerMultiply { get; set; }

RasterizerGamma

Gets or sets the gamma value for fonts.

View Source
Declaration
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.

View Source
Declaration
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.

View Source
Declaration
public string Name { get; set; }

MergeFont

Gets or sets the desired font to merge with, if set.

View Source
Declaration
public ImFontPtr MergeFont { get; set; }

Fields

Raw

The raw config.

View Source
Declaration
public ImFontConfig Raw

Methods

ThrowOnInvalidValues()

Throws System.ArgumentException with appropriate messages, if this Dalamud.Interface.ManagedFontAtlas.SafeFontConfig has invalid values.

View Source
Declaration
public readonly void ThrowOnInvalidValues()