[ot-font] Return char-not-found if mapped to gid 0
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 25 Aug 2018 15:44:18 +0000 (08:44 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 25 Aug 2018 15:44:18 +0000 (08:44 -0700)
OpenType cmap table can use gid=0 to mean "not covered" to produce
more optimized cmap subtables.  Return false from get_nominal_glyph()
for those.  hb-ft already does this.

src/hb-ot-cmap-table.hh

index 67a9c7d..8529c6a 100644 (file)
@@ -52,7 +52,7 @@ struct CmapSubtableFormat0
     if (!gid)
       return false;
     *glyph = gid;
-    return true;
+    return *glyph != 0;
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
@@ -280,7 +280,7 @@ struct CmapSubtableFormat4
       }
 
       *glyph = gid & 0xFFFFu;
-      return true;
+      return *glyph != 0;
     }
 
     static inline void get_all_codepoints_func (const void *obj, hb_set_t *out)
@@ -398,7 +398,7 @@ struct CmapSubtableTrimmed
     if (!gid)
       return false;
     *glyph = gid;
-    return true;
+    return *glyph != 0;
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
@@ -433,7 +433,7 @@ struct CmapSubtableLongSegmented
     if (i == -1)
       return false;
     *glyph = T::group_get_glyph (groups[i], codepoint);
-    return true;
+    return *glyph != 0;
   }
 
   inline void get_all_codepoints (hb_set_t *out) const