@huukhanhnguyen/geometry / namespaces/Text
namespaces/Text
measure
constmeasure: (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
constoutlines: (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
constoutlinesClean: (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
constshape: (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
constwrapLines: (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