@huukhanhnguyen/geometry / namespaces/Font
namespaces/Font
free
constfree: (id) =>boolean=wasm.font_free
Drop a registered font. False if the id was not registered.
Parameters
id
number
Returns
boolean
metrics
constmetrics: (id) =>string=wasm.font_metrics
{ unitsPerEm, ascender, descender, lineGap }, in FONT UNITS.
Parameters
id
number
Returns
string
parse
constparse: (data,index) =>number=wasm.font_parse
Parse a font file and register it, returning the id every other text_* export takes. index selects a face inside a collection (.ttc/.otc/.dfont) and is 0 for a plain font. The bytes are copied into the registry, so the caller's buffer is free afterwards.
Parameters
data
Uint8Array
index
number
Returns
number
setVariations
constsetVariations: (id,settings_json) =>void=wasm.font_set_variations
Pin a variable font's design axes: [{"axis":"wght","value":700}]. An empty list restores the defaults.
Parameters
id
number
settings_json
string
Returns
void