Skip to content

fontlabapp.studios.shape_generators.comb

comb

Split ribbon contours into evenly spaced strips.

What: Split ribbon contours into evenly spaced strips. How: The shortest opposing compatible line segments form caps. Pair the intervening edges in opposite directions and interpolate their coordinates. Equal segment types are required. New contours replace the ribbon. Read-back allows 0.5 unit per axis for native rounding. Why: Make a striped outline while retaining cubic edge geometry. Use: Set strip count and filled percentage. Inspect the contour counts, then Apply. Benefit: Generates editable strips over selected glyphs and masters. Rebuilt contours have new node identities.

The non-modal panel previews the selected glyphs and chosen masters. Shared, scaled and rotated outline shapes are kept. Automatic-layer owners are kept. Bases of automatic composites are kept unless the shared consent option is enabled. Each Apply is recorded as one Undo step through the App history writer. Reload after changing the selection.

Independent behaviour rewrite after Simon Cozens, GlyphsScripts/Comb.py, MIT, copyright 2017 Simon Cozens. Repository: https://github.com/simoncozens/GlyphsScripts . No source code was copied.

Classes

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
KEY attribute
Point attribute (shared captured text)
TITLE attribute
changes function (layer: Any, count: int, fill: float) -> list[writer.Change] Invalid controls fail; unsuitable outlines produce a kept row.
fl attribute
main function () -> Any Open one non-modal panel; replace an earlier panel of the same tool. (shared captured text)
outline_panel attribute
plan_content function (layer: Any, count: int, fill: float) -> list[writer.Change] Plan strips without allocating any native objects.
point_lists_match function (actual: list[list[writer.Point]], expected: list[list[writer.Point]]) -> bool Compare stored contour counts, node counts and coordinates within half a unit.
qt attribute
spans function (contour: Any) -> list[list[Any]] Read complete line or cubic spans; refuse quadratic and open contours. (shared captured text)
striped function (points: list[list[Point]], count: int, fill: float) -> list[list[Point]] Interpolate corresponding ribbon edges; cap each strip with lines.
writer attribute