Reference textProperty()

textProperty()

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

prop
String: The name of the text property to set or get.
value
The value to set for the specified text property. If omitted, the current value of the property is returned

Returns

If no arguments are provided, the current value of the specified text property
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