Skip to content

[p5.js 2.0 Bug Report]: loading fonts with commas in file names fails #8077

@rofoto

Description

@rofoto

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)

p5.js version

2.0.5

Web browser and version

firefox 142.0.1 64-bit

Operating system

win 10

Steps to reproduce this

Steps:

  1. loadFont( font with commas ( , ) in the file name )

2.Uncaught (in promise) Error: Failed to create FontFace for "BodoniModa-Italic-VariableFont_opsz,wght"
n p5.2.0.5.min.js:1
Oh p5.2.0.5.min.js:1
loadFont p5.2.0.5.min.js:1
setup text_animation.js:27
#F p5.2.0.5.min.js:1
#S p5.2.0.5.min.js:1
e p5.2.0.5.min.js:1
p5 p5.2.0.5.min.js:1
promise callback*p5< p5.2.0.5.min.js:1
p5.2.0.5.min.js:1
p5.2.0.5.min.js:1:587120

Snippet:

font_bodoniModa_it = await loadFont('/fonts/BodoniModa-Italic-VariableFont_opsz,wght.ttf');
// Paste your code here :)

Renaming the font to replace commas with underscores loads font correctly, however google fonts names variable fonts with commas in the axis designators for some reason so p5js should be able to handle this when verifying paths.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions