Returns an array of points outlining a string of text written using the font.
Each point object in the array has three properties that describe the point's location and orientation, called its path angle. For example, { x: 10, y: 20, alpha: 450 }
.
The first parameter, str
, is a string of text. The second and third parameters, x
and y
, are the text's position. By default, they set the coordinates of the bounding box's bottom-left corner. See textAlign() for more ways to align text.
The fourth parameter, fontSize
, is optional. It sets the text's font size. By default, font.textToPoints()
will use the current textSize().
The fifth parameter, options
, is also optional. font.textToPoints()
expects an object with the following properties:
sampleFactor
is the ratio of the text's path length to the number of samples. It defaults to 0.1. Higher values produce more points along the path and are more precise.
simplifyThreshold
removes collinear points if it's set to a number other than 0. The value represents the threshold angle to use when determining whether two edges are collinear.
उदाहरण
सिंटैक्स
textToPoints(str, x, y, [fontSize], [options])
पैरामीटर्स
string of text.
x-coordinate of the text.
y-coordinate of the text.
font size. Defaults to the current textSize().
object with sampleFactor and simplifyThreshold properties.