Skip to content
Shapemetry

@huukhanhnguyen/geometry / namespaces/Text

namespaces/Text

measure

const measure: (font_ids, text, size) => string = wasm.text_measure

{ width, height } of one shaped line at size.

Parameters

font_ids

Uint32Array

text

string

size

number

Returns

string


outlines

const outlines: (font_ids, text, options_json) => string = wasm.text_outlines

Shaped glyph outlines as an array of ContourJson contours (Path2d shapes[] entries) — no adapter.

Parameters

font_ids

Uint32Array

text

string

options_json

string

Returns

string


outlinesClean

const outlinesClean: (font_ids, text, options_json) => string = wasm.text_outlines_clean

text_outlines with overlapping rings merged through the crate's own curve-preserving region boolean.

Parameters

font_ids

Uint32Array

text

string

options_json

string

Returns

string


shape

const shape: (font_ids, text, options_json) => string = wasm.text_shape

Full text shaping — NFC, bidi/script itemization, GSUB substitution and GPOS positioning with mark attachment, and per-cluster fallback down the font list. Returns [{ fontId, glyphId, cluster, x, y, xAdvance, yAdvance }] in output units, y up, visual order. font_ids is ordered: the first font that covers a cluster supplies it.

Parameters

font_ids

Uint32Array

text

string

options_json

string

Returns

string


wrapLines

const wrapLines: (font_ids, text, size, max_width) => string = wasm.text_wrap_lines

Greedy word wrap at max_width, returning the lines as a JSON string array.

Parameters

font_ids

Uint32Array

text

string

size

number

max_width

number

Returns

string

Last updated: 📖 1 min readEdit on GitHub