Pomax / lib-font

This library adds a new Font() object to the JavaScript toolbox, similar to new Image() for images
MIT License
730 stars 72 forks source link

WOFF doesn't seem to need inflate.js #66

Open RoelN opened 4 years ago

RoelN commented 4 years ago

Experimenting with Font.js and not loading inflate.js and unbrotli.js, I was surprised to find Font.js being perfectly capable of accepting a WOFF font. (WOFF2 indeed fails as expected on a brotliDecode is not a function).

Happy bug?

Pomax commented 4 years ago

not so happy - binary data should not get automagically unpacked, so that definitely needs investigating.

Pomax commented 3 years ago

A thought: WOFF (and WOFF2) don't require per-table compression, they only allow per-table compression, so it's entirely possible that WOFF/WOFF2 work just fine without compression dependencies simply because the fonts you're using don't make use of deflated/brotli'd table data.

Did you test this with compressed WOFF/WOFF2 fonts, @RoelN, @themesociety?

RoelN commented 3 years ago

I didn't realise this, and assumed all WOFF(2) are compressed. Anecdotally, the WOFF was a lot smaller than the TTF, but I'll verify this with some other WOFF fonts. Will report back.

themesociety commented 3 years ago

I thought the same, i think for every woff(2) file i have i get an error if unbrotli is not imported. After releasing our update iam sure we will pretty soon get feedback from users if some fonts are failing because of a missing libarary.

Pomax commented 3 years ago

double checking the spec, woff2 should indeed always be compressed (so it'll need unbrotli), but for woff the compression is entirely optional (and a lot of woff don't actually have per-table compression, especially from places like font squirrel etc)