Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions extern/ttconv/pprdrv_tt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,16 +800,23 @@ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font)

/* Now, generate those silly numTables numbers. */
sfnts_pputUSHORT(stream, count); /* number of tables */
if ( count == 9 )
{
sfnts_pputUSHORT(stream, 7); /* searchRange */
sfnts_pputUSHORT(stream, 3); /* entrySelector */
sfnts_pputUSHORT(stream, 81); /* rangeShift */
}
else
{
debug("only %d tables selected",count);

int search_range = 1;
int entry_sel = 0;

while (search_range <= count) {
search_range <<= 1;
entry_sel++;
}
entry_sel = entry_sel > 0 ? entry_sel - 1 : 0;
search_range = (search_range >> 1) * 16;
int range_shift = count * 16 - search_range;

sfnts_pputUSHORT(stream, search_range); /* searchRange */
sfnts_pputUSHORT(stream, entry_sel); /* entrySelector */
sfnts_pputUSHORT(stream, range_shift); /* rangeShift */

debug("only %d tables selected",count);
Copy link
Member

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.


/* Now, emmit the table directory. */
for (x=0; x < 9; x++)
Expand Down