Returns a flat array of path commands that describe the outlines of a string of text.
Each command is represented as an array of the form [type, ...coords]
, where:
type
is one of'M'
,'L'
,'Q'
,'C'
, or'Z'
,coords
are the numeric values needed for that command.
'M'
indicates a "move to" (starting a new contour), 'L'
a line segment, 'Q'
a quadratic bezier, 'C'
a cubic bezier, and 'Z'
closes the current path.
The first two parameters, x
and y
, specify the baseline origin for the text. Optionally, you can provide a width
and height
for text wrapping; if you don't need wrapping, you can omit them and directly pass options
as the fourth parameter.
Examples
Syntax
textToPaths(str, x, y, [width], [height], [options])
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.