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
EffectiveSdfMode
public SdfMode EffectiveSdfMode { get; }
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
ItalicAngle
Slant of synthetic italic in degrees from vertical, positive leaning right. Default 12, which every backend applies its own way. Only consumed by backends that report SupportsItalicAngle; the pipeline never sends another value with Italic to any other backend.
public float ItalicAngle { get; init; }
Property Value
LcdFilter
The low-pass filter for Lcd. Default is Default (the backend's choice). Only consumed by backends that render subpixel output (Native); others ignore it.
public LcdFilter LcdFilter { get; init; }
Property Value
LcdSubpixelOrder
The display's subpixel layout for Lcd. Default is Rgb. Only consumed by backends that render subpixel output (Native); others ignore it.
public LcdSubpixelOrder LcdSubpixelOrder { get; init; }
Property Value
Sdf
If true, render single-channel signed distance fields instead of regular bitmaps. FromGeneratorOptions(FontGeneratorOptions) sets it exactly when the effective mode is Sdf, so a backend that predates SdfMode can keep reading this flag alone.
public bool Sdf { get; init; }
Property Value
SdfMode
The distance field to render. When None, Sdf decides; backends should switch on EffectiveSdfMode.
public SdfMode SdfMode { 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. KernSmith core hands a backend 1 whenever the effective mode is Lcd: LCD renders at the final size.
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
WidthPercent
Horizontal scale of every outline and advance as a percentage (condensed below 100, expanded above). Default 100. Only consumed by backends that report SupportsWidthScale; the pipeline never sends another value to any other backend.
public int WidthPercent { get; init; }
Property Value
Methods
FromGeneratorOptions(FontGeneratorOptions)
Creates a RasterOptions from a FontGeneratorOptions.
public static RasterOptions FromGeneratorOptions(FontGeneratorOptions options)
Parameters
optionsFontGeneratorOptions