ignore length of the last 'kern' subtable"
See original GitHub issueI noticed this warning with ttx’ing Open Sans Bold; the other styles in Open Sans don’t have this issue:
$ git clone https://github.com/google/fonts.git ;
$ ttx fonts/apache/opensans/OpenSans-Bold.ttf ;
Dumping "OpenSans-Bold.ttf" to "OpenSans-Bold.ttx"...
Dumping 'GlyphOrder' table...
Dumping 'head' table...
Dumping 'hhea' table...
Dumping 'maxp' table...
Dumping 'OS/2' table...
Dumping 'hmtx' table...
Dumping 'cmap' table...
Dumping 'fpgm' table...
Dumping 'prep' table...
Dumping 'cvt ' table...
Dumping 'loca' table...
Dumping 'glyf' table...
/Library/Python/2.7/site-packages/fonttools-2.5-py2.7.egg/fontTools/ttLib/tables/_k_e_r_n.py:121: UserWarning: excess data in 'kern' subtable: 46628 bytes
Dumping 'kern' table...
Dumping 'name' table...
Dumping 'post' table...
Dumping 'gasp' table...
Dumping 'GDEF' table...
Dumping 'GPOS' table...
Dumping 'GSUB' table...
Dumping 'DSIG' table...
$ ttx OpenSans-Bold.ttx ;
$ ls -l OpenSans-Bold.ttf OpenSans-Bold#1.ttf ;
-rw-r--r-- 1 user group 158,720 Jul 1 20:53 OpenSans-Bold#1.ttf
-rw-r--r-- 1 user group 224,592 Jan 15 16:28 OpenSans-Bold.ttf
Since the data doesn’t round trip, I guess its a bug in Open Sans, but before reporting this to the developer, I thought I’d file an issue to better understand this error 😃
Issue Analytics
- State:
- Created 8 years ago
- Comments:24 (19 by maintainers)
Top Results From Across the Web
Kerx Table - TrueType Reference Manual - Apple Developer
The subtable's tupleCount will be ignored if the 'kerx' table version is less than 4. If the subtable's tupleCount is greater than zero,...
Read more >kern - Kerning (OpenType 1.4) - Typography | Microsoft Learn
Length of the subtable, in bytes (including this header). USHORT, coverage, What type of information is contained in this table. The coverage field...
Read more >Manipulating OpenType Lookups - FontForge
In either case, FontForge will ask if you want to it to automagically fill up the sub-table with guesses at appropriate kerning values....
Read more >kern.rs - source - Docs.rs
Source of the Rust file `src/tables/kern.rs`. ... required to jump to the next subtable, // but if there is only one subtable, this...
Read more >OpenType Feature File Specification | afdko - GitHub Pages
is not a valid glyph class since the length of the glyph names differ. Note that ... to explicitly force a subtable break...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
kern
subtable header, according to the OpenType spec, uses alength
field of typeUSHORT
. Thelength
field describes the subtables’s bytesize, so the maximum subtable size can be 65,535 (0xFFFF) bytes. Since the format 0kern
subtable uses 6 bytes pro kerning pair, and there is a 14-bytes long header, onekern
subtable can include no more than (65,535 – 14) / 6 = 10,920 kerning pairs.OpenSans-Bold.ttf has one
kern
subtable that is 112,182 (0x1B636) bytes long and has 18,964 kerning pairs. This font subtable’s length field gives the value 46,642 (0xB636) — note that the last 4 bytes of the length field are identical with the real length.We could play this trick forever, i.e. have a subtable with 1,000,000 kerning pairs where the
length
field would only report the last 4 bytes of the actual bytesize — but that’s not how it works 😃The font’s offset table uses
ULONG
foroffset
andlength
(so it’s free from the 64K limit of course). Some tools just read the offset and the length of the entirekern
table (112,182) and then in thekern
table header only check for thenTables
field (the number of the subtables), and when it’s =1, they just read all kerning pairs until the end of the table. They seem to ignore the thelength
field of the subtable. Other tools take the subtablelength
seriously, and then there is a mismatch.So this is a font bug and should be reported to the font developers. Since
kern
with format 0 is a legacy TrueType layout table only used in systems that don’t support OpenType Layout, the way to make validkern
tables that work cross-platform is:GPOS
kerning and expand it to a flat list.kern
entries for glyphs that have real Unicode value because it doesn’t work with OTL anyway).kern
kerning to the 10,920 “most relevant” kerning pairs, whatever that means.kern
table.Only fonts with one
kern
subtable work reliably across systems. If akern
table has multiple subtables, older Windows apps will completely ignore the entire kerning. So you have to limit thekern
kerning to one subtable only.Also, ignore this.