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

Crate cad_text_realization

Crate cad_text_realization 

Source
Expand description

Bounded, deterministic CAD text realization: OpenType shaping, glyph outlines, contour layout and topology, and stroke-font polylines.

contract is the public text contract (shaping input, shaped glyphs, outline commands and their primitives). The built-in stroke font is the Newstroke glyph table; its layout follows the profile KiCad’s renderer uses (provenance noted at each rule).

Re-exports§

pub use contract::DefaultIgnorablePolicy;
pub use contract::FiniteFloat;
pub use contract::FiniteFloatError;
pub use contract::FontVariationCoordinate;
pub use contract::OpenTypeTag;
pub use contract::OutlineClose;
pub use contract::OutlineCommand;
pub use contract::OutlineCurveTo;
pub use contract::OutlineLineTo;
pub use contract::OutlineMoveTo;
pub use contract::OutlineQuadTo;
pub use contract::SafeInteger;
pub use contract::SafeIntegerError;
pub use contract::Sha256Hex;
pub use contract::ShapedGlyph;
pub use contract::ShapingBufferProperties;
pub use contract::ShapingClusterLevel;
pub use contract::ShapingFeature;
pub use contract::ShapingInput;
pub use contract::StableTextId;
pub use contract::StableTextIdError;
pub use contract::TextDirection;
pub use contract::ValidationError;
pub use contract::validate_font_sha256;
pub use contract::validate_font_variations;
pub use contract::validate_shaping_input;
pub use font_outline::FONT_OUTLINE_ENGINE;
pub use font_outline::FontOutlineError;
pub use font_outline::FontOutlineErrorKind;
pub use font_outline::FontOutlineFace;
pub use font_outline::FontOutlineFaceRequest;
pub use font_outline::FontOutlineOutput;
pub use font_outline::FontOutlineRequest;
pub use font_outline::HINTED_FONT_OUTLINE_ENGINE;
pub use font_outline::HintedFontOutlineFace;
pub use font_outline::extract_font_outline_a0;
pub use text_bezier::TextBezierError;
pub use text_bezier::TextBezierErrorKind;
pub use text_bezier::TextBezierOutput;
pub use text_bezier::TextPoint;
pub use text_bezier::flatten_cubic_bezier;
pub use text_bezier::flatten_quadratic_bezier;
pub use text_contours::OUTLINE_FACE_SCALER;
pub use text_contours::SUBSCRIPT_FACE_SCALER;
pub use text_contours::SUBSCRIPT_SUPERSCRIPT_SIZE_RATIO;
pub use text_contours::SUBSCRIPT_VERTICAL_OFFSET_RATIO;
pub use text_contours::SUPERSCRIPT_VERTICAL_OFFSET_RATIO;
pub use text_contours::TEXT_BEZIER_ERROR;
pub use text_contours::TextContour;
pub use text_contours::TextContourError;
pub use text_contours::TextContourErrorKind;
pub use text_contours::TextContourOutput;
pub use text_contours::TextContourRequest;
pub use text_contours::TextContourSession;
pub use text_contours::shape_text_contours_a0;
pub use text_contours::shape_text_contours_hinted_a0;
pub use text_layout::TEXT_HEIGHT_FUDGE_FACTOR;
pub use text_layout::TextLayoutRequest;
pub use text_layout::layout_single_line_text_a0;
pub use text_layout::layout_single_line_text_hinted_a0;
pub use text_shaping::TEXT_SHAPING_ENGINE;
pub use text_shaping::TextShapingError;
pub use text_shaping::TextShapingErrorKind;
pub use text_shaping::TextShapingOutput;
pub use text_shaping::shape_text_a0;
pub use text_topology::TextContourRegion;
pub use text_topology::TextTopologyOutput;
pub use text_topology::fracture_text_contours_a0;
pub use text_topology::group_text_contours_a0;

Modules§

contract
The engine’s public text contract: shaping inputs, shaped glyphs, outline commands and the primitives they carry.
font_container
Bounded caller-owned font containers. No font, path or system discovery. WOFF2 support deliberately covers a single CFF face with null table transforms.
font_outline
Bounded native glyph-outline extraction over caller-supplied font bytes.
text_bezier
Bounded KiCad-compatible quadratic and cubic outline decomposition.
text_contours
Bounded composition of native shaping and outlines into positioned contours.
text_layout
Bounded KiCad single-line alignment and authored-origin transforms.
text_shaping
Deterministic native OpenType shaping over caller-supplied font bytes.
text_topology
Bounded KiCad-compatible contour normalization and hole fracture.

Structs§

OpenTypeContour
OpenTypeError
OpenTypeGlyph
OpenTypeOutput
OpenTypePoint
OpenTypeRegion
OpenTypeRequest
StrokeTextError
StrokeTextOutput
Realized centerlines and source-font metrics.
StrokeTextPoint
One placed stroke-text point in source millimetres.
StrokeTextPolyline
One connected pen-down path. Pen-up markers always split polylines.
StrokeTextProfile
The rules a stroke realization follows beyond its request. The default keeps the realizer’s own rules; StrokeTextProfile::kicad is the one KiCad draws its stroke font with.
StrokeTextRequest
One stroke-font text realization request in source millimetres.

Enums§

OpenTypeErrorKind
StrokeItalicSlant
How a stroke realization slants italic text: part of a StrokeTextProfile.
StrokeTabRule
How a single-line stroke realization places a tab: part of a StrokeTextProfile. A block’s lines (realize_stroke_text_multiline_a0) always take KiCad’s stops.
StrokeTextErrorKind
TextHorizontalAlignment
Horizontal placement of a single realized text line.
TextVerticalAlignment
Vertical placement of a single realized text line.

Constants§

OPENTYPE_REALIZATION_ENGINE
Output-affecting engine/version receipt for the qualified plain-text subset.

Functions§

realize_opentype
Shape, outline, place, and classify one plain horizontal text line.
realize_stroke_text_a0
Realize text in the built-in stroke font as ordered, disconnected polylines.
realize_stroke_text_multiline_a0
Realize a PCB multiline block using Source integer baseline placement.
realize_stroke_text_multiline_profile_a0
realize_stroke_text_multiline_a0 with the font’s line pitch scaled by line_spacing when one is given (as realize_stroke_text_multiline_spaced_a0), following profile’s rules.
realize_stroke_text_multiline_spaced_a0
realize_stroke_text_multiline_a0 with the font’s line pitch scaled by line_spacing (a positive, finite multiplier; 1 is the font’s own pitch).
realize_stroke_text_plot_a0
realize_stroke_text_a0 laid out as pcbnew plots board text: the pen is clamped to a quarter of the smaller text size (size 1 mm with thickness 0.3 plots a 0.25 mm pen), left- and right-justified text moves inward by the pen / 1.52 (KiCad FONT::getLinePositions; measured with kicad-cli 10.0.5 at every size and angle; centred text has none), and the line sits where FONT::getLinePositions puts it for its vertical justification.
realize_stroke_text_plot_profile_a0
realize_stroke_text_plot_a0 following profile’s rules.
realize_stroke_text_profile_a0
realize_stroke_text_a0 following profile’s rules.
windows_cell_em
The em of a text whose Windows font cell is cell tall, in the cell’s units. The cell is the face’s OS/2 usWinAscent + usWinDescent, with no hhea or typographic fallback (GFX windows_cell_height). None for bytes that are not a face, or a face without an OS/2 cell.
wrap_stroke_text_box
Break KiCad-markup text into lines no wider than max_width_mm at glyph width size_x_nm, at spaces only (Python _wrap_text_box_lines). A word wider than the box keeps its own line. Each byte is appended and measured at most twice (once more when it triggers a wrap), so a long paragraph cannot degrade into repeated whole-prefix measurement.