Sets or gets the current font weight.
The textWeight() function is used to specify the weight (thickness) of the text. When a numeric value is provided, it sets the font weight to that value and updates the rendering properties accordingly (including the "font-variation-settings" on the canvas style). When called without an argument, it returns the current font weight setting.
Examples
Syntax
textWeight(weight)
textWeight()
Parameters
weight
Number: The numeric weight value to set for the text.
Returns
Number: If no arguments are provided, the current font weight
Notice any errors or typos? Please let us know. Please feel free to edit src/type/textCore.js and open a pull request!
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.