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§
- Open
Type Contour - Open
Type Error - Open
Type Glyph - Open
Type Output - Open
Type Point - Open
Type Region - Open
Type Request - Stroke
Text Error - Stroke
Text Output - Realized centerlines and source-font metrics.
- Stroke
Text Point - One placed stroke-text point in source millimetres.
- Stroke
Text Polyline - One connected pen-down path. Pen-up markers always split polylines.
- Stroke
Text Profile - The rules a stroke realization follows beyond its request. The default
keeps the realizer’s own rules;
StrokeTextProfile::kicadis the one KiCad draws its stroke font with. - Stroke
Text Request - One stroke-font text realization request in source millimetres.
Enums§
- Open
Type Error Kind - Stroke
Italic Slant - How a stroke realization slants italic text: part of a
StrokeTextProfile. - Stroke
TabRule - 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. - Stroke
Text Error Kind - Text
Horizontal Alignment - Horizontal placement of a single realized text line.
- Text
Vertical Alignment - 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_a0with the font’s line pitch scaled byline_spacingwhen one is given (asrealize_stroke_text_multiline_spaced_a0), followingprofile’s rules.- realize_
stroke_ text_ multiline_ spaced_ a0 realize_stroke_text_multiline_a0with the font’s line pitch scaled byline_spacing(a positive, finite multiplier; 1 is the font’s own pitch).- realize_
stroke_ text_ plot_ a0 realize_stroke_text_a0laid 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 (KiCadFONT::getLinePositions; measured with kicad-cli 10.0.5 at every size and angle; centred text has none), and the line sits whereFONT::getLinePositionsputs it for its vertical justification.- realize_
stroke_ text_ plot_ profile_ a0 realize_stroke_text_plot_a0followingprofile’s rules.- realize_
stroke_ text_ profile_ a0 realize_stroke_text_a0followingprofile’s rules.- windows_
cell_ em - The em of a text whose Windows font cell is
celltall, in the cell’s units. The cell is the face’s OS/2 usWinAscent + usWinDescent, with no hhea or typographic fallback (GFXwindows_cell_height).Nonefor bytes that are not a face, or a face without an OS/2 cell. - wrap_
stroke_ text_ box - Break KiCad-markup
textinto lines no wider thanmax_width_mmat glyph widthsize_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.