Skip to content

Shapes: every preset's text rectangle from presetShapeDefinitions; table-driven test over all presets - #650

Open
NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:preset-audit
Open

NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:preset-audit

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Stacked on #643. Includes #642 (star4/star5 text rectangles), whose fixes now come from the general mechanism.

Summary

  • Every preset's text rectangle is now computed from the standard's own formulas: formula data is generated from presetShapeDefinitions.xml by a committed script, and a small evaluator runs it at the shape's size and adjust values. Outlines are unchanged.
  • An audit of all 187 presets with a text rectangle (at 200×100, 100×200 and 144×144) found 162 text-rectangle mismatches across ~55 presets (heart, hexagon, parallelogram, trapezoid, plus, arc, rounded/snipped rectangles, brackets and braces, scrolls, gear9, funnel, circular arrows, stars 6–32, most multi-headed arrows) — all fixed.
  • Bent/curved connectors 4 and 5 now get the standard's adjust defaults through preset::defaults(), also used by the PPTX writer.
  • Gradient differences seen in the corpus comparison are out of scope (they need a PowerPoint check).

Test plan

  • New table-driven test: every preset's defaults and text rectangle at three sizes against a generated table — zero mismatches
  • cargo xtask ci (all 6 steps)
  • Re-rendered 116 corpus slides and compared with LibreOffice by eye: chevron/star text on pp-8 and the star text on sample-4 now sit where LibreOffice puts them; hexagon text unchanged

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…d#650)

* M6: bulk-edit shared form field properties (storytold#95)

Add opt-in shared properties, partial appearance patches and atomic CLI/MCP
batches. Complete current-page, rectangle and Fields-panel selection, with
20 synthetic regressions for preservation, rollback and dialog lifecycle.

Co-Authored-By: Codex <noreply@openai.com>

* Bulk field properties: translated messages, a catalog check, and in-place /DA patches

- The bulk dialog's flag label, errors and notices are in all 13 full catalogs; the missing-field error is a template (fmt + tl!) instead of format!. New test bulk_field_properties_labels_are_in_every_full_catalog.
- patch_da rewrites the last Tf and fill colour in place (appending only when there is none), so /DA doesn't grow per edit; sizes clamp to 300 like parse_da.
- A size- or font-only edit leaves widgets untouched; an indirect /MK or /BS is updated where it lives instead of inlined into each widget.
- Draft::new says why: a widgetless field gets its own message, not 'could not be found'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Tests: pin the session clock in the bulk-fields harness (save_bytes stamps /ModDate)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Tevinhead <173904641+Tevinhead@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…EKU, critical extensions) (storytold#749)

* Parity: merge the duplicate form.field-list evidence and notes

storytold#649 and storytold#650 each added `evidence` and `notes` to the same entry, so the
TOML has duplicate keys and `cargo xtask parity` fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M9: the signer's certificate must allow document signing (key usage, EKU, critical extensions)

A trusted signer whose certificate may not sign documents was reported
Valid. Validation now checks the signer certificate (RFC 5280 §4.2.1.3,
§4.2.1.12, §4.2): a keyUsage needs digitalSignature or nonRepudiation, an
extended key usage needs a document-signing purpose (any, emailProtection,
codeSigning, RFC 9336 documentSigning, Adobe Authentic Documents, Microsoft
document signing), and no critical extension may be one PdfCraft doesn't
process. Otherwise the verdict is Unknown and the details say why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M9: a critical qcStatements extension doesn't make a qualified certificate unusable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
storytold#754)

* Parity: merge the duplicate form.field-list evidence and notes

storytold#649 and storytold#650 each added `evidence` and `notes` to the same entry, so the
TOML has duplicate keys and `cargo xtask parity` fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M4: bookmarks from tagged headings (organize.bookmarks-from-structure)

Bookmark options > New bookmarks from structure (command
bookmark.from_structure, tool bookmark_from_structure) turns a tagged
document's headings into bookmarks, as Acrobat's New Bookmarks From
Structure does for headings: H1-H6 through the role map, a plain H by its
Sect/Part/Art nesting, nested by level under a new first "Untitled"
bookmark, each linked to its structure element (/SE, ISO 32000-2
§12.3.3). Titles come from /ActualText, the marked text drawn on the page
(decoded through the font's ToUnicode or encoding), /Alt or /T.

The structure walk is bounded (depth, visits, heading and title caps,
seen-set) and survives self-referencing elements; an untagged document
gets an actionable error; the edit is one undo step under the assemble
permission. Not yet: choosing other element types, and destinations at the
heading's position rather than its page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Tests: size the shared raster allowance from thumbnail demand

The canvas test planted a 132×171 thumbnail whose tag did not match the
request finish_render_frame computes. On FreeBSD that real render finished
in the same frame, so the retained raster exceeded 132×171×4. Plant a
thumbnail that already satisfies demand and compare against that size.

* M4: a heading's text stops gathering once it is far past the title length

A heading whose marked-content list repeats one mark up to the visit cap could otherwise collect
about a gigabyte before the title is cut to 256 characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
…ide formulas; connector adjust defaults; table-driven test over all presets
@Harrison-Booth

Copy link
Copy Markdown
Contributor

I checked this table against real PowerPoint today (PowerPoint for Windows, 16.0 build 20527), driven through its automation interface.

How: for each preset I made a new 200 × 100 pt shape with all four margins at 0, word wrap on, autosize off and one "x" at 8 pt. The left and top edges come from left-aligned, top-anchored text (BoundLeft, BoundTop). The right and bottom edges come from right-aligned, bottom-anchored text (BoundLeft + BoundWidth, BoundTop + BoundHeight). The right-hand values carry a constant 1.63 pt (the width of the end-of-paragraph mark), which I subtracted. Values are in points, left / top / right / bottom.

preset PowerPoint this PR main
parallelogram 27.08 / 13.54 / 172.83 / 86.46 27.083 / 13.542 / 172.917 / 86.458 17.5 / 8 / 182.5 / 92 (differs)
trapezoid 16.67 / 8.33 / 183.29 / 100 16.667 / 8.333 / 183.333 / 100 16.5 / 20 / 183.5 / 100 (differs)
diamond 50 / 25 / 150 / 75 50 / 25 / 150 / 75 same
hexagon 25 / 12.5 / 175 / 87.5 25 / 12.5 / 175 / 87.5 15 / 14 / 185 / 86 (differs)
plus 0 / 25 / 200 / 75 0 / 25 / 200 / 75 same
heart 33.33 / 25 / 166.58 / 66.67 33.333 / 25 / 166.667 / 66.667 40 / 25 / 160 / 70 (differs)
triangle 50 / 50 / 150 / 100 50 / 50 / 150 / 100 same
rtTriangle 16.67 / 58.33 / 116.66 / 91.67 16.667 / 58.333 / 116.667 / 91.667 same
roundRect 4.88 / 4.88 / 195 / 95.12 4.882 / 4.882 / 195.118 / 95.118 same

All 9 rows in this PR's table agree with PowerPoint: left and top within 0.01 pt, right and bottom within 0.09 pt (the right and bottom values depend on my 1.63 pt estimate for the end-of-paragraph mark, which is why they are a little looser). main differs from PowerPoint on 4 of the 9 (parallelogram, trapezoid, hexagon, heart). The main values come from crates/geom/src/preset.rs as of 27009cd9; I did not build or run this PR's branch, only compared its table to PowerPoint.

Limits: this is PowerPoint for Windows only (no Mac build here), and I only tested these 9 presets, so I can't say anything about the rest of the table.

@echelon, in case it helps: could this be merged? The numbers support it. Thank you @NikitkaRa for the thorough work.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: every preset shape's text rectangle comes from presetShapeDefinitions, with a table-driven test over all presets. A new module preset_text holds the rectangles and defaults(name) returns each preset's default adjust values from the catalogue or, for connectors the gallery does not list, from the standard. presetShapeDefinitions.xml is part of ECMA-376, whose formulas are part of the specification; the question is whether the table was transcribed by the contributor from the standard's text (acceptable, it is the file format's definition) or copied from another implementation's source (LibreOffice's or Apache POI's table), which carries its own licence. The PR should say which. A test over all presets proves completeness. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

Small fixes needed (not certain):

Text rectangles for all preset shapes are now evaluated from the standard's guide formulas. The outlines stay as they were, and connectors 4 and 5 get the standard's default adjust values.

  • crates/geom/src/preset_text.rs:34-76: each formula operator (*/, +-, +/, ?:, pin, at2, cat2, sat2, mod, the trig ops) matches the standard's definition. Division by zero and non-finite results fall back to 0, so file data cannot make it panic.
  • crates/geom/src/preset.rs:726-733: build keeps the outline from build_outline and only replaces text_rect when the preset has a row in the table. Unknown names and non-finite sizes behave as before.
  • crates/geom/src/preset.rs:340-349: defaults() gives bentConnector4/5 and curvedConnector4/5 the standard's 50000 values. Before, a connector without an avLst drew its middle segment at x = 0.
  • crates/pptx/src/read/shapes.rs:180 still pads guides missing from a file with preset::info(..).defaults, so a connector 4/5 with only adj2 gets 0 for adj1. Using preset::defaults(&name) here too would make reading consistent with building and writing.
  • crates/geom/src/preset.rs: the per-preset text rectangles still computed in build_outline (for example star_text_rect at line 560) are now overridden for every preset in the table. Removing them later would leave a single source of truth.
  • crates/geom/src/preset_text.txt: the ellipseRibbon/ellipseRibbon2 rows keep a first q1 definition that refers to the pruned guide x3. It has no effect because q1 is redefined right after, but the generator's dependency pruning does not follow duplicate guide names.

Claims checked:

  • verified: Every preset's text rectangle is computed from the standard's guide formulas through generated data and a small evaluator; outlines are unchanged. (crates/geom/src/preset.rs:726-733: build() calls build_outline() and then replaces only text_rect with preset_text::text_rect(). crates/geom/src/preset…
  • unverified: An audit of 187 presets at three sizes found 162 text-rectangle mismatches across about 55 presets, all now fixed; a new table-driven test reports zero mismatches. (The table-driven test (crates/geom/tests/preset_table.rs) and its expected table (crates/geom/tests/fixtures/preset_table.txt) are gen…
  • verified: Bent/curved connectors 4 and 5 now get the standard's adjust defaults through preset::defaults(), which the PPTX writer also uses. (crates/geom/src/preset.rs:340-349 returns [50000, 50000] or [50000, 50000, 50000] for these connectors. preset.rs:741 uses it in build_outline, and crates/pptx/src/wri…
  • verified: The star4/star5 text rectangle fixes from the earlier change now come from the general mechanism. (crates/geom/src/preset_text.txt has star4 and star5 rows with the standard's sx/sy guides. crates/geom/src/preset.rs:729-731 overrides the star_text_rect result computed at preset.rs:1670.)

Recommendation: merge after the fixes above; they may be pushed to this branch.

Reviewed at d129ad6.

@aiongg

aiongg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Automated message. Not a maintainer decision.

This branch conflicts with main. Could you merge or rebase main into it? The conflict needs a person to resolve.

dylanmtaylor pushed a commit to storytold/craft-libs that referenced this pull request Nov 12, 2026
…eDefinitions

Ported from storytold/deckcraft#650 by @NikitkaRa. Its preset::defaults is #1851's
adjust_defaults, which this repository already has.
dylanmtaylor added a commit to storytold/craft-libs that referenced this pull request Nov 12, 2026
…ur fixes from open DeckCraft PRs (#1023)

* craft-drawingml preset: the extra outlines dispatch on a Name enum

Ported from storytold/deckcraft#739 by @Bryson14.

* craft-drawingml preset: the 3- and 4-bend elbow and the curved connectors follow presetShapeDefinitions

Ported from storytold/deckcraft#1851 by @Hamza0101.

* craft-drawingml warp: text on a guide sets each glyph down whole

Ported from storytold/deckcraft#1799 by @leobasilio.

* craft-drawingml preset: the Name dispatch test's digests as this repository builds the outlines

The digests in storytold/deckcraft#739 were taken on DeckCraft's fc35ad67. Here two curved arrows
digest differently both before and after the refactor (the preset sources are identical), so the
test now holds the values from craft-libs 2b35d24, before the refactor.

* craft-drawingml preset: every preset's text rectangle from presetShapeDefinitions

Ported from storytold/deckcraft#650 by @NikitkaRa. Its preset::defaults is #1851's
adjust_defaults, which this repository already has.

* craft-drawingml custgeom: connection sites (a:cxnLst) read in the shape space and written back

Ported from the format part of storytold/deckcraft#1748 by @jagjordi.

* craft-drawingml color: behaviour-preserving cleanups

Ported from storytold/deckcraft#1610 by Cédric Legrand.

* craft-drawingml: resolve current-main API and test conflicts

* craft-pptx: use DrawingML writer defaults for custom paths

* craft-drawingml: strengthen geometry regression checks

---------

Co-authored-by: Bryson Meiling <bryson.meiling@gmail.com>
Co-authored-by: Hamza <mail.hamzanaveed@gmail.com>
Co-authored-by: Leonardo <leobasilio@gmail.com>
Co-authored-by: Nikita Rakitin <nnnrrr93@gmail.com>
Co-authored-by: Jordi <jordiag@kth.se>
Co-authored-by: Cédric Legrand <cedric@legrand-tech.fr>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants