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

CFF2 fonts with no vstore are rejected #275

Open
plokmijnuhby opened this issue Mar 10, 2024 · 5 comments
Open

CFF2 fonts with no vstore are rejected #275

plokmijnuhby opened this issue Mar 10, 2024 · 5 comments

Comments

@plokmijnuhby
Copy link

If a font using CFF2 has no variation data, according to the OTF spec, it should not reference a vstore in its top DICT. However, if it doesn't reference a vstore, OTS will reject it, with the message "Failed to parse Top DICT Data".
This happens because the code to check the top DICT (here) assumes that a vstore is present, reads the entire dict looking for it, gets to the end of the dict and can't read any more bytes, and complains.

@jfkthame
Copy link
Collaborator

@plokmijnuhby Could you attach an example of such a font (or point to a freely-available one)? I'd be reluctant to try fixing without a testcase on hand.

@plokmijnuhby
Copy link
Author

I don't have a fully complete file available unfortunately (and I couldn't find one online). This file has no vstore and triggers the message, although it has other issues which are nothing to do with this bug.
font.zip

@behdad
Copy link
Collaborator

behdad commented Oct 25, 2024

We should fix this. I don't immediately see where the error comes from. Can you please paste the error output at least? A test font would be best.

@plokmijnuhby
Copy link
Author

The only errors are these:
image

@behdad
Copy link
Collaborator

behdad commented Oct 29, 2024

I don't have a fully complete file available unfortunately (and I couldn't find one online). This file has no vstore and triggers the message, although it has other issues which are nothing to do with this bug.

When I debug the failure with this font, it's using operator byte 11 in TopDICT. There's no such operation in the CFF2 spec, so OTS fails.

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

No branches or pull requests

3 participants