Closed RandomGamingDev closed 1 month ago
It looks like what's actually going on here is it's creating a WebGL canvas in the preload function before ignoring it and creating a P2D canvas automatically without a createCanvas()
statement which is how the font's actually getting loaded with no errors reporting what happened.
Example Code:
// WEBGL Example
function preload() {
createCanvas(100, 100, WEBGL); // In WebGL textFont has to be executed in preload
textFont('Courier New');
}
function setup() {
background(200);
textSize(24);
text('hi', 35, 55);
describe('The text "hi" written in a black, monospace font on a gray background.');
}
Sketch: https://editor.p5js.org/PotatoBoy/sketches/fSU62FlS3
Resolves #7028
Changes:
Replaced the previously vague error:
with
and updated
textFont()
's page to have a WEBGL example:Screenshots of the change:
PR Checklist
npm run lint
passes