def text.path.glyph

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

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

3564def text.path.glyph(+as: List<&2, XML.Attr>, +edges: List<&2, Edge>, +total: F32, offset: F32, +mat: Matrix) -> List<&2, XML.Element>:
3565  Matrix{a, b, c, d, e, f} = mat
3566  +advance = U.scalar(XML.attr.get(as, "#glyph-advance", "0"), 0.0)
3567  +mid = (e + advance * F32.sqrt((a * a + b * b : F32)) / 2.0 + offset : F32)
3568  U.branch(List<&2, XML.Element>, F32.is_lt(mid, 0.0) || F32.is_gt(mid, total) || F32.is_le(total, 0.0), _ => Nil{},
3569    _ => Con{XML.Element{"#glyph", Con{XML.Attr{"#glyph-transform", matrix.show(text.path.glyph.matrix(mat, text.path.at(edges, mid, identity()), advance))}, as}, Nil{}, ""}, Nil{}})

Uses (21)

Used by (1)