Skip to main content

Module text

Module text 

Source
Expand description

Text in a sketch: the outlines of a string’s glyphs, closed contours of exact NURBS (see crate::CurveKind::Text).

The font is Noto Sans Regular, by the Noto Project Authors, under the SIL Open Font License 1.1 (fonts/OFL.txt; it reserves no font name). It is embedded as a subset (fonts/NotoSans-Regular-subset.ttf, made with fontTools.subset): Basic Latin, Latin-1, dashes, quotes, the bullet, the ellipsis, the minus, the euro and the trade mark sign; hinting and layout tables dropped, overlapping contours united (fontTools.ttLib.removeOverlaps), so that no two contours of a glyph cross and each is a loop of the sketch’s profile. A character the font has no glyph of is drawn as its missing glyph, a box.

A TrueType outline is lines and quadratic Béziers between points of whole font units, so it is a NURBS exactly. A run of quadratics each starting halfway between the control points either side of it — a TrueType “implied” point — is one quadratic B-spline on uniform knots, the off-curve points its control points: so it is one piece, which the extrusion makes one face, not a face per Bézier.

Structs§

Contour
A closed contour of a glyph: pieces each starting where the one before ends, the last ending where the first starts — at least two of them, so every joint between them is one of the contour’s own.
OutlinePiece
One piece of a contour: a polynomial B-spline of degree through points, its control points, on clamped uniform knots — a line, a quadratic or a cubic Bézier, or a run of quadratics joined smoothly.

Functions§

outlines
The contours of text set in the sketch font, in font units: its first baseline along the x axis from the origin, each line below the one before by the font’s line spacing.
place
contours placed in the sketch: their origin at anchor, scaled so a capital is height tall, turned counter-clockwise by angle radians — each a loop of NURBS pieces on [0, 1].

Type Aliases§

FontPoint
A point of an outline, in font units.