diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 253b56fea..c0b0e3751 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -689,6 +689,13 @@ struct ObsoleteTypes return (offset - ((const char *) array - (const char *) base)) / sizeof (T); } template + static inline unsigned int byteOffsetToIndex (unsigned int offset, + const void *base, + const T *array) + { + return offsetToIndex (offset, base, array); + } + template static inline unsigned int wordOffsetToIndex (unsigned int offset, const void *base, const T *array) @@ -712,6 +719,13 @@ struct ExtendedTypes return offset; } template + static inline unsigned int byteOffsetToIndex (unsigned int offset, + const void *base, + const T *array) + { + return offset / 2; + } + template static inline unsigned int wordOffsetToIndex (unsigned int offset, const void *base, const T *array) diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index abd577b9d..7caf45d5d 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -255,7 +255,7 @@ struct KerxSubTableFormat1 unsigned int tuple_count = MAX (1u, table->header.tuple_count ()); unsigned int kern_idx = Format1EntryT::kernActionIndex (entry); - kern_idx = Types::offsetToIndex (kern_idx, &table->machine, kernAction.arrayZ); + kern_idx = Types::byteOffsetToIndex (kern_idx, &table->machine, kernAction.arrayZ); const FWORD *actions = &kernAction[kern_idx]; if (!c->sanitizer.check_array (actions, depth, tuple_count)) {