Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added WebGL text error and textFont documentation update #7029

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/typography/loading_displaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,24 @@ p5.prototype.text = function(str, x, y, maxWidth, maxHeight) {
*
* <div>
* <code>
* // 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.');
* }
* </code>
* </div>
*
* <div>
* <code>
* function setup() {
* background('black');
* fill('palegreen');
Expand Down
3 changes: 2 additions & 1 deletion src/webgl/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading