Sets or gets the text drawing direction.
The textDirection()
function allows you to specify the direction in which text is rendered on the canvas. When provided with a direction
parameter (such as "ltr" for left-to-right, "rtl" for right-to-left, or "inherit"), it updates the renderer's state with that value and applies the new setting. When called without any arguments, it returns the current text direction. This function is particularly useful for rendering text in languages with different writing directions.
Examples
Syntax
textDirection(direction)
textDirection()
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.