Skip to content

[p5.js 2.0 Beta Bug Report]: Confusing log when loading font with callback #7541

Open
@aferriss

Description

@aferriss

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.0.0 beta 2

Web browser and version

Chrome 132.0.6834.111

Operating system

MacOSX Sequoia 15.2

Steps to reproduce this

When loading a font with a callback in 2.0, a message is generated to the console that says:
🌸 p5.js says: Expected at most 1 argument, but received more in loadFont(). For more information, see https://p5js.org/reference/p5/loadFont..

Unless the docs are out of date, I thought callbacks were still supported, so we probably shouldn't be logging this message. If I'm wrong about the api changes, then maybe we should log a message about the callback api being no longer supported. I'm not super up to date on all the changes in 2.0 so feel free to close if this is a non-issue!

Steps:

  1. Call loadFont("myfont.ttf", font => {})
  2. Observe the warning in the console

Snippet:

https://editor.p5js.org/aferriss/sketches/dEb0fiahL

function setup() {
  createCanvas(400, 400);
  
  loadFont("Arial.ttf", font => {
    textFont(font);
    // Check console
  })
}

function draw() {
  background(220);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions