From d5c0ca210fef315fd039e5b1825a865f36606a3f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 7 Nov 2018 12:08:44 -0500 Subject: [PATCH] [aat] Minor --- src/hb-aat-layout-common.hh | 16 ++++++++++------ src/hb-ot-kern-table.hh | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index cede80c87..34c61e93c 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -436,7 +436,7 @@ struct StateTable inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const { if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH; - return (this+classTable).get_class (glyph_id, num_glyphs); + return (this+classTable).get_class (glyph_id, num_glyphs, 1); } inline const Entry *get_entries () const @@ -528,7 +528,7 @@ struct StateTable struct ClassTable { - inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange=0) const + inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int outOfRange) const { unsigned int i = glyph_id - firstGlyph; return i >= classArray.len ? outOfRange : classArray.arrayZ[i]; @@ -553,9 +553,11 @@ struct ObsoleteTypes typedef HBUINT8 HBUSHORT; struct ClassType : ClassTable { - inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs HB_UNUSED) const + inline unsigned int get_class (hb_codepoint_t glyph_id, + unsigned int num_glyphs HB_UNUSED, + unsigned int outOfRange) const { - return ClassTable::get_class (glyph_id, 1); + return ClassTable::get_class (glyph_id, outOfRange); } }; template @@ -580,10 +582,12 @@ struct ExtendedTypes typedef HBUINT16 HBUSHORT; struct ClassType : Lookup { - inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const + inline unsigned int get_class (hb_codepoint_t glyph_id, + unsigned int num_glyphs, + unsigned int outOfRange) const { const HBUINT16 *v = get_value (glyph_id, num_glyphs); - return v ? *v : 1; + return v ? *v : outOfRange; } }; template diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index 3f771d2d5..870d80013 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -51,8 +51,8 @@ struct KernSubTableFormat2 * different ClassTable. OT's has 16bit entries, while AAT has 8bit entries. * I've not seen any in the wild. */ return 0; - unsigned int l = (this+leftClassTable).get_class (left); - unsigned int r = (this+rightClassTable).get_class (right); + unsigned int l = (this+leftClassTable).get_class (left, 0); + unsigned int r = (this+rightClassTable).get_class (right, 0); unsigned int offset = l + r; const FWORD *v = &StructAtOffset (&(this+array), offset); if (unlikely (!v->sanitize (&c->sanitizer))) return 0;