0

I'm trying to re-create an old arcade game (pong) using the JavaScript/HTML5 canvas.

For maximum duplication, I downloaded a retro-styled font for displaying the players' scores, but the problem is when I load it via CSS using @font-face, it displays this error message:

Failed to decode downloaded font: http://localhost:8000/bit5x5.ttf

OTS parsing error: cmap: Failed to parse table

I'm, obviously, using a localhost, and I want to type that text ON the JavaScript Canvas, using the canvas text methods.

I found many many solutions online, but none of them seem to work in my case. Please tell me how to fix this issue as fast as possible, thanks in advance.

Kaiido
  • 123,334
  • 13
  • 219
  • 285
Saif Taher
  • 325
  • 1
  • 12
  • get a font that isn't broken. The error is pretty clear: you're trying to load a font that has errors in it, and browsers won't let you use a font with errors in it, because errors can be used for zero-day exploits that browser makers can't know about. Get a woff2 (or older woff) version of your font (yes, that different extension [is an important difference](/questions/36105194)), and things should work (because you won't be able to woff convert a broken font either). – Mike 'Pomax' Kamermans Dec 06 '18 at 23:10
  • Thanks, I've already downloaded a different font. Sadly, there isn't a `woff` version of that font. Anyway, thanks for the solution! – Saif Taher Dec 07 '18 at 16:12
  • just convert it. There are several open source utils that will turn your system font into a reduced and compressed woff2 instead. (and go for woff2, with woff as fallback, rather than just using woff. It has better compression) – Mike 'Pomax' Kamermans Dec 07 '18 at 18:00

0 Answers0