-
Notifications
You must be signed in to change notification settings - Fork 483
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
Corrupted font file handling #337
Comments
I would do an inventory on what opentype.js flags as error-worthy that other engines don't. I like graceful failing, so having the parse operation return an object that, compared to now, also contains parse error information would be nice. A list of "this is what's wrong" with "and this is what we would like to see happen in that case" would be super valuable (not just for parsing purposes, but also to give to users so they know what to expect). Some tables are critical to font operation, but not critical to font metadata extraction, so a parse option would probably be useful, allowing people to specify either nothing (parse normally, error when normal-font-use-breaking parse errors occur), or pass a value that indicates that even if the font is broken, the parse run should simply skip to the next datastructure (record, subtable, table, etc). Typically what you want to do when you hit a corrupt font is stop, and get yourself a fresh, proper copy of that font. But there are no doubt edge cases where that is either not an option, not worth it, or the intent is to actually extract data from a (partially) corrupt font. |
Sorry for the delay! |
Maybe recieving a special parameter in
would be a good idea! |
I'm currently working on restructuring the error handling to make it possible to load incomplete/corrupted font files as well as Type1/CFF fonts (see #643). There will be different error levels and you'll be able to define which levels to log and when to throw, so by default only unrecoverable errors will throw. You can check out the work-in-progress branch here: |
The more different tables we parse in opentype.js, the more we come across corrupted font files.
Most of them are still usable with other software, but opentype.js currently throws errors and stops parsing the font.
Shouldn't we try to skip (sub)tables containing errors ?
Should we report errors in some way ? Maybe just keeping a log of ignored tables ?
What do you think ? @fdb @Jolg42 @Pomax and others ?
The text was updated successfully, but these errors were encountered: