-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix TTF headers for type 42 stix font #20597
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that's been broken for a long time. I wonder if this explains the brokenness we saw with @aitikgupta when using this with subsetted fonts?
sfnts_pputUSHORT(stream, entry_sel); /* entrySelector */ | ||
sfnts_pputUSHORT(stream, range_shift); /* rangeShift */ | ||
|
||
debug("only %d tables selected",count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure that this debug message is needed. I'm guessing it was in the code to warn in the case that there were fewer than 9 tables, in which case the header was the wrong length.
Can you add a test for this? It looks like the example in the issue fails with Ghostscript as well, so it should be sufficient to use it and have our normal comparison break on error. |
OK, I see we need #20629 too before testing. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
I can maybe create a PR with the local changes that broke ttconv, and rebase once these changes are merged in (and maybe we can get a second review from @sauerburger!) Just to give an idea about what broke ttconv, we tried to change the input signature of |
…v3.4.x Backport PR #20597 on branch v3.4.x
PR Summary
The combination of Type 42 font, STIX math font and EPS output format leads to broken output files, see #20612.
The embedded TTF font is damaged due to missing bytes in the file header. The embedded font contains 6 tables which causes this if to omit the values for searchRange, entrySelection and rangeShift.
I agree with the comment that the values are "silly" but for a valid TTF font, these values need to be present. In fact, the numbers written in the case of exactly 9 tables are not correct either. For 9 tables, the correct values would be 128, 3 and 16, see Table 4 in the reference manual.
This PR implements the correct computation for searchRange, entrySelection and rangeShift regardless of the number of tables and ensures correctly formatted TTF fonts. With this change, STIX Type 42 fonts are correctly embedded in EPS files.
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).