def document.fit.matrix
import gralha-svg-render@0.1.0.1/svg.bend as Svgimport Base
import gralha-text-scan@0.1.0.1/scan.bend as U
3961def document.fit.matrix(size: Point, +w: F32, +h: F32) -> Matrix:
3962 Point{width, height} = size
3963 +vw = width
3964 +vh = height
3965 +zoom = U.min((w / U.max(vw, 0.000001) : F32), (h / U.max(vh, 0.000001) : F32))
3966 Matrix{zoom, 0.0, 0.0, zoom, ((w - vw * zoom) * 0.5 : F32), ((h - vh * zoom) * 0.5 : F32)}