diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index cec339b53..d104a4417 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -131,7 +131,7 @@ struct RangeRecord
     return c->check_struct (this);
   }
 
-  inline bool intersects (const hb_glyph_map_t *glyphs) const {
+  inline bool intersects (const hb_set_t *glyphs) const {
     return glyphs->intersects (start, end);
   }
 
@@ -358,7 +358,7 @@ struct CoverageFormat1
     return glyphArray.sanitize (c);
   }
 
-  inline bool intersects_coverage (const hb_glyph_map_t *glyphs, unsigned int index) const {
+  inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const {
     return glyphs->has (glyphArray[index]);
   }
 
@@ -402,7 +402,7 @@ struct CoverageFormat2
     return rangeRecord.sanitize (c);
   }
 
-  inline bool intersects_coverage (const hb_glyph_map_t *glyphs, unsigned int index) const {
+  inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const {
     unsigned int i;
     unsigned int count = rangeRecord.len;
     for (i = 0; i < count; i++) {
@@ -476,7 +476,7 @@ struct Coverage
     }
   }
 
-  inline bool intersects (const hb_glyph_map_t *glyphs) const {
+  inline bool intersects (const hb_set_t *glyphs) const {
     /* TODO speed this up */
     Coverage::Iter iter;
     for (iter.init (*this); iter.more (); iter.next ()) {
@@ -486,7 +486,7 @@ struct Coverage
     return false;
   }
 
-  inline bool intersects_coverage (const hb_glyph_map_t *glyphs, unsigned int index) const {
+  inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const {
     switch (u.format) {
     case 1: return u.format1.intersects_coverage (glyphs, index);
     case 2: return u.format2.intersects_coverage (glyphs, index);
@@ -574,7 +574,7 @@ struct ClassDefFormat1
 	&& classValue.sanitize (c);
   }
 
-  inline bool intersects_class (const hb_glyph_map_t *glyphs, unsigned int klass) const {
+  inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const {
     unsigned int count = classValue.len;
     for (unsigned int i = 0; i < count; i++)
       if (classValue[i] == klass && glyphs->has (startGlyph + i))
@@ -608,7 +608,7 @@ struct ClassDefFormat2
     return rangeRecord.sanitize (c);
   }
 
-  inline bool intersects_class (const hb_glyph_map_t *glyphs, unsigned int klass) const {
+  inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const {
     unsigned int count = rangeRecord.len;
     for (unsigned int i = 0; i < count; i++)
       if (rangeRecord[i].value == klass && rangeRecord[i].intersects (glyphs))
@@ -647,7 +647,7 @@ struct ClassDef
     }
   }
 
-  inline bool intersects_class (const hb_glyph_map_t *glyphs, unsigned int klass) const {
+  inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const {
     switch (u.format) {
     case 1: return u.format1.intersects_class (glyphs, klass);
     case 2: return u.format2.intersects_class (glyphs, klass);
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 10cfd3457..aa3b26817 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -58,13 +58,13 @@ static inline uint8_t allocate_lig_id (hb_buffer_t *buffer) {
 struct hb_closure_context_t
 {
   hb_face_t *face;
-  hb_glyph_map_t *glyphs;
+  hb_set_t *glyphs;
   unsigned int nesting_level_left;
   unsigned int debug_depth;
 
 
   hb_closure_context_t (hb_face_t *face_,
-			hb_glyph_map_t *glyphs_,
+			hb_set_t *glyphs_,
 		        unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
 			  face (face_), glyphs (glyphs_),
 			  nesting_level_left (nesting_level_left_),
@@ -227,7 +227,7 @@ struct hb_apply_context_t
 
 
 
-typedef bool (*intersects_func_t) (hb_glyph_map_t *glyphs, const USHORT &value, const void *data);
+typedef bool (*intersects_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data);
 typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
 typedef bool (*closure_lookup_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
 typedef bool (*apply_lookup_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
@@ -243,16 +243,16 @@ struct ContextApplyFuncs
   apply_lookup_func_t apply;
 };
 
-static inline bool intersects_glyph (hb_glyph_map_t *glyphs, const USHORT &value, const void *data HB_UNUSED)
+static inline bool intersects_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED)
 {
   return glyphs->has (value);
 }
-static inline bool intersects_class (hb_glyph_map_t *glyphs, const USHORT &value, const void *data)
+static inline bool intersects_class (hb_set_t *glyphs, const USHORT &value, const void *data)
 {
   const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
   return class_def.intersects_class (glyphs, value);
 }
-static inline bool intersects_coverage (hb_glyph_map_t *glyphs, const USHORT &value, const void *data)
+static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, const void *data)
 {
   const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
   return (data+coverage).intersects (glyphs);
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 92f3c2609..32da46da2 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -95,7 +95,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout);
 
 
 
-struct _hb_glyph_map_t
+struct _hb_set_t
 {
   void clear (void) {
     memset (elts, 0, sizeof elts);
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 4441a7e41..95ed9c671 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -472,7 +472,7 @@ hb_ot_layout_substitute_finish (hb_buffer_t  *buffer HB_UNUSED)
 
 hb_bool_t
 hb_ot_layout_substitute_closure_lookup (hb_face_t      *face,
-				        hb_glyph_map_t *glyphs,
+				        hb_set_t *glyphs,
 				        unsigned int    lookup_index)
 {
   hb_closure_context_t c (face, glyphs);
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index a9db04f67..1c1e7d9c6 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -183,11 +183,11 @@ void
 hb_ot_layout_substitute_finish (hb_buffer_t  *buffer);
 
 
-typedef struct _hb_glyph_map_t hb_glyph_map_t;
+typedef struct _hb_set_t hb_set_t;
 
 hb_bool_t
 hb_ot_layout_substitute_closure_lookup (hb_face_t      *face,
-				        hb_glyph_map_t *glyphs,
+				        hb_set_t *glyphs,
 				        unsigned int    lookup_index);
 
 /*
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index 5675d37a7..d5fc4ce06 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -126,7 +126,7 @@ struct hb_ot_map_t
 			  hb_buffer_t *buffer) const;
 
   HB_INTERNAL void substitute_closure (hb_face_t *face,
-				       hb_glyph_map_t *glyphs) const;
+				       hb_set_t *glyphs) const;
 
   hb_mask_t global_mask;
 
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index a0efe900b..bebf3ed74 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -96,7 +96,7 @@ void hb_ot_map_t::apply (unsigned int table_index,
 }
 
 void hb_ot_map_t::substitute_closure (hb_face_t *face,
-				      hb_glyph_map_t *glyphs) const
+				      hb_set_t *glyphs) const
 {
   unsigned int table_index = 0;
   unsigned int i = 0;