Skip to content

[p5.js 2.0 Bug Report]: Not all google fonts can be used. #8119

@romain-granai

Description

@romain-granai

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

Web browser and version

firefox 143.0.3 - chrome 140.0.7339.214

Operating system

MacOSX

Steps to reproduce this

It seems that not all the fonts from fonts.google.com are loading.

I'm having a look at this demo :

https://editor.p5js.org/ksen0/sketches/cevvPvWar

I'm replacing the google font url from :

https://fonts.googleapis.com/css2?family=Epilogue:[email protected]&display=swap

to :

https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap

and I'm having a log saying :

Error: No font data available for "Inter"
WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts with glyph data are supported

🌸 p5.js says: [sketch.js, line 53] An error with message "No font data available for "Inter"
Try downloading a local copy of the font file" occurred inside the p5js library when textToPaths was called. If not stated otherwise, it might be an issue with the arguments passed to textToPaths. (https://p5js.org/reference/p5/textToPaths)
┌[blob:https://preview.p5js.org/7451d384-5e80-48b0-aed4-d9db3dbdcadd:53:23]
Error at line 53 in shapeText()
└[blob:https://preview.p5js.org/7451d384-5e80-48b0-aed4-d9db3dbdcadd:39:12]
Called from line 39 in draw()

Furthermore, the textWeight() doesn't seem to do anything, if set to 100, it should "load" the light font, 900 should load the bold font. and thus the sampling with textToCountours() would result in a "new" sampling of the contours.

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