processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.12k stars 3.22k forks source link

Default fonts broken in 1.9.1 #6860

Closed davepagurek closed 3 months ago

davepagurek commented 3 months ago

Most appropriate sub-area of p5.js?

p5.js version

1.9.1

Web browser and version

Firefox 117

Operating system

MacOS 14.2.1

Steps to reproduce this

It looks like https://github.com/processing/p5.js/pull/6667/files inadvertantly broke 'monospace' and 'sans-serif' as valid inputs to textFont by putting quotes around them internally.

Steps:

  1. Use textFont('sans-serif') or textFont('monospace')
  2. Draw text
  3. It still uses the default serif font

Snippet:

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  fill(0)
  textSize(20)
  textFont('sans-serif')
  textAlign(LEFT, TOP)
  text('test', 0, 0)
}

https://editor.p5js.org/davepagurek/sketches/U0Oc591xJ