fontforge/fontforge — pull request #1476 by tshinnic (2014-07-01 00:15:48+00:00)
Title: Unconditional expansion to TrueType `GDEF` table can cause problems.

Code was put in `tottfgpos.c` in routine `otf_dumpgdef()` to allow
addition of a newly documented fifth subtable type in TrueType
`GDEF` tables. Unfortunately, while actually creating the new
subtable data is conditional on whether needed or not, the newer
fifth offset is always unconditionally inserted into the `GDEF`
header. This (small) incompatibility can trouble some programs
reading the unconditionally expanded `GDEF` header.

When warranted, FF will produce a `"mark set definitions"` subtable.
When it does so it will change the `GDEF` table version from
`0x00010000` to `0x00010002` to signal that this newer subtable and
offset word has been added (and as the newer TTF documentation requests).

However, the code always adds the fifth offset word to the table
header, no matter what header version value was used.

The example failure is Microsoft's utility `ttfdump` dying when
dumping a TTF file's `GDEF` table, saying
```
; 'GDEF' Table - Glyph Definition
;-------------------------------------
Error: Table "T000c" not referenced. Data Misalignment?
```
(The mysterious "T000c" is because of the unsignaled fifth offset
word value of null at offset **0x000C** from start of `GDEF` header.)

This result for `ttfdump` program version
> ; TrueType v1.0 Dump Program - v1.8, Oct 29 2002, rrt, dra, gch, ddb, lcp, pml

With this fix `ttfdump` now can completely dump the `GDEF` table,
and can also now dump the following 4 or more tables missing
from previous `ttfdump` listings.

This new subtable is documented here
http://www.microsoft.com/typography/otspec/gdef.htm
and which mentions both "four GDEF tables" and "five GDEF tables"
which gives an indication of how hurried the new addition was.