Add a rotation to the text effect's placement

text_rotation turns the text and its box about the box's centre, so the
centring and the offset still decide where it sits. Like the other
placement params it stays on the stage and is not carried by a style.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Si
2026-09-23 21:33:37 +02:00
co-authored by Claude Opus 5.5
parent 68a1e40d3f
commit 134c575727
2 changed files with 33 additions and 1 deletions
+16 -1
View File
@@ -759,6 +759,20 @@ int main() {
check(countRed(moved, 100, 60, 200, 120) > 0 && countRed(moved, 0, 0, 100, 60) == 0,
"the offset moves it down and to the right");
// A wide line turned a quarter stands upright: it reaches above and
// below the band it filled unturned, and no longer out to the sides.
ParamValues wide = plain;
wide["text"] = std::string("HHHHHH");
wide["font_size"] = 40.0;
const auto flat = renderText(blue, 200, 120, wide);
ParamValues turned = wide;
turned["text_rotation"] = 90.0;
const auto upright = renderText(blue, 200, 120, turned);
check(countRed(flat, 0, 0, 200, 25) == 0 && countRed(upright, 0, 0, 200, 25) > 0,
"rotation turns the text about its centre");
check(countRed(flat, 0, 0, 50, 120) > 0 && countRed(upright, 0, 0, 50, 120) == 0,
"and takes it in from the sides");
// Weight and size are the two knobs the glyphs themselves answer to: a
// bolder or a larger setting covers strictly more of the canvas.
ParamValues bold = plain;
@@ -877,7 +891,8 @@ int main() {
carries("box_padding") && carries("box_opacity"),
"the look is what it carries");
check(!carries("text") && !carries("text_wrap") && !carries("box_image") &&
!carries("text_center") && !carries("text_offset_x") && !carries("text_offset_y"),
!carries("text_center") && !carries("text_offset_x") && !carries("text_offset_y") &&
!carries("text_rotation"),
"the words and the placement stay on the stage");
check(styleSpecs("").empty() && styleSpecs("nosuchkind").empty(),
"a kind no effect claims carries nothing");