Closed lehni closed 2 years ago
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.
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:
https://github.com/Hopding/fontkit/commit/968e35c158589294e9543818f56d0b229b95a475 https://github.com/Hopding/fontkit/commit/f674bf2e3c8a8e0a34083e19f0abe65df20520e3 https://github.com/Hopding/fontkit/commit/9363d1f8e97985d8a94ee6dac1fac39631ee3c77
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 https://github.com/foliojs/fontkit/pull/280. This is also needed: https://github.com/foliojs/brotli.js/pull/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.
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.