* Returns an array of arrays of points outlining a string of text written using the * font. Each array represents a contour, so the letter O will have two outer arrays: * one for the outer edge of the shape, and one for the inner edge of the hole. * * Each point object in a contour array
(str, x = 0, y = 0, width, height, options)
| 339 | * } |
| 340 | */ |
| 341 | textToContours(str, x = 0, y = 0, width, height, options) { |
| 342 | ({ width, height, options } = this._parseArgs(width, height, options)); |
| 343 | |
| 344 | const cmds = this.textToPaths(str, x, y, width, height, options); |
| 345 | const cmdContours = []; |
| 346 | for (const cmd of cmds) { |
| 347 | if (cmd[0] === 'M') { |
| 348 | cmdContours.push([]); |
| 349 | } |
| 350 | cmdContours[cmdContours.length - 1].push(cmd); |
| 351 | } |
| 352 | |
| 353 | return cmdContours.map(commands => pathToPoints(commands, options, this)); |
| 354 | } |
| 355 | /** |
| 356 | * |
| 357 | * Converts text into a 3D model that can be rendered in WebGL mode. |
no test coverage detected