From 5902198cee9b9939ae310f459f9f18f5f1b07424 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 6 Sep 2019 21:36:31 -0400 Subject: [PATCH] [kerx] Fix offset issue in kern format 2 Fixes tests with HB_VAR_ARRAY != 1, as done in previous commit. --- src/hb-aat-layout-common.hh | 2 +- src/hb-aat-layout-kerx-table.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index a8c4b7637..e4851ce08 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -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 static unsigned int byteOffsetToIndex (unsigned int offset, diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index 25de8c6c0..c1d8815ae 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -392,7 +392,7 @@ struct KerxSubTableFormat2 const UnsizedArrayOf &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;