Table of Contents

Class StbTrueTypeRasterizer

Namespace
Icy.Rendering.Fonts
Assembly
IcyUI.dll

Represents a glyph rasterizer that uses StbTrueTypeSharp for TrueType font rendering.

public class StbTrueTypeRasterizer : IGlyphRasterizer, IDisposable
Inheritance
StbTrueTypeRasterizer
Implements
Inherited Members
Extension Methods

Constructors

StbTrueTypeRasterizer(byte[])

Initializes a new instance of the StbTrueTypeRasterizer class.

public StbTrueTypeRasterizer(byte[] fontData)

Parameters

fontData byte[]

The font data.

Methods

ContainsGlyph(int)

Checks if the character is supported in this font.

public bool ContainsGlyph(int codepoint)

Parameters

codepoint int

Unicode character codepoint to check.

Returns

bool

true if the character with the specified codepoint is supported by this font instance; otherwise false.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Performs internal resources clean-up operations.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Indicates whether the disposing was initialized by user or finalizer.

~StbTrueTypeRasterizer()

Finalizes an instance of the StbTrueTypeRasterizer class.

protected ~StbTrueTypeRasterizer()

Remarks

This rasterizer uses C STB_TrueType library which needs manual font data release.

GetFontMetrics(float, FontStyle)

Gets metrics for the font with the specified font size.

public FontMetrics GetFontMetrics(float fontSize, FontStyle style)

Parameters

fontSize float

Expected font size in points to calculate scaled metrics for.

style FontStyle

The style of the font to use.

Returns

FontMetrics

An instance of the FontMetrics struct with font calculated metrics.

GetGlyphMetrics(int, float, FontStyle)

Gets the metrics for a glyph at the specified size and style.

public FontGlyph GetGlyphMetrics(int codepoint, float size, FontStyle style)

Parameters

codepoint int

The Unicode codepoint of the glyph.

size float

The size of the glyph in pixels.

style FontStyle

The style of the font.

Returns

FontGlyph

The metrics for the glyph.

GetKerning(int, int, float, FontStyle)

Gets the kerning between two glyphs.

public float GetKerning(int first, int second, float size, FontStyle style)

Parameters

first int

First glyph codepoint.

second int

Second glyph codepoint.

size float

Font size.

style FontStyle

Font style.

Returns

float

The kerning value in pixels.

RasterizeGlyph(int, float, FontStyle)

Rasterizes a glyph at the specified size and style.

public IMemoryOwner<byte>? RasterizeGlyph(int codepoint, float size, FontStyle style)

Parameters

codepoint int

The Unicode codepoint of the glyph to rasterize.

size float

The size of the glyph in pixels.

style FontStyle

The style of the glyph.

Returns

IMemoryOwner<byte>

The rasterized glyph pixels byte sequence.