Summary
svglib does not implement the CSS/SVG 2 length units introduced after SVG 1.1.
These units are increasingly common in modern SVG content.
Missing units
| Unit |
Meaning |
Resolution strategy |
rem |
Root element font-size |
Capture root font-size during render and use as rem base |
vw |
1% of viewport width |
Resolve against main_box.width (already tracked) |
vh |
1% of viewport height |
Resolve against main_box.height (already tracked) |
vmin |
Smaller of vw and vh |
min(vw, vh) |
vmax |
Larger of vw and vh |
max(vw, vh) |
q |
Quarter-millimetre (0.25 mm) |
Straightforward physical conversion |
ch is already approximated as 0.5em.
Notes
vw/vh should treat the outermost SVG canvas as the viewport (the PDF
render target has no browser viewport).
rem requires storing the computed root font-size on Svg2RlgAttributeConverter
before the tree walk begins.
- The
convertLength method in Svg2RlgAttributeConverter already has the
right structure to add these as new elif branches.
- Target: 2.1 (after 2.0 coordinate-system change stabilises).
Summary
svglib does not implement the CSS/SVG 2 length units introduced after SVG 1.1.
These units are increasingly common in modern SVG content.
Missing units
remfont-sizeduring render and use asrembasevwmain_box.width(already tracked)vhmain_box.height(already tracked)vminvwandvhmin(vw, vh)vmaxvwandvhmax(vw, vh)qchis already approximated as 0.5em.Notes
vw/vhshould treat the outermost SVG canvas as the viewport (the PDFrender target has no browser viewport).
remrequires storing the computed root font-size onSvg2RlgAttributeConverterbefore the tree walk begins.
convertLengthmethod inSvg2RlgAttributeConverteralready has theright structure to add these as new
elifbranches.