itgalaxy / webfont

Awesome generator of webfont
MIT License
277 stars 69 forks source link

Extreme slowdown on fonts generated by `webfont` #558

Open mririgoyen opened 2 years ago

mririgoyen commented 2 years ago

Hello there! Over at Material Design Icons, we utilize this library to turn our SVG library into webfonts for distribution. Recently, we updated from version 9 to version 11 of webfont. The fonts generate without error or issue, but we ran into something very unexpected. The newly generated font files (specifically the woff2, maybe others... need more testing) causes some browsers to hang or even crash.

Reports from our users can be seen on an open issue here: https://github.com/Templarian/MaterialDesign/issues/6519

I've personally tested extensively on a known good version of our library using v9 and then v11 of webfont. The woff2 output by v11 causes the issue every time, however the v9 build does not. Interestingly enough, it exhibits the negative behavior the worst on Windows and Firefox. The slowdown is apparent in Chrome as well, but no where near as bad. I have been unable to reproduce it consistently on Mac. Our users report the issues don't happen on Linux.


To reproduce this yourself, you can follow these steps:

Get a Good Version

  1. Clone https://github.com/Templarian/MaterialDesign-SVG.
  2. Install our toolchain, requiring webfont@9.0.0: npm install -g @mdi/font-build@1.8.6
  3. Run font-build inside the cloned SVG repo.
  4. Open dist/index.html in Firefox on Windows.
  5. No issues!

Get a Bad Version

  1. Clone https://github.com/Templarian/MaterialDesign-SVG.
  2. Install our toolchain, requiring webfont@11.2.26: npm install -g @mdi/font-build
  3. Run font-build inside the cloned SVG repo.
  4. Open dist/index.html in Firefox on Windows.
  5. Firefox locks up. It may become responsive after some time or crash.

Please let me know if there is anything else we can provide to help make debugging this issue easier. Thank you!

Templarian commented 2 years ago

(Maintainer of Material Design Icons traveling for work) We're going try to get a simplified repo for this after narrowing down the specific version that introduced this. In the issue someone did give a DirectWrite output.