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:
typeis one of'M','L','Q','C', or'Z',coordsare 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])
Parameters
str
String: The text to convert into path commands.
x
Number: x‐coordinate of the text baseline.
y
Number: y‐coordinate of the text baseline.
width
Number: Optional width for text wrapping.
height
Number: Optional height for text wrapping.
Returns
Array[]: A flat array of path commands.
Notice any errors or typos? Please let us know. Please feel free to edit src/type/p5.Font.js and open a pull request!