def document.size

gralha-svg-render@0.1.0.1 · svg.bend:3953

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-xml-doc@0.1.0.1/xml.bend as XML

3953# The document viewport and the output matrix have independent dimensions.
3954def document.size(+root: XML.Element, +w: F32, +h: F32) -> Point:
3955  XML.Element{n, attrs, kids, txt} = root
3956  +kinds = XML.elements.kinds(kids, 0)
3957  +styled = document.styled(U32.is_gt(U32.and(kinds, 9), 0), kids, w, h)
3958  +as = image.svg.attrs(image.svg.root(styled))
3959  Point{U.max(0.0, viewport.dimension(as, "width", w)), U.max(0.0, viewport.dimension(as, "height", h))}

Uses (11)

Used by (2)