Commit Graph
4 Commits
Author SHA1 Message Date
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
Dylan M. Taylor 7b59dff881 svg-paths: charge sibling and ancestor selector walks to the selector budget (#835) 2026-11-11 15:47:33 -05:00
Dylan M. Taylor 12e24c1029 svg-paths: CSS colour parser and a small SVG writer (#857)
color: parses the CSS colours SVG paint uses (hex, rgb()/hsl(), the 148 named
colours) into an opaque 8-bit sRGB Color, and writes the canonical #rrggbb form.
Shape::stroke is still returned as written; parse_color reads it.

write: SvgWriter (XML declaration, root element with the SVG namespace, elements
and attributes escaped through craft-xml, caller-controlled line breaks), path
data in shortest round-trip form or with fixed decimals, and fixed-decimal
numbers that are never NaN or infinite.
2026-11-11 14:57:46 -05:00
Dylan M. Taylor 3dcaa07a81 Add craft-svg-paths: SVG geometry reader (#802)
Reads an SVG's shapes, clips and page size into kurbo paths in millimetres, with a bounded CSS cascade and fail-closed handling of unsupported content. The caller maps style to its own shape kinds.
2026-11-11 06:23:12 -05:00