diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:59:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 10115489f8988cf6a649707202a51757708883a2 (patch) | |
| tree | 77fef43a67aa976484ec59c490457d23287c80c3 /test/text.script | |
| parent | f2829440b0f933422e1da5394870505d3c2d67d6 (diff) | |
| download | sketchbook-10115489f8988cf6a649707202a51757708883a2.tar.gz sketchbook-10115489f8988cf6a649707202a51757708883a2.zip | |
svg: an image that is an SVG document in a data URI is drawn
Typst places an SVG image, and a PDF page imported with image(), as an
<image> whose href is the document in base64; svg.zig skipped every
<image>, so any Typst object holding one silently lost it. The parser
now decodes such a document and walks it into the same drawing, mapped
into the image's x, y, width and height (stretched with
preserveAspectRatio="none", else fitted and centered, as SVG says),
with its own ids, gradients and percentages and nothing inherited from
around it but opacity. It is not clipped to its box (a PDF page never
draws outside itself, and a clip per shape costs the renderers a pass
over every contour). Raster images still draw nothing. The root's view
box and size come from one function both documents use.
Tests: a unit test at the end of svg.zig (ids of its own, stretched and
fitted corners, a PNG skipped); two corpus cases for zig build diff,
image.svg (two data-URI images, one stretched and turned, beside an
outer gradient that shares an id with an inner one) and typst-image.typ
(two SVGs placed by Typst): both renderers match resvg (mean 0.09-0.11).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/text.script')
0 files changed, 0 insertions, 0 deletions
