Sets or gets a single text property for the renderer.
The textProperty()
function allows you to set or retrieve a single text-related property, such as textAlign
, textBaseline
, fontStyle
, or any other property that may be part of the renderer's state, its drawing context, or the canvas style.
When called with a prop
and a value
, the function sets the property by checking for its existence in the renderer's state, the drawing context, or the canvas style. If the property is successfully modified, the function applies the updated text properties. If called with only the prop
parameter, the function returns the current value of that property.
Examples
Syntax
textProperty(prop, value)
textProperty(prop)
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.