feat: a sketch text's height, place and angle can be expressions (#1453)

A sketch text's height, place (x and y) and angle can each be an expression over the design's parameters, and the text follows parameter changes, undo and reopening. Closes #1362.

Co-authored-by: NOWN-DEV <NOWN-DEV@users.noreply.github.com>
This commit is contained in:
NOWN-DEVandNOWN-DEV authored and GitHub committed 2026-10-15 14:57:36 -04:00
1 parent e20cf1858a
commit b6806b16cf
23 files changed
+751 -70

No files matched your search

+12 -4
View File
@@ -47,16 +47,24 @@ circle and update the outline when the inline **Sides** value changes.
`sketch.edit_text` take a `font`, the family or full name of an installed font ("DejaVu Sans") or the path
of a `.ttf` / `.otf` file, and the **Edit Text** dialog has a **Font** field for it. An unknown font is an
error, and the font is kept with the text in the design, so the text stays editable in it. `SOLIDCRAFT_FONT_DIRS`
adds folders to the ones searched for installed fonts. The same two commands refuse a `text` that is not a
string, an `at` that is not two numbers, and a `height` or `angle` that is not a number (or a `height` that is not
positive) with a message, instead of drawing the text with a default; left out, they keep their defaults.
adds folders to the ones searched for installed fonts. A text's `height`, its `angle` and each coordinate of
its `at` can be expressions of the design's parameters, given as strings (`"height": "plate_height / 10"`,
`"at": ["plate_width / 2", 5]`): the text keeps the expression and follows the parameters when they change, and
saves it with the design. A number takes the place of an expression, and so does moving the text or dragging its
handles (what moves becomes a number; turning a text leaves its height as it was). A string that names no
parameter is the number it comes to. The same two commands refuse a `text` that is not a string, an `at` that is
not two numbers or expressions, a `height` or `angle` that is neither (or a `height` that is not positive) and an
expression that cannot be worked out with a message, instead of drawing the text with a default; left out, they
keep their defaults.
Right-click a letter's filled interior or outline and choose **Edit Text**. You can also
start **Edit Text** first and click the letter. All outlines belonging to that text are
highlighted while the dialog is open. A profile bounded by multiple text sources or other
geometry cannot identify one text: use **Select Other** to choose its outline instead.
Change the text, font, baseline X/Y, height or angle, then confirm with **OK**; **Cancel**
keeps the original text. Position and height use the document's units.
keeps the original text. Position and height use the document's units. The four fields take
expressions: one that names a parameter (`plate_width / 2`) stays an expression, is shown as typed
when the dialog is opened again, and keeps the text following the parameter.
A text can follow a curve of its sketch (its **Path**). That curve becomes construction: the
letters stand on it and their descenders cross it, so as a normal curve it would cut them into