diff --git a/src/typography/loading_displaying.js b/src/typography/loading_displaying.js index f625db3d99..ff9bff7093 100644 --- a/src/typography/loading_displaying.js +++ b/src/typography/loading_displaying.js @@ -364,6 +364,24 @@ p5.prototype.text = function(str, x, y, maxWidth, maxHeight) { * *
+ * // WEBGL Example
+ * function preload() {
+ * createCanvas(100, 100, WEBGL);
+ * textFont('Courier New'); // In WebGL textFont has to be executed in preload
+ * }
+ *
+ * function setup() {
+ * background(200);
+ * textSize(24);
+ * text('hi', 35, 55);
+ *
+ * describe('The text "hi" written in a black, monospace font on a gray background.');
+ * }
+ *
+ *
* function setup() {
* background('black');
* fill('palegreen');
diff --git a/src/webgl/text.js b/src/webgl/text.js
index b5d642cc81..aff8a8db96 100644
--- a/src/webgl/text.js
+++ b/src/webgl/text.js
@@ -642,7 +642,8 @@ class FontInfo {
p5.RendererGL.prototype._renderText = function(p, line, x, y, maxY) {
if (!this._textFont || typeof this._textFont === 'string') {
console.log(
- 'WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont` for more details.'
+ 'WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont`' +
+ '(both of which have to be executed in preload() for WebGL mode when loading a new font) for more details.'
);
return;
}