lib-font icon indicating copy to clipboard operation
lib-font copied to clipboard

WOFF doesn't seem to need inflate.js

Open RoelN opened this issue 5 years ago • 5 comments

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?

RoelN avatar Jun 22 '20 09:06 RoelN

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

Pomax avatar Jun 24 '20 14:06 Pomax

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?

Pomax avatar Mar 25 '21 15:03 Pomax

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.

RoelN avatar Mar 29 '21 07:03 RoelN

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.

themesociety avatar Mar 29 '21 15:03 themesociety

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)

Pomax avatar Mar 29 '21 17:03 Pomax