Repository navigation
Conversation
The renderer sets the text of a shape inside a group whose child coordinates scale it at the shape's size on the slide, so font sizes and insets stay in points (Renderer::text_space). place() set the same text in the group's child units and then scaled it with the group, so placed text broke its lines differently and lay elsewhere than the drawn text. The PDF text layer and the text hyperlink areas read placed text. text_space's rule moves into placed.rs as one function that the renderer and place() both call. Table cell text is unchanged: tables draw their text under the group's scale, and place() already did the same. Test: text_in_a_scaled_group_is_placed_as_drawn puts one line in groups whose child space is 1, 1600, 4 and 1/4 times smaller than the group and checks each glyph's id, position on the slide and drawn size against the same line on its own. ROADMAP.md gets a status line, a progress-log row and a revision-history row.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
aiongg
left a comment
There was a problem hiding this comment.
AI-generated review (Opus). Not a maintainer decision.
No blocking problems found.
The PR shares the group text-space rule between drawing and placement, so placed text (PDF text layer, text link areas) in a group whose child coordinates scale it is laid out at the shape's size in points, as drawn.
- crates/render/src/placed.rs:156 passes
mas both the relative and the drawing transform. That is right because placement already works in slide points, which matchesRenderer::text_space(crates/render/src/renderer.rs:369-371) with the slide view taken out. - Table cell text (crates/render/src/placed.rs:149) stays under the group's scale, as the table drawing code does (crates/render/src/renderer.rs:497).
- Link boxes (crates/render/src/placed.rs:191) and the PDF text layer (crates/pdf/src/lib.rs:608) both go through the returned transform, so both now lie on the drawn words.
text_outline(crates/render/src/placed.rs:236) still lays out text at the shape's own size without this rule; it could usetext_spacein a follow-up if Merge Shapes on scaled group children matters.
Claims checked:
- verified: place() now sets text in scaled groups at the shape's size on the slide, as the renderer draws it, by calling one shared text_space function (crates/render/src/placed.rs:156-158 calls text_space(m, m, depth, x.w, x.h) and builds the text rect from the returned size; crates/render/src/renderer.rs:36…
- verified: Renderer::text_space keeps its signature and behaviour (crates/render/src/renderer.rs:369 keeps fn text_space(&self, m, depth, w, h); the body moved unchanged to crates/render/src/placed.rs:201-213)
- verified: PDF text layer and text hyperlink boxes (PDF links, slide show link areas) now lie on the drawn text (crates/render/src/placed.rs:167 and :191 build link rects from the text-space transform; crates/pdf/src/lib.rs:608 places glyphs with view * pt.transform; crates/ui-egui/src/show/media.rs:190 uses…
- verified: Table cell text and SmartArt groups whose child space equals their frame are unaffected (crates/render/src/placed.rs:149 still passes m for table cells, matching crates/render/src/renderer.rs:497 (table::draw under m); text_space returns (w, h, m) when both scales are 1 (crates/render/src/placed.rs…
Reviewed at ba63277.
Recommendation: merge, after a maintainer's decision.
Follows #340; split out of #1853, where a review asked for this as its own change.
#340 made the renderer set the text of a shape inside a group whose child coordinates scale it at the shape's size on the slide, so font sizes and insets stay in points (
Renderer::text_space).place()incrates/render/src/placed.rsstill set that text in the group's child units and then scaled it with the group, so placed text broke its lines differently from the drawn text and lay elsewhere. In the test below, a 24 pt line in a group whose child space is 1/1600 of its size was placed as 20 glyphs where the same line on its own is placed as 24. Placed text is what the PDF export lays over each slide as its text layer, and the boxes of text hyperlinks come from it (the PDF's link areas and the clickable areas of linked text in the slide show), so for text in such groups they missed the drawn words.This PR moves
text_space's rule intoplaced.rsas one function thatRenderer::text_spaceandplace()both call.Renderer::text_spacekeeps its signature. SmartArt groups, whose child space equals their frame, are unaffected, and so is table cell text: tables draw their text under the group's scale, andplace()already placed it that way.Test (
crates/render/src/tests_placed_group.rs):text_in_a_scaled_group_is_placed_as_drawnsets one 24 pt line in groups whose child space is 1, 1/1600, 1/4 and 4 times the group's size and checks each glyph's id, position on the slide and drawn size against the same line on its own. ROADMAP.md has a status line, a progress-log row and a revision-history row.Validation and scope
At ba63277 (this branch on daeedd5),
cargo xtask cipassed all 8 steps (fmt, pdf-deps, clippy, test, doctest, assets, layers, wasm), with 2,433 tests passed and 6 existing skipped. On daeedd5 with only the new test added, the test failed at the 1/1600 group, which placed 20 glyphs where the line on its own places 24.#1853 merges this branch (its commit a56ac87), so it carries this change until this PR merges and then drops it from its diff. Checked on 2026-11-07 against main 0627fb2 and the 400 open PRs: this branch merges into main cleanly. Merged, it adds textual conflicts with #1029, #1891, #1905 and #1906, all in ROADMAP.md. Thirty-four older PRs already conflict with main in files this branch changes (in
crates/render/src/placed.rs: #304, #855, #895, #1138, #1197 and #1470), and merging it adds no conflicted file to any of them. #259 and #819 share no history with main and were not checked. #1629 adds a call toRenderer::text_space, which keeps its signature; #1095 changes text editing coordinates inside transformed groups in the engine and touches none of these files. Whichever lands second rebases.Summary by CodeRabbit