For TTFs, implement section 9.6.6.4 from the PDF specs

Fixes the following:
- #1512
- #1904
- #2355
- #2443
- #2458
- #2437
- #2474
- https://bugzilla.mozilla.org/show_bug.cgi?id=761539
- https://bugzilla.mozilla.org/show_bug.cgi?id=832742
- https://bugzilla.mozilla.org/show_bug.cgi?id=833676