Skip to content

[p5.js 2.0 Bug Report]: Typography methods generate false error messages #8113

@quarks

Description

@quarks

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.5

Web browser and version

Firefox 143.0.1

Operating system

MacOSX 15.6.1

Steps to reproduce this

Many of the typography methods return the current value when called with no parameters, this is expected and matches the V1 behaviour.

This still happens in V2 but it also generates a friendly error warning of missing parameters even though allowed.

Also in the reference section these methods don't show the method declaration with no parameters (it did in V1 ref).

The following code demonstrates the friendly error generations with V2

// p5.disableFriendlyErrors = true;

function setup() {
  createCanvas(400, 400);
  // These display a friendly warning in V2 even though a parameter is not required
  console.log(`Align:`, textAlign());
  console.log(`Font:`, textFont());
  console.log(`Style:`, textStyle());
  console.log(`Size:`, textSize());
  console.log(`Leading:`, textLeading());
  // The following work as expected in V2 (i.i. same as V1)
  console.log(`Ascent:`, textAscent());
  console.log(`Descent:`, textDescent());
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions