[subset] Add hb_subset_context_t<>
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 31 Aug 2018 23:31:00 +0000 (16:31 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 31 Aug 2018 23:31:00 +0000 (16:31 -0700)
src/hb-open-type.hh
src/hb-ot-cmap-table.hh
src/hb-ot-hdmx-table.hh
src/hb-ot-hmtx-table.hh
src/hb-ot-layout-gsub-table.hh
src/hb-ot-maxp-table.hh
src/hb-ot-os2-table.hh
src/hb-ot-post-table.hh
src/hb-subset.hh

index 48a8eaa..d43dcac 100644 (file)
@@ -33,6 +33,7 @@
 #include "hb-blob.hh"
 #include "hb-face.hh"
 #include "hb-machinery.hh"
+#include "hb-subset.hh"
 
 
 namespace OT {
index b7db145..e6876d1 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "hb-open-type.hh"
 #include "hb-set.hh"
-#include "hb-subset.hh"
 
 /*
  * cmap -- Character to Glyph Index Mapping
index 3702d84..d684de0 100644 (file)
@@ -28,7 +28,6 @@
 #define HB_OT_HDMX_TABLE_HH
 
 #include "hb-open-type.hh"
-#include "hb-subset.hh"
 
 /*
  * hdmx -- Horizontal Device Metrics
index 5500e9c..3e4b3bd 100644 (file)
@@ -31,7 +31,6 @@
 #include "hb-ot-hhea-table.hh"
 #include "hb-ot-os2-table.hh"
 #include "hb-ot-var-hvar-table.hh"
-#include "hb-subset.hh"
 
 /*
  * hmtx -- Horizontal Metrics
index 55696c5..5737b21 100644 (file)
@@ -1308,6 +1308,15 @@ struct GSUB : GSUBGPOS
   inline const SubstLookup& get_lookup (unsigned int i) const
   { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
 
+  template <typename Serializer>
+  inline bool subset (hb_subset_context_t<Serializer> *c)
+  {
+    TRACE_SUBSET (this);
+    //XXX if (unlikely (!GSUBGPOS::subset (c))) return_trace (false);
+    return_trace (true);
+  }
+
+
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
index 8a889ee..efcf593 100644 (file)
@@ -28,7 +28,6 @@
 #define HB_OT_MAXP_TABLE_HH
 
 #include "hb-open-type.hh"
-#include "hb-subset.hh"
 
 namespace OT {
 
index e00f3ca..f28858c 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "hb-open-type.hh"
 #include "hb-ot-os2-unicode-ranges.hh"
-#include "hb-subset.hh"
 
 namespace OT {
 
index 955a6d6..d0265d0 100644 (file)
@@ -28,7 +28,6 @@
 #define HB_OT_POST_TABLE_HH
 
 #include "hb-open-type.hh"
-#include "hb-subset.hh"
 
 #define HB_STRING_ARRAY_NAME format1_names
 #define HB_STRING_ARRAY_LIST "hb-ot-post-macroman.hh"
index a9d00c6..5202f73 100644 (file)
 
 #include "hb-subset.h"
 
+#include "hb-machinery.hh"
 #include "hb-subset-input.hh"
 #include "hb-subset-plan.hh"
 
+template <typename Serializer>
+struct hb_subset_context_t :
+       hb_dispatch_context_t<hb_subset_context_t<Serializer>, bool, HB_DEBUG_SUBSET>
+{
+  inline const char *get_name (void) { return "SUBSET"; }
+  template <typename T>
+  inline bool dispatch (const T &obj) { return obj.subset (this); }
+  static bool default_return_value (void) { return true; }
+  bool stop_sublookup_iteration (bool r) const { return false; }
+
+  hb_subset_plan_t *plan;
+  Serializer *serializer;
+  unsigned int debug_depth;
+
+  hb_subset_context_t (hb_subset_plan_t *plan_,
+                      Serializer *serializer_) :
+                       plan (plan_),
+                       serializer (serializer_),
+                       debug_depth (0) {}
+};
 
 
 #endif /* HB_SUBSET_HH */