[kerx] Fix offset issue in kern format 2

Fixes tests with HB_VAR_ARRAY != 1, as done in previous commit.
This commit is contained in:
Behdad Esfahbod 2019-09-06 21:36:31 -04:00
parent 861547d531
commit 5902198cee
2 changed files with 2 additions and 2 deletions

View File

@ -678,7 +678,7 @@ struct ObsoleteTypes
const void *base,
const T *array)
{
return (offset - ((const char *) array - (const char *) base)) / sizeof (T);
return (offset - ((const char *) array - (const char *) base)) / T::static_size;
}
template <typename T>
static unsigned int byteOffsetToIndex (unsigned int offset,

View File

@ -392,7 +392,7 @@ struct KerxSubTableFormat2
const UnsizedArrayOf<FWORD> &arrayZ = this+array;
unsigned int kern_idx = l + r;
kern_idx = Types::offsetToIndex (kern_idx, this, &arrayZ);
kern_idx = Types::offsetToIndex (kern_idx, this, arrayZ.arrayZ);
const FWORD *v = &arrayZ[kern_idx];
if (unlikely (!v->sanitize (&c->sanitizer))) return 0;