def image.svg.utf8

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

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-bytes@0.1.0.1/bytes.bend as Bin

3789def image.svg.utf8(+data: Bin.Bytes, +at: U32) -> ImageCodepoint:
3790  +v = Bin.bytes.get(data, at)
3791  U.branch(ImageCodepoint, U32.is_lt(v, 128), _ => ImageCodepoint{v, 1},
3792    _ => U.branch(ImageCodepoint, U32.is_ge(v, 194) && U32.is_le(v, 223), _ => image.svg.utf8.tail(data, U32.inc(at), 1n, (v % 32 : U32), 128, 2),
3793      _ => U.branch(ImageCodepoint, U32.is_ge(v, 224) && U32.is_le(v, 239), _ => image.svg.utf8.tail(data, U32.inc(at), 2n, (v % 16 : U32), 2048, 3),
3794        _ => U.branch(ImageCodepoint, U32.is_ge(v, 240) && U32.is_le(v, 244), _ => image.svg.utf8.tail(data, U32.inc(at), 3n, (v % 8 : U32), 65536, 4), _ => ImageCodepoint{65533, 1}))))

Uses (12)

Used by (1)