From c8cfb702e96bf4e89495fcc56f965c88bfa77dca Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 16:14:32 -0700 Subject: [PATCH] [cmap] Minor --- src/hb-ot-cmap-table.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 31f3b3094..dcdff008e 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -292,11 +292,13 @@ struct CmapSubtableFormat4 } inline void collect_unicodes (hb_set_t *out) const { - for (unsigned int i = 0; i < this->segCount; i++) + unsigned int count = this->segCount; + if (count && this->startCount[count - 1] == 0xFFFFu) + count--; /* Skip sentinel segment. */ + for (unsigned int i = 0; i < count; i++) { /* XXX This does NOT skip over chars mapping to gid0... */ - if (this->startCount[i] != 0xFFFFu || this->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) - out->add_range (this->startCount[i], this->endCount[i]); + out->add_range (this->startCount[i], this->endCount[i]); } }