Table of Contents

Class FontGeneratorOptions

Namespace
KernSmith
Assembly
KernSmith.dll

All the settings for generating a BMFont. Sensible defaults are provided.

public class FontGeneratorOptions
Inheritance
FontGeneratorOptions
Inherited Members

Properties

AdvanceAdjustX

Global horizontal advance adjustment (default 0) added to every glyph's xadvance. Distinct from Spacing (inter-glyph atlas spacing). Maps to Hiero's pad.advance.x.

public float AdvanceAdjustX { get; set; }

Property Value

float

AdvanceAdjustY

Global vertical advance adjustment (default 0) added to every glyph's yadvance. Distinct from Spacing (inter-glyph atlas spacing). Maps to Hiero's pad.advance.y.

public float AdvanceAdjustY { get; set; }

Property Value

float

AntiAlias

Anti-aliasing mode. Default is grayscale.

public AntiAliasMode AntiAlias { get; set; }

Property Value

AntiAliasMode

AtlasEncoder

Custom atlas encoder. When null, uses the TextureFormat setting.

public IAtlasEncoder? AtlasEncoder { get; set; }

Property Value

IAtlasEncoder

AutofitTexture

If true, picks the smallest power-of-two texture that fits all glyphs. Overrides MaxTextureWidth/MaxTextureHeight.

public bool AutofitTexture { get; set; }

Property Value

bool

Backend

Which rasterizer backend to use when Rasterizer is not set. Default is FreeType.

public RasterizerBackend Backend { get; set; }

Property Value

RasterizerBackend

Bold

If true, requests bold. Uses a native bold face when available, falling back to synthetic emboldening.

public bool Bold { get; set; }

Property Value

bool

ChannelPacking

If true, packs multiple glyphs into separate RGBA channels for smaller textures.

public bool ChannelPacking { get; set; }

Property Value

bool

Channels

Per-channel control over what goes into each RGBA channel (glyph, outline, both, zero, or one).

public ChannelConfig? Channels { get; set; }

Property Value

ChannelConfig

Characters

Character set to include in the generated font.

public CharacterSet Characters { get; set; }

Property Value

CharacterSet

CollectMetrics

If true, records how long each pipeline stage takes. Check BmFontResult.Metrics for results.

public bool CollectMetrics { get; set; }

Property Value

bool

ColorFont

If true, renders color font glyphs (COLR/CPAL tables, like emoji fonts).

public bool ColorFont { get; set; }

Property Value

bool

ColorPaletteIndex

Which CPAL color palette to use for color fonts. 0 = default palette.

public int ColorPaletteIndex { get; set; }

Property Value

int

CustomGlyphs

Custom glyph images keyed by character code. These replace or add glyphs. You must supply raw pixel data (not encoded PNG/etc).

public Dictionary<int, CustomGlyph>? CustomGlyphs { get; set; }

Property Value

Dictionary<int, CustomGlyph>

Dpi

Rendering DPI (default 72). 72 DPI is standard for screen rendering.

public int Dpi { get; set; }

Property Value

int

EnableHinting

If true, enables FreeType hinting for crisp small text. If false, renders without hinting for smoother curves.

public bool EnableHinting { get; set; }

Property Value

bool

EqualizeCellHeights

If true, pads all glyph cells to the same height and aligns them to a common baseline.

public bool EqualizeCellHeights { get; set; }

Property Value

bool

FaceIndex

Face index for font collections (TTC/OTC). 0 = first face.

public int FaceIndex { get; set; }

Property Value

int

FallbackCharacter

Character to show for missing glyphs. Common choices: '?' or '\uFFFD'. For supplementary plane characters (above U+FFFF), use FallbackCodepoint instead.

public char? FallbackCharacter { get; set; }

Property Value

char?

FallbackCodepoint

Unicode codepoint to show for missing glyphs. Supports the full Unicode range (U+0000 to U+10FFFF), including supplementary plane characters that cannot be represented by FallbackCharacter. When both FallbackCodepoint and FallbackCharacter are set, FallbackCodepoint takes precedence.

public int? FallbackCodepoint { get; set; }

Property Value

int?

FillColorA

Base glyph fill color alpha channel (default 255 = opaque). Hiero's ColorEffect stores only RGB, so this defaults to 255 on import.

public byte FillColorA { get; set; }

Property Value

byte

FillColorB

Base glyph fill color blue channel (default 255 = white).

public byte FillColorB { get; set; }

Property Value

byte

FillColorG

Base glyph fill color green channel (default 255 = white).

public byte FillColorG { get; set; }

Property Value

byte

FillColorR

Base glyph fill color red channel (default 255 = white).

public byte FillColorR { get; set; }

Property Value

byte

FontReader

Custom font reader. When null, uses the built-in TTF parser.

public IFontReader? FontReader { get; set; }

Property Value

IFontReader

ForceOffsetsToZero

If true, zeroes out all xoffset/yoffset values. Useful for monospace or grid-based rendering.

public bool ForceOffsetsToZero { get; set; }

Property Value

bool

ForceSyntheticBold

If true, forces synthetic bold even when a native bold face exists.

public bool ForceSyntheticBold { get; set; }

Property Value

bool

ForceSyntheticItalic

If true, forces synthetic italic even when a native italic face exists.

public bool ForceSyntheticItalic { get; set; }

Property Value

bool

Gamma

FreeType gamma correction applied during rasterization (default 1.8, matching Hiero). Maps to Hiero's font.gamma.

public float Gamma { get; set; }

Property Value

float

GradientAngle

Gradient angle in degrees (default 90 = top-to-bottom).

public float GradientAngle { get; set; }

Property Value

float

GradientCyclic

If true, the gradient repeats (cycles) instead of clamping at its ends (default false). Maps to Hiero's GradientEffect Cyclic.

public bool GradientCyclic { get; set; }

Property Value

bool

GradientEndB

Gradient end (bottom) color blue channel.

public byte? GradientEndB { get; set; }

Property Value

byte?

GradientEndG

Gradient end (bottom) color green channel.

public byte? GradientEndG { get; set; }

Property Value

byte?

GradientEndR

Gradient end (bottom) color red channel.

public byte? GradientEndR { get; set; }

Property Value

byte?

GradientMidpoint

Gradient midpoint bias (0.0 to 1.0, default 0.5).

public float GradientMidpoint { get; set; }

Property Value

float

GradientOffset

Gradient positional offset (default 0). Shifts the gradient along its axis. Composes with GradientAngle/GradientMidpoint. Maps to Hiero's GradientEffect Offset.

public float GradientOffset { get; set; }

Property Value

float

GradientScale

Gradient scale factor (default 1). Stretches or compresses the gradient along its axis. Composes with GradientAngle/GradientMidpoint. Maps to Hiero's GradientEffect Scale.

public float GradientScale { get; set; }

Property Value

float

GradientStartB

Gradient start (top) color blue channel.

public byte? GradientStartB { get; set; }

Property Value

byte?

GradientStartG

Gradient start (top) color green channel.

public byte? GradientStartG { get; set; }

Property Value

byte?

GradientStartR

Gradient start (top) color red channel.

public byte? GradientStartR { get; set; }

Property Value

byte?

HardShadow

When true, shadow uses a hard (binarized) silhouette instead of the antialiased glyph alpha.

public bool HardShadow { get; set; }

Property Value

bool

HeightPercent

Vertical height scaling. 100 = normal, 150 = 50% taller, 75 = 25% shorter.

public int HeightPercent { get; set; }

Property Value

int

Italic

If true, requests italic. Uses a native italic face when available, falling back to synthetic oblique.

public bool Italic { get; set; }

Property Value

bool

Kerning

If true, includes kerning pairs in the output (default true).

public bool Kerning { get; set; }

Property Value

bool

MatchCharHeight

If true, scales the font so the tallest character exactly matches the requested pixel size.

public bool MatchCharHeight { get; set; }

Property Value

bool

MaxTextureHeight

Maximum atlas texture height in pixels (default 1024).

public int MaxTextureHeight { get; set; }

Property Value

int

MaxTextureSize

Shortcut to set both MaxTextureWidth and MaxTextureHeight at once. Reading returns MaxTextureWidth.

public int MaxTextureSize { get; set; }

Property Value

int

MaxTextureWidth

Maximum atlas texture width in pixels (default 1024).

public int MaxTextureWidth { get; set; }

Property Value

int

Outline

Outline thickness in pixels. 0 = no outline.

public int Outline { get; set; }

Property Value

int

OutlineB

Outline color blue channel (default 0 = black).

public byte OutlineB { get; set; }

Property Value

byte

OutlineG

Outline color green channel (default 0 = black).

public byte OutlineG { get; set; }

Property Value

byte

OutlineR

Outline color red channel (default 0 = black).

public byte OutlineR { get; set; }

Property Value

byte

Packer

Custom atlas packer. When null, uses the PackingAlgorithm setting.

public IAtlasPacker? Packer { get; set; }

Property Value

IAtlasPacker

PackingAlgorithm

Algorithm used for packing glyphs into atlas pages.

public PackingAlgorithm PackingAlgorithm { get; set; }

Property Value

PackingAlgorithm

Padding

Padding around each glyph in the atlas.

public Padding Padding { get; set; }

Property Value

Padding

PostProcessors

Extra post-processors to run on each glyph after rasterization.

public IReadOnlyList<IGlyphPostProcessor>? PostProcessors { get; set; }

Property Value

IReadOnlyList<IGlyphPostProcessor>

PowerOfTwo

If true, atlas dimensions are rounded up to powers of two (default true).

public bool PowerOfTwo { get; set; }

Property Value

bool

Rasterizer

Custom rasterizer. When null, uses FreeType.

public IRasterizer? Rasterizer { get; set; }

Property Value

IRasterizer

Sdf

If true, generates a signed distance field (SDF) font.

public bool Sdf { get; set; }

Property Value

bool

SdfScale

SDF supersampling scale factor (default 1). Higher values render the distance field at a larger size for finer precision. Maps to Hiero's DistanceFieldEffect Scale.

public int SdfScale { get; set; }

Property Value

int

SdfSpread

SDF spread (search radius) in pixels (default 8, matching the FreeType SDF default). Larger values capture distance information further from the glyph edge. Maps to Hiero's DistanceFieldEffect Spread.

public float SdfSpread { get; set; }

Property Value

float

ShadowB

Shadow color blue channel.

public byte ShadowB { get; set; }

Property Value

byte

ShadowBlur

Shadow blur radius. 0 = hard shadow.

public int ShadowBlur { get; set; }

Property Value

int

ShadowBlurKernelSize

Shadow blur kernel size (default 0 = no kernel blur). Maps to Hiero's ShadowEffect "Blur kernel size". Additive to the legacy ShadowBlur radius for finer two-parameter control.

public int ShadowBlurKernelSize { get; set; }

Property Value

int

ShadowBlurPasses

Number of shadow blur passes (default 1). Maps to Hiero's ShadowEffect "Blur passes". More passes produce a softer, wider blur.

public int ShadowBlurPasses { get; set; }

Property Value

int

ShadowG

Shadow color green channel.

public byte ShadowG { get; set; }

Property Value

byte

ShadowOffsetX

Shadow horizontal offset in pixels (positive = right).

public int ShadowOffsetX { get; set; }

Property Value

int

ShadowOffsetY

Shadow vertical offset in pixels (positive = down).

public int ShadowOffsetY { get; set; }

Property Value

int

ShadowOpacity

Shadow opacity (0.0 to 1.0, default 1.0).

public float ShadowOpacity { get; set; }

Property Value

float

ShadowR

Shadow color red channel.

public byte ShadowR { get; set; }

Property Value

byte

Size

Font size in pixels (default 32). Fractional values are supported by FreeType, StbTrueType, and DirectWrite backends; the GDI backend rounds to the nearest integer.

public float Size { get; set; }

Property Value

float

SizeConstraints

Atlas size constraints (force square, force power-of-two, fixed width).

public AtlasSizeConstraints? SizeConstraints { get; set; }

Property Value

AtlasSizeConstraints

Spacing

Spacing between glyphs in the atlas.

public Spacing Spacing { get; set; }

Property Value

Spacing

SuperSampleLevel

Super sampling level (1-4). Higher values render at Nx size then downscale for smoother edges. 1 = no super sampling.

public int SuperSampleLevel { get; set; }

Property Value

int

TargetRegion

When set, renders glyphs into a region of an existing PNG image.

public AtlasTargetRegion? TargetRegion { get; set; }

Property Value

AtlasTargetRegion

TextureFormat

Texture format for atlas output (PNG, TGA, or DDS). Default is PNG.

public TextureFormat TextureFormat { get; set; }

Property Value

TextureFormat

VariationAxes

Variable font axis values, keyed by tag. For example: { "wght", 700 } for bold weight.

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

Property Value

Dictionary<string, float>