nfroidure / ttf2woff2

Convert ttf files to woff2.
MIT License
303 stars 40 forks source link

Use wawoff2 as the JS fallback ? #39

Open nfroidure opened 6 years ago

nfroidure commented 6 years ago

https://github.com/fontello/wawoff2

pioug commented 6 years ago

I am a bit curious about this. Can you give some details about the difference between ttf2woff2 and wawoff2 in terms of features? (besides the emscripten/node-gyp/wasm thing)

Loving the set of tools that you're providing to convert font/svg 💕 In return, I am looking for a way to help you maintaining them 🙏

roydukkey commented 5 years ago

@nfroidure @puzrin I've noticed that the files that ttf2woff2 creates are much smaller than wawoff2 (assuming default configs). Any clue the reason for this?

puzrin commented 5 years ago

@roydukkey

First, check if "smaller" file really works.

I have no ideas about size. But i can say wawoff2 is binary equal to native woff2. It has appropriate fixtures to test. Since time is limited, i prefer a simple approach: "if result is binary equal to original, nobody cares about what happens inside".

Try latest native woff2 1.0.3 version. If size is smaller than one by 1.0.2 (current wawoff2), i will update.

nfroidure commented 5 years ago

Tbh, I do not use this set of tools anymore and anyone wanted to take the leadership on it is welcome. That said, I think the difference in weight may come from the fact the native sources were not updated since a long time.

If I were to improve the font generation pipeline for myself, I think I would probably replace this plugin directly by its wasm implementation.

roydukkey commented 5 years ago

@nfroidure @puzrin Both versions of woff2 produces files of the same size.

However, wawoff doesn't seem to be compressing. Here are the files that I have generated from the three services. Files.zip

  1. the source TTF is 26kb
  2. Google's woff2 generated file is 10kb
  3. wawoff's generated file is 26kb
  4. ttf2woff2's generated file is 10kb
puzrin commented 5 years ago

@roydukkey i just tested:

git clone git@github.com:fontello/wawoff2.git
cd ./wawoff2
npm install
# copy-paste ttf from your archive
./bin/woff2_compress.js fira-sans-compressed-italic-400.ttf
# size of created .woff2 is 10132 bytes.

Ubuntu 18.04 LTS, node v10.11.0

Size is exactly as it should be, equal to other compressed files from your archive.

roydukkey commented 5 years ago

@puzrin You're right. I found a typo in my code. :/