def text.chunk

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

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

3264def text.chunk(+cursor: TextCursor) -> List<&2, TextChunk>:
3265  TextCursor{x, y, index, chunk, start, anchor, prev, pc, pf, ps, seen, blankState, trailing, spacing, chunks} = cursor
3266  +width = (x - start - trailing - spacing : F32)
3267  Con{TextChunk{chunk, U.choose(F32, U.string.equal(anchor, "middle"), (width / 2.0 : F32), U.choose(F32, U.string.equal(anchor, "end"), width, 0.0))}, chunks}

Uses (8)

Used by (4)