photopea / Typr.js

Typr.js - process fonts in Javascript
MIT License
914 stars 73 forks source link

Feature: load woff fonts #7

Closed adriaanmeuris closed 7 years ago

adriaanmeuris commented 7 years ago

I'm working on the multiline feature (https://github.com/photopea/Typr.js/issues/6), but I was wondering if there's any chance of parsing woff-fonts.

If not, is it an idea to use the woff-parsing of opentype, or would I lose better font support like stated in https://github.com/nodebox/opentype.js/issues/214?

photopea commented 7 years ago

A Woff file is just a zipped OTF file. After you unzip it, you can use Typr.js to work with that file.

I am afraid that if I add unzipping algorithms into Typr.js, it may become four times larger.

adriaanmeuris commented 7 years ago

No problem, just looking into how I could parse it myself. Would https://github.com/andyjansson/woff-parser be a good start?

photopea commented 7 years ago

That library looks like it needs Node.js environment, I am not sure if you can run it at client side.

I would look into WOFF file specification first, then unzipped it with a ZIP library to get a OTF file.

adriaanmeuris commented 7 years ago

alright, thanks for your tips!