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
Returns
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.