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

Method _renderText

src/core/p5.Renderer2D.js:1105–1130  ·  view source on GitHub ↗
(text, x, y, maxY, minY)

Source from the content-addressed store, hash-verified

1103 }
1104
1105 _renderText(text, x, y, maxY, minY) {
1106 let states = this.states;
1107 let context = this.textDrawingContext();
1108
1109 if (y < minY || y >= maxY) {
1110 return; // don't render lines beyond minY/maxY
1111 }
1112
1113 this.push();
1114
1115 // no stroke unless specified by user
1116 if (states.strokeColor && states.strokeSet) {
1117 context.strokeText(text, x, y);
1118 }
1119
1120 if (!this._clipping && states.fillColor) {
1121
1122 // if fill hasn't been set by user, use default text fill
1123 if (!states.fillSet) {
1124 this._setFill(DefaultFill);
1125 }
1126 context.fillText(text, x, y);
1127 }
1128
1129 this.pop();
1130 }
1131
1132 /*
1133 Position the lines of text based on their textAlign/textBaseline properties

Callers 1

textCoreFunction · 0.80

Calls 4

textDrawingContextMethod · 0.95
pushMethod · 0.95
_setFillMethod · 0.95
popMethod · 0.95

Tested by

no test coverage detected