def text.path.at

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

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

3314def text.path.at(+xs: List<&2, Edge>, +distance: F32, fallback: Matrix) -> Matrix:
3315  match xs:
3316    case Nil{}: fallback
3317    case Con{Edge{x, y, u, v, stroked, closed}, rest}:
3318      +dx = (u - x : F32)
3319      +dy = (v - y : F32)
3320      +len = F32.sqrt((dx * dx + dy * dy : F32))
3321      +tx = (dx / len : F32)
3322      +ty = (dy / len : F32)
3323      U.branch(Matrix, F32.is_le(distance, len), _ => Matrix{tx, ty, F32.neg(ty), tx, (x + tx * distance : F32), (y + ty * distance : F32)},
3324        _ => text.path.at(rest, (distance - len : F32), Matrix{tx, ty, F32.neg(ty), tx, u, v}))

Uses (12)

Used by (2)