bdusell / webfont-generator

Locally convert fonts to web formats and generate CSS rules
MIT License
190 stars 34 forks source link

Errors after upgrading from 1.2.2 to 1.3.0-dev #15

Closed onassar closed 6 years ago

onassar commented 6 years ago

Some OTF fonts that were working under 1.2.2 are no longer getting converted properly. What's the best way to have this reported?

onassar commented 6 years ago

Here are two OTF fonts that failed under 1.3.0-dev but worked under 1.2.2 https://expirebox.com/download/289aaab245dbfa1408f5cd5b899b6b88.html

bdusell commented 6 years ago

Thanks for reporting! Looks like this is a bug in sfntly. I updated the version of sfntly used, so it's entirely possible that something broke. Here's the stack trace I get:

$ ./bin/generate-webfonts test-fonts/otf.otf -o test-out/ --css test-out/test.css --verbose
using FontForge to convert test-fonts/otf.otf to test-out/otf.ttf, test-out/otf.svg
using sfntly to convert test-out/otf.svg to test-out/otf.eot, test-out/otf.woff
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at com.google.typography.font.sfntly.data.MemoryByteArray.<init>(MemoryByteArray.java:37)
        at com.google.typography.font.sfntly.data.WritableFontData.createWritableFontData(WritableFontData.java:43)
        at com.google.typography.font.sfntly.Font$Builder.loadTableData(Font.java:956)
        at com.google.typography.font.sfntly.Font$Builder.loadFont(Font.java:616)
        at com.google.typography.font.sfntly.Font$Builder.getOTFBuilder(Font.java:634)
        at com.google.typography.font.sfntly.FontFactory.loadSingleOTFForBuilding(FontFactory.java:173)
        at com.google.typography.font.sfntly.FontFactory.loadSingleOTF(FontFactory.java:150)
        at com.google.typography.font.sfntly.FontFactory.loadFonts(FontFactory.java:125)
        at ConvertFont.main(ConvertFont.java:154)
sfntly conversion failed
bdusell commented 6 years ago

P.S. https://github.com/rillig/sfntly is now the only actively maintained fork of sfntly, so the best bet is to open an issue there.

I wonder if you just need to give the JVM more memory? Those font files aren't that big though...

onassar commented 6 years ago

Bit weird since it was working in previous versions. Is Google not maintaining their lib anymore? https://github.com/googlei18n/sfntly

Do you know which version of sfntly 1.2.2 was working, versus which version 1.3.0-dev was using? In any case, I'll use a previous tag of webfont-generator for the time being.

bdusell commented 6 years ago

It looks like the original sfntly project isn't being maintained, but someone involved in the original project is maintaining a fork of it.

Old versions of this tool didn't use any particular version of sfntly, they just cloned https://github.com/googlei18n/sfntly and used whatever the master branch was at the time (not great, right?). It might be enough to use an older commit which uses the original repository.

onassar commented 6 years ago

Right.. that's what I did. Bummer that new version introduced this issue. I'll go post there. Thanks for the quick replies @bdusell

bdusell commented 6 years ago

Ah, this was a sneaky bug in my code. I'll push a fix momentarily. Thanks for catching this! This is why I wanted to wait before releasing 1.3.0.

onassar commented 6 years ago

:-)