From a3267cf803082af157a7f2b0026af2633b14f8e3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 28 Nov 2018 15:06:01 -0500 Subject: [PATCH] [kern] Fix kern table Format2 offsetToIndex Fixes https://github.com/harfbuzz/harfbuzz/issues/1421 --- src/hb-aat-layout-kerx-table.hh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index 48526edf4..abd577b9d 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -392,9 +392,13 @@ struct KerxSubTableFormat2 unsigned int num_glyphs = c->sanitizer.get_num_glyphs (); unsigned int l = (this+leftClassTable).get_class (left, num_glyphs, 0); unsigned int r = (this+rightClassTable).get_class (right, num_glyphs, 0); - unsigned int offset = l + r; - const FWORD *v = &StructAtOffset (&(this+array), offset); + + const UnsizedArrayOf &arrayZ = this+array; + unsigned int kern_idx = l + r; + kern_idx = Types::offsetToIndex (kern_idx, this, &arrayZ); + const FWORD *v = &arrayZ[kern_idx]; if (unlikely (!v->sanitize (&c->sanitizer))) return 0; + return kerxTupleKern (*v, header.tuple_count (), this, c); }