P5.js-web-editor: Error loading fonts in several sketches

Created on 31 May 2019  路  4Comments  路  Source: processing/p5.js-web-editor

Nature of issue?

  • Found a bug

Details about the bug:

  • Web browser and version: Google Chrome 74.0.3729.169聽(Official Build)聽(64-bit)聽(cohort: Stable)
  • Operating System: Windows 10 OS Build 17134.765
  • Steps to reproduce this bug:

Try to run any sketch using loadFont('assets/SourceSansPro-Regular.otf');, e.g.,

and in the console this message will appear:

RangeError: Offset is outside the bounds of the DataView

Expanding the error message shows:

RangeError: Offset is outside the bounds of the DataView
at DataView.getUint8 (<anonymous>)
at oe.parseByte (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:66400)
at Ee (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:95706)
at De (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:98127)
at Ae (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:98374)
at Object.parse (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:104862)
at Fr (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:191282)
at https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:192282
at XMLHttpRequest.Or.r.onload (https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js:3:188186) https://cdn.jsdelivr.net/gh/processing/p5.js-website@master/src/data/examples/assets/SourceSansPro-Regular.otf
high bug

All 4 comments

thanks for reporting! my instinct is that there's something up with the MIME type... i noticed that when running the sketch from the web editor, the mime type of the font is font/otf, whereas running it from the p5js.org website, it's application/font-sfnt.

i just tried downloading the sketch and i'm seeing the same issue鈥攊t's definitely a MIME type issue with jsdelivr.

i tried using a different cdn and got it to work (i.e. the url https://rawcdn.githack.com/processing/p5.js-website/768639207fde1a37243749d5ac3913fb03894aac/src/data/examples/assets/SourceSansPro-Regular.otf works). this issue involves updating the fetch-examples script.

this has been fixed 馃帀

Was this page helpful?
0 / 5 - 0 ratings