From a6150306838b168475a9aa661ad569b0405c9f91 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 6 Nov 2017 15:40:07 -0500 Subject: [PATCH] [kern] Implement format-2 kern subtable --- src/hb-ot-kern-table.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index d074355db..074eba32a 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -116,7 +116,13 @@ struct KernSubTableFormat2 { unsigned int l = (this+leftClassTable).get_class (left); unsigned int r = (this+leftClassTable).get_class (left); - return 0;//(&(this+array))[0/*XXX*/]; + unsigned int offset = l * rowWidth + r * sizeof (FWORD); + const FWORD *v = &StructAtOffset (&(this+array), offset); + /* Untested code, as I have not been able to find ANY kern table format-2 yet. */ + assert (&(this+array) <= v); + if (unlikely (v + 1 > (const FWORD *) end)) + return 0; + return *v; } inline bool sanitize (hb_sanitize_context_t *c) const