Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

Module contract

Module contract 

Source
Expand description

The engine’s public text contract: shaping inputs, shaped glyphs, outline commands and the primitives they carry.

Plain Rust + serde. The JSON shape (field names, enum strings, refused unknown fields, optional script/language) is the one KiCad Monkey’s ShapingRecord/OutlineVector schemas publish, so records written against those schemas decode into these types unchanged.

Structs§

FiniteFloat
Finite float64 value, including fractional CFF/CFF2 design coordinates.
FiniteFloatError
FontVariationCoordinate
One ordered OpenType variation coordinate.
OpenTypeTag
Four-byte OpenType variation, feature or script tag (^[ -~]{4}$).
OutlineClose
{"kind": "close"}.
OutlineCurveTo
{"kind": "curve_to", "control1_x", "control1_y", "control2_x", "control2_y", "x", "y"}.
OutlineLineTo
{"kind": "line_to", "x", "y"}.
OutlineMoveTo
{"kind": "move_to", "x", "y"}.
OutlineQuadTo
{"kind": "quad_to", "control_x", "control_y", "x", "y"}.
SafeInteger
Integer exactly representable as an IEEE-754 double (|value| <= 2^53 - 1), so it crosses JSON and JavaScript/WASM boundaries unchanged.
SafeIntegerError
Sha256Hex
Lowercase SHA-256 digest of one out-of-band font buffer (^[0-9a-f]{64}$).
ShapedGlyph
One shaped glyph in logical buffer order.
ShapingBufferProperties
Explicit HarfBuzz buffer state; no ambient library defaults are implied.
ShapingFeature
HarfBuzz-compatible feature range over half-open UTF-8 byte offsets. Non-global endpoints are UTF-8 code-point boundaries. A global range is start=0 and end=4294967295. HarfRust receives these values unchanged after UnicodeBuffer::push_str assigns char_indices clusters.
ShapingInput
Complete deterministic shaping input for one run of text in one font.
StableTextId
Nonempty stable ASCII identifier for fonts and cases (^[A-Za-z0-9][A-Za-z0-9._:-]*$).
StableTextIdError
ValidationError
Stable semantic validation failure: a code, a JSON path and a message.

Enums§

DefaultIgnorablePolicy
HarfBuzz default-ignorable handling.
OutlineCommand
One glyph outline command in font design units.
ShapingClusterLevel
HarfBuzz cluster level.
TextDirection
Shaping direction.

Functions§

validate_font_sha256
Validate a font digest: 64 lowercase hexadecimal characters.
validate_font_variations
Validate variation coordinates: printable four-byte axis tags, each once.
validate_shaping_input
Validate one shaping input before a shaper consumes caller-supplied font bytes: UTF-8 byte-offset indexing, the font digest, variation axes, the script tag, a nonempty language and half-open code-point feature ranges. Paths are relative to the input ($ is the input itself).