Svg.text.fit.nodes: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 3465-3479 of gralha-svg-render@0.1.0.1/svg.bend: https://jend.leeeet.dev/read.txt?path=gralha-svg-render@0.1.0.1/svg.bend&start_line=3465&end_line=3479 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 def text.fit.nodes(+xs: List<&2, XML.Element>, +origin: F32, +ratio: F32, +step: F32, +skip: String, +count: U32, +fixed: F32) -> TextFit: match xs: case Nil{}: TextFit{Nil{}, count, fixed} case Con{XML.Element{n, as, kids, txt}, rest}: +attrs = as +tagname = n +locked = U.string.equal(XML.attr.get(attrs, "#length-fixed", ""), "yes") +glyph = U.string.equal(tagname, "#glyph") +x = U.scalar(XML.attr.get(attrs, "#length-x", "0"), 0.0) +delta = ((x - origin - fixed) * (ratio - 1.0) + U32.to_f32(count) * step : F32) text.fit.then(U.branch(TextFit, locked || (glyph && Bool.not(U.string.equal(XML.attr.get(attrs, "#text-index", ""), skip))), _ => TextFit{Con{XML.Element{tagname, text.length.attrs(attrs, U.choose(F32, locked, 1.0, ratio), delta), text.length.translate(kids, delta), txt}, Nil{}}, U32.inc(count), (fixed + U.choose(F32, locked, U.scalar(XML.attr.get(attrs, "#length-width", "0"), 0.0), 0.0) : F32)}, _ => text.fit.group(tagname, attrs, txt, text.fit.nodes(kids, origin, ratio, step, skip, count, fixed))), nextCount => nextFixed => text.fit.nodes(rest, origin, ratio, step, skip, nextCount, nextFixed)) Uses (23): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.inc https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_f32 https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=TextFit https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=text.fit.group https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=text.fit.then https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=text.length.attrs https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=text.length.translate https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=scalar https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=string.equal https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Element https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=attr.get