Skip to content

Sketcher: support text boxes in array tools - #399

Merged
knipknap merged 6 commits into
mainfrom
feat/sketcher-array-text-boxes
Sep 23, 2026
Merged

knipknap merged 6 commits into
mainfrom
feat/sketcher-array-text-boxes

Conversation

@knipknap

@knipknap knipknap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Addresses the circular-array part of #358.

Summary

Text boxes can now be used as array templates (Circular Array and Array Along Curve share the machinery):

  • Clean copies (create_array.py): baked copies no longer inherit the template's construction_line_ids (same treatment as ellipse helper lines). A copy's fourth frame corner falls back to the parallelogram identity, so copies render and hit-test correctly and can't be cascade-deleted together with the template's helpers.
  • Content/font sync (text_box.py): the text box geometry_signature now covers content and font, so editing the template's text or font re-derives every copy on the next solve. In-place copy updates (rewrite_offsets_from) re-derive content, font and fill from the template.
  • Full-text previews (entity.py, entity_group.py): new Entity.to_polylines lets multi-contour entities contribute one polyline per contour, so the array dialog's live preview draws all glyph outlines instead of only the first contour.
  • Docs: notes text support in the arrays feature page.
  • Tests: tests/core/test_array_text_template.py covers creation, rigidity of copies, content/font propagation, delete + regenerate, undo, duplication, and serialization round-trips.

Dependency

Requires raygeo 1.52.0 (FontConfig copy protocol, barebaric/raygeo#29), which has been released and is pinned here in requirements.txt, pixi.toml, pixi.lock and the debian bundle requirements. Older raygeo builds raise TypeError: cannot pickle 'FontConfig' when a text box is deep-copied.

Array templates can now be text boxes. Copies are baked without
stale construction-line references (their fourth frame corner follows
from the parallelogram identity), so they render and hit-test
correctly and cannot be cascade-deleted with the template's helpers.

The text box geometry signature now covers content and font, so
editing the template's text or font re-derives every copy on the
next solve; in-place copy updates re-derive content, font and fill
from the template.

Entity group previews sample multi-contour entities into one
polyline per contour, so the array dialog preview shows the full
glyph outlines instead of only the first contour.

Requires the FontConfig copy-protocol fix in raygeo (PR barebaric/raygeo#29);
deep-copying a text box raises TypeError against older raygeo builds.
Narrows optional registry lookups and uses SketchSelection so pyright
passes on the new test module, and skips the text-array tests when the
installed raygeo build predates the FontConfig copy protocol
(barebaric/raygeo#29) instead of failing on the deepcopy TypeError.
Replaces the isinstance dispatch in CreateArrayCommand with an
Entity.clear_helper_references override: entities with helper
geometry (ellipse helper lines, text box construction lines) clear
their own references; the base is a no-op.
raygeo 1.52.0 ships the FontConfig copy protocol (barebaric/raygeo#29,
released as v1.52.0). Pin it in requirements.txt, pixi.toml, the
debian bundle requirements and pixi.lock, and remove the
_fontconfig_is_copyable skipif guard from the text array tests so
they always run.
…ext-boxes

# Conflicts:
#	debian/requirements-bundle.txt
#	pixi.lock
#	pixi.toml
#	requirements.txt
A text box exposes only its three defining frame points; its fourth
corner is referenced solely by its construction lines (helper
geometry). Every rigid motion of an array member built its group from
the member entities alone, leaving the corner behind: during a guide
drag the template's ParallelogramConstraint stayed violated (the
corner lagged), and the drag-end global solve repaired it by dragging
and rotating the whole box.

Move helper geometry with the member in every array motion: template
placement (create/redo), curve re-anchor, circular translate and
radial re-projection, plus undo snapshots. Standalone-point discovery
now includes helpers, matching creation, so the corner is not
double-tracked.
@knipknap
knipknap merged commit c2a0389 into main Sep 23, 2026
29 checks passed

This branch was successfully deployed

1 active deployment
pypi — 531efa0b Deployed Sep 23, 2026 by knipknap via Build and Publish Wheel #2003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant