Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent woff2_decompress failure? #151

Open
justvanrossum opened this issue Jul 20, 2022 · 7 comments
Open

Silent woff2_decompress failure? #151

justvanrossum opened this issue Jul 20, 2022 · 7 comments

Comments

@justvanrossum
Copy link

justvanrossum commented Jul 20, 2022

I'm having a very large font (that I cannot share publicly), that successfully compresses with woff2_compress:

Processing /path/to/my/font.ttf => /path/to/my/font.woff2
Compressed 45975079 to 21308821.

If I decompress it with fonttools, the result is fine (identical except for the head table, the mod date differs probably).

But woff2_decompress doesn't produce any output, and no error message is shown. The exit code is 1, though.

opentype-sanitizer is complaining about this file, too:

$ python -m ots /path/to/my/font.woff2 
ERROR: Failed to convert WOFF 2.0 font to SFNT
Failed to sanitize file!

Perhaps it is the same issue, as it appears that ots uses google/woff2.

If anyone would be willing to have a look, I'd gladly share the file privately. It's from the GS CJK project, in case you're familiar with that.

@justvanrossum
Copy link
Author

Hm, maybe this is a clue: if I try to use the uncompressed font in a web page, Chrome complains:

OTS parsing error: Web font size more than 30MB

If I try to use the woff2 file, Chrome echoes ots:

OTS parsing error: Failed to convert WOFF 2.0 font to SFNT

For completeness sake: ots does not complain about the uncomressed ttf outside of Chrome.

@jfkthame
Copy link

I believe Chrome configures a smaller size limit for OTS than the default that you presumably get if you build it standalone; see khaledhosny/ots#244.

@drott
Copy link
Member

drott commented Aug 25, 2022

@justvanrossum
Copy link
Author

(I have no access to that issue, so I wouldn't know)

@anthrotype
Copy link
Member

it reads like this:

Issue 1348101: 30MB OTS Limit too small for certain fonts
Reported by drott@chromium.org on Thu, Jul 28, 2022, 8:00 AM GMT+1 (28 days ago)
The 30MB limit by OTS to accept web fonts after decoding is too small for certain fonts. For example the internal Google Sans CJK.
Let's consider raising it.

@justvanrossum
Copy link
Author

It's definitely related. My main issue here is probably two things:

  • it hardcodes a limit that may not apply to all users of the tool
  • when it hits the limit, it doesn't tell you that it does, it just fails with a non-zero exit code

@anthrotype
Copy link
Member

this:

// Suggested max size for output.
const size_t kDefaultMaxSize = 30 * 1024 * 1024;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants