Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a9139e

Browse files
authored
Merge pull request#20643 from jkseppan/auto-backport-of-pr-20597-on-v3.4.x
Backport PR#20597 on branch v3.4.x
2 parentsc19a4d3 +76e1ce5 commit0a9139e

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

‎extern/ttconv/pprdrv_tt.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -841,17 +841,24 @@ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font)
841841

842842
/* Now, generate those silly numTables numbers.*/
843843
sfnts_pputUSHORT(stream, count);/* number of tables*/
844-
if ( count ==9 )
845-
{
846-
sfnts_pputUSHORT(stream,7);/* searchRange*/
847-
sfnts_pputUSHORT(stream,3);/* entrySelector*/
848-
sfnts_pputUSHORT(stream,81);/* rangeShift*/
844+
845+
int search_range =1;
846+
int entry_sel =0;
847+
848+
while (search_range <= count) {
849+
search_range <<=1;
850+
entry_sel++;
849851
}
852+
entry_sel = entry_sel >0 ? entry_sel -1 :0;
853+
search_range = (search_range >>1) *16;
854+
int range_shift = count *16 - search_range;
855+
856+
sfnts_pputUSHORT(stream, search_range);/* searchRange*/
857+
sfnts_pputUSHORT(stream, entry_sel);/* entrySelector*/
858+
sfnts_pputUSHORT(stream, range_shift);/* rangeShift*/
859+
850860
#ifdef DEBUG_TRUETYPE
851-
else
852-
{
853-
debug("only %d tables selected",count);
854-
}
861+
debug("only %d tables selected",count);
855862
#endif
856863

857864
/* Now, emmit the table directory.*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp