[kerx] Fix ClassTable implementation for 'kern' table Format 2

This commit is contained in:
Behdad Esfahbod 2018-11-28 14:51:56 -05:00
parent 5b4a789ca8
commit f9a9c0fd1e
2 changed files with 7 additions and 11 deletions

View File

@ -488,7 +488,7 @@ struct StateTable
{
typedef typename Types::HBUINT HBUINT;
typedef typename Types::HBUSHORT HBUSHORT;
typedef typename Types::ClassType ClassType;
typedef typename Types::ClassTypeNarrow ClassType;
enum State
{
@ -678,7 +678,8 @@ struct ObsoleteTypes
static const bool extended = false;
typedef HBUINT16 HBUINT;
typedef HBUINT8 HBUSHORT;
typedef ClassTable<HBUINT8> ClassType;
typedef ClassTable<HBUINT8> ClassTypeNarrow;
typedef ClassTable<HBUINT16> ClassTypeWide;
template <typename T>
static inline unsigned int offsetToIndex (unsigned int offset,
@ -700,7 +701,8 @@ struct ExtendedTypes
static const bool extended = true;
typedef HBUINT32 HBUINT;
typedef HBUINT16 HBUSHORT;
typedef Lookup<HBUINT16> ClassType;
typedef Lookup<HBUINT16> ClassTypeNarrow;
typedef Lookup<HBUINT16> ClassTypeWide;
template <typename T>
static inline unsigned int offsetToIndex (unsigned int offset,

View File

@ -437,19 +437,13 @@ struct KerxSubTableFormat2
c->check_range (this, array)));
}
/* Note:
* OT kern table specifies ClassTable as having 16-bit entries, whereas
* AAT kern table specifies them as having 8bit entries.
* I've not seen any fonts with this format in kern table.
* We follow AAT. */
protected:
KernSubTableHeader header;
HBUINT rowWidth; /* The width, in bytes, of a row in the table. */
OffsetTo<typename Types::ClassType, HBUINT, false>
OffsetTo<typename Types::ClassTypeWide, HBUINT, false>
leftClassTable; /* Offset from beginning of this subtable to
* left-hand class table. */
OffsetTo<typename Types::ClassType, HBUINT, false>
OffsetTo<typename Types::ClassTypeWide, HBUINT, false>
rightClassTable;/* Offset from beginning of this subtable to
* right-hand class table. */
OffsetTo<UnsizedArrayOf<FWORD>, HBUINT, false>