modus

The module text_shaping

Text shaping as a module (docs/FONTS.md, section 12.3): each export calls one function of support/text_shaping over tables in memory of the caller. The spacing of the font is two tables of the caller: the advances of the characters 32 to 126 and the pairs, of one scale of a glyph cache (text_shaping.spacing_of gives them from a cache). The module holds no state of a program.

The tables are hostile input: the counts are checked here; each advance, each pair, each byte and each range is read once by the package, and kept in its limits there, because the caller can change them during the call.

FactValue
Sourcemodules/text_shaping
Boot imagein the boot image; the image is not built, so its size is not known
Importsnone
Imported bynone

Exports

ExportWhat it does
shape_text(advances: Table(Character_Advance, Read), pairs: Table(Pair_Entry, Read), text: Bytes(Read), placed: Table(Placed_Glyph, Append)) -> Integerappends the placed glyphs of a text: one for each byte, x from the origin of the text and the advance with the pair adjustment, in 1/64 of a pixel
measure_texts(advances: Table(Character_Advance, Read), pairs: Table(Pair_Entry, Read), text: Bytes(Read), ranges: Table(Text_Range, Change)) -> Integerwrites the width of each text of a table of ranges into one table of bytes, in 1/64 of a pixel: a window measures all its labels in one call

Read from the source of the module, as the build reads it to describe the exports (tools/kerneltool/describe.odin).