Table of Contents

FontGeneratorOptions

Namespace: KernSmith

The settings object for the generation pipeline. Every property has a sensible default, so you only set what you need. The fluent builder sets the same properties.

Size, characters, and faces

Property Type Default Description
Size float 32f Font size in pixels. Fractional values are honored by every backend except GDI, which rounds.
Characters CharacterSet CharacterSet.Ascii Which characters to include.
FallbackCharacter char? null Character shown for missing glyphs (BMP only).
FallbackCodepoint int? null Fallback codepoint; supports supplementary plane. Takes precedence over FallbackCharacter.
FaceIndex int 0 Face index for .ttc/.otc collections.
Dpi int 72 Rendering DPI.

Style

Property Type Default Description
Bold bool false Request bold (native when available, else synthetic).
Italic bool false Request italic (native when available, else synthetic).
ForceSyntheticBold bool false Force synthetic bold even when a native bold face exists.
ForceSyntheticItalic bool false Force synthetic italic even when a native italic face exists.
HeightPercent int 100 Vertical height scaling. 150 = 50% taller.
MatchCharHeight bool false Scale so the tallest character matches the requested pixel size.
WidthPercent int 100 Synthetic condensed/expanded width, 10-1000: outlines, advances and kerning. Needs a backend with SupportsWidthScale (Native); other values elsewhere throw NotSupportedException.
ItalicAngle float 12f Synthetic italic slant in degrees, -60-60, positive leans right. Used only when synthetic italic applies; values other than 12 need a backend with SupportsItalicAngle (Native).

Rendering quality

Property Type Default Description
AntiAlias AntiAliasMode Grayscale Anti-aliasing mode: None, Grayscale, Light or Lcd. A backend that does not list Light/Lcd in its SupportedAntiAliasModes renders them as Grayscale; None always passes through.
LcdFilter LcdFilter Default Low-pass filter for Lcd: Default (the backend's choice), Light (one-pixel box), Smooth (five-tap), None. Honored by Native; others ignore it.
LcdSubpixelOrder LcdSubpixelOrder Rgb Display subpixel layout for Lcd: Rgb, Bgr, VRgb, VBgr (vertical panels). Honored by Native; others ignore it.
EnableHinting bool true Enable hinting for crisp small text.
SuperSampleLevel int 1 1-4; renders at Nx and downscales. Cannot combine with Sdf. Skipped for Lcd output on a backend that renders LCD (it renders at the final size).
Sdf bool false Generate a single-channel signed distance field font. Same as SdfMode = SdfMode.Sdf; SdfMode wins when set.
SdfMode SdfMode None Distance field to generate: None (use Sdf), Sdf, Msdf (multi-channel: RGB distances, median = glyph, sharp corners; alpha 255) or Mtsdf (MSDF plus the single-channel distance in alpha). Msdf/Mtsdf produce RGBA atlases, need a backend with SupportsMsdf (Native, experimental), and cannot be combined with effects, a fill color, channel packing, a custom channel layout, atlas variants or ColorFont. EffectiveSdfMode reports the resolved mode.
SdfSpread float 8f SDF spread (distance range) in pixels. Used by the FreeType, StbTrueType and Native backends; applies to every distance-field mode.
SdfScale int 1 SDF supersampling scale factor. Higher values render the distance field at a larger size for finer precision. Applies to every distance-field mode.
Gamma float 1.8f Gamma correction applied to FreeType grayscale coverage. 1.8 is the no-op baseline; >1.8 darkens, <1.8 lightens. Not applied to MONO/color/SDF output.

Outline

Property Type Default Description
Outline int 0 Outline thickness in pixels. 0 = none.
OutlineR / OutlineG / OutlineB byte 0 Outline color channels.
OutlineShape OutlineShape Round Outline corner shape: Round, Square (diagonals filled), or Plus (diamond-shaped corners).
OutlineMode OutlineMode Effect Effect: core's bitmap outline (every backend). Vector: drawn by a backend with SupportsOutlineStroke (Native) from the vector outline, same width, color, shape and cells; others keep the effect. Cannot combine with SDF.

Shadow

Property Type Default Description
ShadowOffsetX / ShadowOffsetY int 0 Shadow offset in pixels. Any non-zero offset (or blur) enables the shadow.
ShadowR / ShadowG / ShadowB byte 0 Shadow color channels.
ShadowOpacity float 1.0f Shadow opacity, 0.0-1.0.
ShadowBlur int 0 Blur radius (primary control). 0 = hard edge.
ShadowBlurKernelSize int 0 Extra blur radius added on top of ShadowBlur. 0 leaves the primary radius untouched.
ShadowBlurPasses int 1 Number of box-blur passes. 1 = single pass (legacy output); more passes approximate a Gaussian for a smoother shadow.
HardShadow bool false Use a binarized silhouette instead of antialiased glyph alpha.

Gradient

Property Type Default Description
GradientStartR / GradientStartG / GradientStartB byte? null Start (top) color. Set both start and end red to enable the gradient.
GradientEndR / GradientEndG / GradientEndB byte? null End (bottom) color.
GradientAngle float 90f Angle in degrees (90 = top-to-bottom).
GradientMidpoint float 0.5f Midpoint bias, 0.0-1.0.
GradientOffset float 0f Shifts the gradient start along its axis. 0 = no shift.
GradientScale float 1f Stretches (>1) or compresses (<1) the gradient span. 1 = no change.
GradientCyclic bool false Repeats/tiles the gradient (hard-seam fractional wrap) instead of clamping at the ends.

Fill color

Property Type Default Description
FillColorR / FillColorG / FillColorB byte 255 Body fill color channels. A non-white fill tints the default body layer and composites even when no other effects are present. Ignored when a gradient is set.
FillColorA byte 255 Body fill alpha; multiplies the glyph mask alpha. 255 = opaque (legacy behavior).

Atlas and texture

Property Type Default Description
MaxTextureSize int 1024 Shortcut to set both width and height. Reads back as MaxTextureWidth.
MaxTextureWidth int 1024 Max atlas width in pixels.
MaxTextureHeight int 1024 Max atlas height in pixels.
Padding Padding (0,0,0,0) Padding around each glyph.
Spacing Spacing (1,1) Spacing between glyphs.
PackingAlgorithm PackingAlgorithm MaxRects MaxRects or Skyline.
PowerOfTwo bool true Round dimensions up to powers of two.
AutofitTexture bool false Pick the smallest power-of-two texture that fits; max width/height remain an upper bound (the chosen size is capped to them).
EqualizeCellHeights bool false Pad all glyph cells to a common height and baseline.
ForceOffsetsToZero bool false Zero out all xoffset/yoffset values.
TextureFormat TextureFormat Png PNG, TGA, or DDS.
SizeConstraints AtlasSizeConstraints? null Force square, power-of-two, or fixed width.
TargetRegion AtlasTargetRegion? null Render glyphs into a region of an existing PNG. Not supported together with Variants.
Variants IReadOnlyList<AtlasVariant>? null Additional character-set renderings (e.g. a dropshadow silhouette) packed into the same shared atlas as the primary glyphs. See Atlas Variants.

Channels and packing

Property Type Default Description
ChannelPacking bool false Pack multiple glyphs into separate RGBA channels. Incompatible with effects and color fonts.
Channels ChannelConfig? null Per-channel content routing -- which of glyph/outline (etc.) each of R/G/B/A holds, plus optional inversion. When null, the default single-composite layout is used.

Color and variable fonts

Property Type Default Description
ColorFont bool false Render color font glyphs (COLR/CPAL layers, CBDT/sbix bitmaps).
ColorPaletteIndex int 0 CPAL palette to use.
VariationAxes Dictionary<string, float>? null Variable-font axis values, e.g. { ["wght"] = 700 }.

Custom glyphs

Property Type Default Description
CustomGlyphs Dictionary<int, CustomGlyph>? null Replace or add glyphs by codepoint, using raw pixel data.

Kerning and metrics

Property Type Default Description
Kerning bool true Include kerning pairs in the output.
AdvanceAdjustX float 0f Global value added to every glyph's xadvance.
CollectMetrics bool false Record per-stage pipeline timing on the result.

Pluggable components

Property Type Default Description
Backend RasterizerBackend FreeType Backend used when Rasterizer is null.
Rasterizer IRasterizer? null Custom rasterizer instance.
FontReader IFontReader? null Custom font reader (defaults to the built-in TTF parser).
Packer IAtlasPacker? null Custom atlas packer (defaults to PackingAlgorithm).
AtlasEncoder IAtlasEncoder? null Custom atlas encoder (defaults to TextureFormat).
PostProcessors IReadOnlyList<IGlyphPostProcessor>? null Extra per-glyph post-processors.