Skip to content

Commit ef2a751

Browse files
author
Lauren McCarthy
committed
warn user to load font before text closes #3811
1 parent 6188d74 commit ef2a751

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/webgl/text.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,12 @@ var FontInfo = function(font) {
613613
};
614614

615615
p5.RendererGL.prototype._renderText = function(p, line, x, y, maxY) {
616+
if (!this._textFont || typeof this._textFont === 'string') {
617+
console.log(
618+
'WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont` for more details.'
619+
);
620+
return;
621+
}
616622
if (y >= maxY || !this._doFill) {
617623
return; // don't render lines beyond our maxY position
618624
}

0 commit comments

Comments
 (0)