feat(odf): draw a custom shape as the shape, not as its box - #799
Merged
Conversation
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
from
August 31, 2026 06:07
19a4a54 to
004227b
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry-render
branch
from
August 31, 2026 06:07
d67ffd5 to
a291432
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
from
August 31, 2026 06:10
004227b to
a75a25e
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry-render
branch
from
August 31, 2026 06:10
a291432 to
caf9df2
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
2 times, most recently
from
August 31, 2026 19:41
16404bc to
e4f645c
Compare
`html::translate_custom_shape` carried a `// TODO draw shape in svg` and emitted a positioned `<div>` with fill and stroke — the bounding box, never the shape. Every one of the corpus's 350 custom shapes came out a rectangle, arrows, callouts, rings and stars alike. Closes #159. `read_path` now resolves a `draw:custom-shape`'s `draw:enhanced-geometry` through the languages the previous change added: `svg:viewBox` gives the box the formulas measure against, `draw:modifiers` fills `$0`, `$1`, …, the `draw:equation` children resolve on demand and are memoised, with a reference that cycles resolving to nothing rather than recursing, and `draw:enhanced-path` becomes the svg `d`. `draw:mirror-horizontal` and `draw:mirror-vertical` are folded into the coordinates as they are written, rather than into a transform: the pen keeps tracking the unmirrored geometry, so the angles and radii an arc needs are computed once, and only the emitted numbers and the sweep flags are reflected. The path is drawn with `fill-rule="evenodd"`, which is what leaves a ring its hole; the corpus has one. Not done, and recorded in `PLAN.md`: `draw:text-areas`, so a shape's text is still laid out in the whole box; `draw:handle`, which only an editor needs; and `F`/`S`, which want one subpath painted differently from the rest. `hasstroke` and `hasfill` evaluate as true because the geometry reader has no style in hand — no corpus formula reads them. Checked against libreoffice's own png export of `sample.odg` and `SpotfaceCoord40270-L.odg`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017XABfEapaADjFQCt1vjmDF
36 files. Every changed line is an insertion — 740 `<svg><path>` pairs where a custom shape used to be a plain box; nothing is removed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UJ6NPShQBp1nX7WuMvty8V
andiwand
force-pushed
the
odf-drawings/enhanced-geometry-render
branch
from
August 31, 2026 19:51
caf9df2 to
3b8c0a0
Compare
This was referenced Aug 31, 2026
andiwand
added a commit
that referenced
this pull request
Aug 31, 2026
`PLAN.md` said to delete it once nothing was left under *Today*, and #771's four goals are on main: `draw:transform` (#796), the shape elements with no parser (#797), `draw:enhanced-geometry` (#798, #799) and the `draw:object` chart (#800). What remains of drawings is the unticked boxes in `README.md`; the two decisions the plan held that the checklist cannot express — preset `draw:type` shapes and connector routing — move to `AGENTS.md`. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
Stage 4 of #771, on main now that #798 has landed. Closes #159.
html::translate_custom_shapecarried a// TODO draw shape in svgand emitteda positioned
<div>with fill and stroke — the bounding box, never the shape.Every one of the corpus's 350 custom shapes came out a rectangle, arrows,
callouts, rings and stars alike.
read_pathnow resolves adraw:custom-shape'sdraw:enhanced-geometrythrough the languages #798 added:
svg:viewBoxgives the box the formulasmeasure against,
draw:modifiersfills$0,$1, …, thedraw:equationchildren resolve on demand and are memoised, with a reference that cycles
resolving to nothing rather than recursing, and
draw:enhanced-pathbecomesthe svg
d.Notes
draw:mirror-horizontalanddraw:mirror-verticalare folded into thecoordinates as they are written, rather than into a transform: the pen keeps
tracking the unmirrored geometry, so the angles and radii an arc needs are
computed once, and only the emitted numbers and the sweep flags are
reflected.
fill-rule="evenodd", which is what leaves a ring itshole; the corpus has one.
hasstrokeandhasfillevaluate as true because the geometry reader has nostyle in hand — no corpus formula reads them.
Not done, and recorded in
PLAN.mddraw:text-areas, so a shape's text is still laid out in the whole box;draw:handle, which only an editor needs; andF/S, which want one subpathpainted differently from the rest.
Verification
Checked against libreoffice's own png export of
sample.odgandSpotfaceCoord40270-L.odg.The reference-output pin is advanced: 36 files, every changed line an insertion
— 740
<svg><path>pairs where a custom shape used to be a plain box, andnothing removed.