MCPcopy Index your code
hub / github.com/processing/p5.js / _lineateAndPathify

Method _lineateAndPathify

src/type/p5.Font.js:722–746  ·  view source on GitHub ↗
(str, x, y, width, height, options = {})

Source from the content-addressed store, hash-verified

720 Returns an array of line objects, each containing { text, x, y, glyphs: [ {g, path} ] }
721 */
722 _lineateAndPathify(str, x, y, width, height, options = {}) {
723
724 let renderer = options?.graphics?._renderer || this._pInst._renderer;
725 renderer.push();
726 renderer.textFont(this);
727
728 // lineate and compute bounds for the text
729 let { lines, bounds } = renderer._computeBounds
730 (textCoreConstants._FONT_BOUNDS, str, x, y, width, height,
731 { ignoreRectMode: true, ...options });
732
733 // compute positions for each of the lines
734 lines = this._position(renderer, lines, bounds, width, height);
735
736 // convert lines to paths
737 let uPE = this.data?.head?.unitsPerEm || 1000;
738 let scale = renderer.states.textSize / uPE;
739
740 const axs = this._currentAxes(renderer);
741 let pathsForLine = lines.map(l => this._lineToGlyphs(l, { scale, axs }));
742
743 renderer.pop();
744
745 return pathsForLine;
746 }
747
748 _currentAxes(renderer) {
749 let axs;

Callers 1

textToPathsMethod · 0.95

Calls 5

_positionMethod · 0.95
_currentAxesMethod · 0.95
_lineToGlyphsMethod · 0.95
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected