Merge pull request #2034 from khaledhosny/cmap-notdef

[cmap] Check GID before adding ranges in format 4 & 12
diff --git a/src/hb-ot-cff1-table.cc b/src/hb-ot-cff1-table.cc
index d1e4625..55abd11 100644
--- a/src/hb-ot-cff1-table.cc
+++ b/src/hb-ot-cff1-table.cc
@@ -336,7 +336,7 @@
   else
   {
     extents->y_bearing = font->em_scalef_y (bounds.max.y.to_real ());
-    extents->height = font->em_scalef_x (bounds.min.y.to_real () - bounds.max.y.to_real ());
+    extents->height = font->em_scalef_y (bounds.min.y.to_real () - bounds.max.y.to_real ());
   }
 
   return true;
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index e537772..f4912f8 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -71,7 +71,10 @@
 	       const hb_set_t      *unicodes,
 	       hb_set_t            *glyphset)
 {
-  face->table.cmap->table->closure_glyphs (unicodes, glyphset);
+  OT::cmap::accelerator_t cmap;
+  cmap.init (face);
+  cmap.table->closure_glyphs (unicodes, glyphset);
+  cmap.fini ();
 }
 
 static inline void
diff --git a/src/hb.hh b/src/hb.hh
index f316512..fcbd330 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -370,10 +370,12 @@
 #define getenv(Name) nullptr
 #endif
 
-#ifdef HB_NO_ERRNO
-static int errno = 0; /* Use something better? */
+#ifndef HB_NO_ERRNO
+#  include <errno.h>
 #else
-#include <errno.h>
+static int HB_UNUSED _hb_errno = 0;
+#  undef errno
+#  define errno _hb_errno
 #endif
 
 #if defined(HAVE_ATEXIT) && !defined(HB_USE_ATEXIT)