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
Bold
If true, applies bold (native face or synthetic).
public bool Bold { get; init; }
Property Value
ColorFont
If true, render color glyphs (emoji and other multi-color characters).
public bool ColorFont { get; init; }
Property Value
ColorPaletteIndex
Zero-based CPAL color palette index for color fonts. Default is 0.
public int ColorPaletteIndex { get; init; }
Property Value
Dpi
DPI for converting points to pixels. Default is 72 (1 point = 1 pixel).
public int Dpi { get; init; }
Property Value
EnableHinting
If true, enables font hinting for sharper rendering at small sizes. Default is true.
public bool EnableHinting { get; init; }
Property Value
ForceSyntheticBold
If true, forces synthetic bold even on natively-bold fonts or system font paths.
public bool ForceSyntheticBold { get; init; }
Property Value
ForceSyntheticItalic
If true, forces synthetic italic even on natively-italic fonts or system font paths.
public bool ForceSyntheticItalic { get; init; }
Property Value
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
Italic
If true, applies italic (native face or synthetic).
public bool Italic { get; init; }
Property Value
Sdf
If true, render as signed distance fields instead of regular bitmaps.
public bool Sdf { get; init; }
Property Value
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
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
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
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
VariationAxes
Variable font axis overrides. For example, {"wght", 700} for bold weight.
public Dictionary<string, float>? VariationAxes { get; init; }
Property Value
Methods
FromGeneratorOptions(FontGeneratorOptions)
Creates a RasterOptions from a FontGeneratorOptions.
public static RasterOptions FromGeneratorOptions(FontGeneratorOptions options)
Parameters
optionsFontGeneratorOptions