Commit Graph
14 Commits
Author SHA1 Message Date
Dylan M. Taylor b5dfdb0bda Fix shared file import edge cases 2026-11-13 07:50:09 -05:00
Dylan M. Taylor f4f48a9ac2 Make open clip fixtures explicitly stroked 2026-11-13 07:36:18 -05:00
Dylan M. Taylor ee548f530c Avoid unused fill contour flag 2026-11-13 07:36:18 -05:00
Dylan M. Taylor 2a8bb6a4e3 Harden neutral vector import and shared output 2026-11-13 07:36:18 -05:00
Dylan M. Taylor 62e2328905 Add shared neutral file import and writer registry 2026-11-13 07:36:18 -05:00
Dylan M. Taylor 59c52ac1dc Merge pull request #1174 from dylanmtaylor/codex/vector-file-imports
Add shared vector path import APIs
2026-11-13 07:35:46 -05:00
Dylan M. Taylor 4546555126 Fix bounds and limits in shared vector readers 2026-11-13 05:42:34 -05:00
Dylan M. Taylor e3d76471f6 Fix vector import edge cases from review 2026-11-13 03:58:22 -05:00
Dylan M. Taylor 85ed941ac5 Address vector import review findings 2026-11-13 03:58:22 -05:00
Dylan M. Taylor 5082d8bd95 Add structured SVG scene writer 2026-11-13 03:58:22 -05:00
Dylan M. Taylor 3afade5163 Expose renderer-neutral SVG preflight 2026-11-13 00:13:31 -05:00
Dylan M. Taylor 9fd3db9484 craft-svg: report the decoded size of nested SVGZ input
* svg: include decoded size in nested stream errors
2026-11-12 06:26:19 -05:00
Dylan M. Taylor 43f65a9210 craft-svg: usvg behind a bounded tree feature; attribute guard; Inkscape layer names (#937)
* craft-svg paths: a shape carries the name of its Inkscape layer

Shape::layer is the inkscape:label (else the id) of the innermost
<g inkscape:groupmode="layer"> around the element, so a CAD or cutter
import can keep the drawing's layers.

* craft-svg guard: bound attributes per element and over the document; find entities holding markup

too_wide is the attribute check of storytold/figcraft#2251: an XML
reader checks each attribute against the earlier ones on its element,
so an element with millions of them is quadratic work before any other
limit applies. entity_holds_markup lets a caller refuse a document type
whose entities become elements, as PhotoCraft does.

* craft-svg: feature `tree`, usvg behind one bounded entry point

usvg 0.48.1 (Apache-2.0 OR MIT), re-exported as craft_svg::tree::usvg,
so every app parses with one version and one set of checks:
tree::parse runs svgz, the entity, attribute and nesting guards, the
reference-chain height (VectorCraft's depth::height, on this crate's
cascade), then usvg. tree::image_resolver bounds embedded SVGs
(FigCraft's budget::resolver). tree::draw bounds what drawing a tree
with resvg allocates (PhotoCraft's svg/limits.rs).

Part of #778 and #789.
2026-11-11 18:46:38 -05:00
Dylan M. Taylor a266035672 craft-svg: craft-svg-paths grows into the SVG crate, with sniffing, SVGZ and pre-parse guards (#881)
crates/svg-paths becomes crates/svg (package craft-svg); the geometry
reader is craft_svg::paths (was the crate root), color and write keep
their names. craft-svg-paths stays as a crate that re-exports them.

New, merged from the copies the apps keep:
- sniff: is_svg, is_svgz
- svgz: bounded gunzip, UTF-8/UTF-16/ISO 8859-1 decoding, compression
- guard: element nesting and entity expansion measured on the text
  (VectorCraft's import/depth.rs text pass and entities.rs)

paths: a smooth segment with no control point to reflect starts at the
current point (S after a quadratic or a close, T after a cubic or a
close), and a relative root width or height (100%, 2em) counts as
absent instead of failing the import.

Part of #778 and #789.
2026-11-11 16:40:42 -05:00