foliojs/fontkit

Consider bringing back improvements from @pdf-lib/fontkit

lehni opened this issue · 7 comments

lehni commented

We are currently using the fontkit version from @pdf-lib/fontkit for some features on https://lineto.com/, mainly for the technical section. It would be great to be able to use the official version for the frontend too. Perhaps those adjustments in @pdf-lib/fontkit can be merged here?

PS: A good example for the use of fontkit is https://lineto.com/typefaces/blankenhorn/technical, where thousands of unencoded glyphs are displayed as SVGs, directly extracted from the webfont using fontkit.

lehni commented

The only problem with doing so right now is the dependency on 'fs' for loading some internal data. @pdf-lib/fontkit replaces those with required JSON files, I guess the ESM way would be to have them in JS files, but this doesn't sound like too far off?

What features/bug fixes from that fork are you using? I don't have a whole lot of time, but if someone wants to send some PRs that might be helpful.

lehni commented

I'm not sure which ones I need, it just works for us while the official version doesn't.

There's a detailed list of the changes:

https://github.com/Hopding/fontkit#readme

I believe these are the important ones:

Hopding@968e35c
Hopding@f674bf2
Hopding@9363d1f

first and last one should already be handled in the latest version

With your changes it "almost" works out of the box in the browser. Thank you for that.
With Webpack I had to set node.fs: 'empty' to make it stop complain about the missing fs module.

This is fixed with #280.
This is also needed: foliojs/brotli.js#22

That's it!

I think all of this should be solved in v2.0.0

Thanks!
However updating to brotli:1.3.3 is still needed.