diff --git a/extern/ttconv/pprdrv_tt.cpp b/extern/ttconv/pprdrv_tt.cpp index 934215470808..a1b6d3799b64 100644 --- a/extern/ttconv/pprdrv_tt.cpp +++ b/extern/ttconv/pprdrv_tt.cpp @@ -841,17 +841,24 @@ 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 */ + + 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 */ + #ifdef DEBUG_TRUETYPE - else - { - debug("only %d tables selected",count); - } + debug("only %d tables selected",count); #endif /* Now, emmit the table directory. */ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy