def text.measure.nodes

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

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

3419def text.measure.nodes(xs: List<&2, XML.Element>, +skip: String, +acc: TextMeasure) -> TextMeasure:
3420  match xs:
3421    case Nil{}: acc
3422    case Con{XML.Element{n, as, kids, txt}, rest}:
3423      +attrs = as
3424      +glyph = U.string.equal(n, "#glyph")
3425      +fixed = U.string.equal(XML.attr.get(attrs, "#length-fixed", ""), "yes")
3426      text.measure.nodes(rest, skip, U.branch(TextMeasure, (glyph && Bool.not(U.string.equal(XML.attr.get(attrs, "#text-index", ""), skip))) || fixed,
3427        _ => text.measure.add(acc, U.scalar(XML.attr.get(attrs, "#length-x", "0"), 0.0), U.scalar(XML.attr.get(attrs, "#length-width", "0"), 0.0), U.scalar(XML.attr.get(attrs, "#length-extra", "0"), 0.0), fixed),
3428        _ => text.measure.nodes(kids, skip, acc)))

Uses (12)

Used by (2)