Table of Contents

Class RasterOptions

Namespace
KernSmith.Rasterizer
Assembly
KernSmith.dll

Settings for rendering characters: size, DPI, effects, and variable font axes.

public sealed record RasterOptions : IEquatable<RasterOptions>
Inheritance
RasterOptions
Implements
Inherited Members

Properties

AntiAlias

Anti-aliasing mode. Default is grayscale.

public AntiAliasMode AntiAlias { get; init; }

Property Value

AntiAliasMode

Bold

If true, applies bold (native face or synthetic).

public bool Bold { get; init; }

Property Value

bool

ColorFont

If true, render color glyphs (emoji and other multi-color characters).

public bool ColorFont { get; init; }

Property Value

bool

ColorPaletteIndex

Zero-based CPAL color palette index for color fonts. Default is 0.

public int ColorPaletteIndex { get; init; }

Property Value

int

Dpi

DPI for converting points to pixels. Default is 72 (1 point = 1 pixel).

public int Dpi { get; init; }

Property Value

int

EnableHinting

If true, enables font hinting for sharper rendering at small sizes. Default is true.

public bool EnableHinting { get; init; }

Property Value

bool

ForceSyntheticBold

If true, forces synthetic bold even on natively-bold fonts or system font paths.

public bool ForceSyntheticBold { get; init; }

Property Value

bool

ForceSyntheticItalic

If true, forces synthetic italic even on natively-italic fonts or system font paths.

public bool ForceSyntheticItalic { get; init; }

Property Value

bool

Gamma

Gamma correction applied to rasterized coverage/alpha values. Default is 1.8 (matching Hiero), which the FreeType backend treats as the no-op baseline so that default output is unchanged. Only consumed by the FreeType backend; other backends ignore it.

public float Gamma { get; init; }

Property Value

float

Italic

If true, applies italic (native face or synthetic).

public bool Italic { get; init; }

Property Value

bool

Sdf

If true, render as signed distance fields instead of regular bitmaps.

public bool Sdf { get; init; }

Property Value

bool

SdfScale

SDF supersampling scale factor. Higher values render the distance field at a larger size for finer precision. Default is 1 (no scaling). Only consumed by backends that support SDF (e.g., FreeType); other backends ignore it.

public int SdfScale { get; init; }

Property Value

int

SdfSpread

SDF spread (search radius) in pixels. Larger values capture distance information further from the glyph edge. Default is 8 (the FreeType SDF default). Only consumed by backends that support SDF; other backends ignore it.

public float SdfSpread { get; init; }

Property Value

float

Size

Font size in points. Fractional values are supported by all rasterizer backends except GDI, which rounds to the nearest integer pixel size.

public required float Size { get; init; }

Property Value

float

SuperSample

Supersampling factor for higher quality rendering. The rasterizer renders at Size * SuperSample internally and downscales. Default is 1 (no supersampling). BMFont's "aa" setting maps to this value.

public int SuperSample { get; init; }

Property Value

int

VariationAxes

Variable font axis overrides. For example, {"wght", 700} for bold weight.

public Dictionary<string, float>? VariationAxes { get; init; }

Property Value

Dictionary<string, float>

Methods

FromGeneratorOptions(FontGeneratorOptions)

public static RasterOptions FromGeneratorOptions(FontGeneratorOptions options)

Parameters

options FontGeneratorOptions

Returns

RasterOptions