From 5175300fbaf4ff19b7d38c14c86331bb614b0390 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 21 Feb 2015 12:50:01 +0300 Subject: [PATCH] [layout] Fix comparison of GlyphID and hb_codepoint_t Before, the IntType::cmp functions providing this and was truncating the hb_codepoint_t to 16bits before comparison. I have no idea how this was never discovered, and I'm too lazy to try to reproduce this with Pango (which uses non-16bit codepoint numbers for missing glyphs). --- src/hb-open-type-private.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 0989a8b..75a0f56 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -660,7 +660,10 @@ struct Tag : ULONG DEFINE_NULL_DATA (Tag, " "); /* Glyph index number, same as uint16 (length = 16 bits) */ -typedef USHORT GlyphID; +struct GlyphID : USHORT { + static inline int cmp (const GlyphID *a, const GlyphID *b) { return b->USHORT::cmp (*a); } + inline int cmp (hb_codepoint_t a) const { return (int) a - (int) *this; } +}; /* Script/language-system/feature index */ struct Index : USHORT { -- 2.7.4