Table of Contents

Class StaticSpriteFont

Namespace
Icy.Rendering.Fonts
Assembly
IcyUI.dll

Represents a static sprite font.

public class StaticSpriteFont : SpriteFont, ISpanDrawableFont, IFont
Inheritance
StaticSpriteFont
Implements
Inherited Members
Extension Methods

Constructors

StaticSpriteFont(FontInfo, ITexture[], IReadOnlyDictionary<CodepointsPair, int>, IEnumerable<FontGlyph>, IFallbackFontResolver?, float)

Initializes a new instance of the StaticSpriteFont class.

public StaticSpriteFont(FontInfo info, ITexture[] atlas, IReadOnlyDictionary<StaticSpriteFont.CodepointsPair, int> kernings, IEnumerable<FontGlyph> glyphs, IFallbackFontResolver? resolver = null, float lineGap = 0)

Parameters

info FontInfo

Info about created font.

atlas ITexture[]

Array of images for the glyph atlases.

kernings IReadOnlyDictionary<StaticSpriteFont.CodepointsPair, int>

Map of kernings for all the defined pairs.

glyphs IEnumerable<FontGlyph>

List of all the glyphs used in the font.

resolver IFallbackFontResolver

An instance of the service that helps with getting glyphs that are not presented in this font.

lineGap float

Recommended spacing between two lines of text.

Properties

EnableKernings

Gets or sets a value indicating whether to use kernings in measuring.

public bool EnableKernings { get; set; }

Property Value

bool

Methods

GetGlyph(int)

Gets the glyph for the specified character codepoint.

public override FontGlyph GetGlyph(int codepoint)

Parameters

codepoint int

Codepoint to get glyph for.

Returns

FontGlyph

Glyph info to use with this font.

Remarks

If the requested codepoint is not found in the font, this method will attempt to return the glyph for DefaultCodepoint. If that also fails, it returns None.

GetKerning(FontGlyph, FontGlyph)

Gets the kerning between two glyphs.

protected override float GetKerning(FontGlyph current, FontGlyph previous)

Parameters

current FontGlyph

Current glyph info.

previous FontGlyph

Previous glyph info.

Returns

float

Kerning value in pixels.

Remarks

Kerning adjusts the spacing between specific pairs of glyphs to improve visual appearance. For example, in "VA", the 'A' might be moved slightly left to tuck under the 'V'.

SupportsCharacter(int)

Checks if a font supports specified codepoint instance.

public override bool SupportsCharacter(int codepoint)

Parameters

codepoint int

The Unicode codepoint for the character to use.

Returns

bool

true if this font instance can render specified character; otherwise false.