def text.character

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

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-truetype@0.1.0.1/font.bend as Font

3394def text.character(+cursor: TextCursor, +font: TextFont, frames: List<&2, TextFrame>, +ch: U32) -> TextLayout:
3395  TextCursor{x, y, index, chunk, start, anchor, prev, pc, pf, ps, seen, previousSpace, trailing, spacing, chunks} = cursor
3396  TextFont{size, face, weight, slant, fa, letter, word, shift, baseline, kern, preserve, book} = font
3397  +blank = U.space(ch)
3398  +value = U.choose(U32, blank, 32, ch)
3399  U.branch(TextLayout, blank && previousSpace && Bool.not(preserve), _ => TextLayout{Nil{}, cursor},
3400    _ => text.place(cursor, font, Font.font.glyph(book, face, value), text.position(frames, index), value))
3401
3402@unsafe

Uses (14)

Used by (1)