[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Jul 23 05:25:20 UTC 2018


 src/hb-open-type-private.hh |   10 ++++++++--
 src/hb-ot-post-table.hh     |    2 +-
 src/hb-subset-glyf.cc       |    2 +-
 src/hb-uniscribe.cc         |    2 +-
 4 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit e7737b41d793bfce9455d1797eb5e0af60794f23
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 22 22:24:31 2018 -0700

    Add sanitizer reference_table, also fix clang build
    
    Clang is being really peculiar.  Fix with:
    
    -  inline hb_blob_t *sanitize (hb_blob_t *blob) { return c->sanitize<Type> (blob); }
    +  inline hb_blob_t *sanitize (hb_blob_t *blob) { return c[0].template/*clang idiosyncrasy*/sanitize_blob<Type> (blob); }

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 457e58c4..92a5142e 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -279,7 +279,7 @@ struct hb_sanitize_context_t :
   }
 
   template <typename Type>
-  inline hb_blob_t *sanitize (hb_blob_t *blob)
+  inline hb_blob_t *sanitize_blob (hb_blob_t *blob)
   {
     bool sane;
 
@@ -345,6 +345,12 @@ struct hb_sanitize_context_t :
     }
   }
 
+  template <typename Type>
+  inline hb_blob_t *reference_table (hb_face_t *face, hb_tag_t tableTag = Type::tableTag)
+  {
+    return sanitize_blob<Type> (face->reference_table (tableTag));
+  }
+
   mutable unsigned int debug_depth;
   const char *start, *end;
   private:
@@ -362,7 +368,7 @@ template <typename Type>
 struct Sanitizer
 {
   inline Sanitizer (unsigned int num_glyphs = 0) { c->set_num_glyphs (num_glyphs); }
-  inline hb_blob_t *sanitize (hb_blob_t *blob) { return c->sanitize<Type> (blob); }
+  inline hb_blob_t *sanitize (hb_blob_t *blob) { return c[0].template/*clang idiosyncrasy*/sanitize_blob<Type> (blob); }
 
   private:
   hb_sanitize_context_t c[1];
diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index d05fc091..fed43d47 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -85,7 +85,7 @@ struct post
   inline bool subset (hb_subset_plan_t *plan) const
   {
     unsigned int post_prime_length;
-    hb_blob_t *post_blob = OT::Sanitizer<post>().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_post));
+    hb_blob_t *post_blob = OT::hb_sanitize_context_t().reference_table<post>(plan->source);
     hb_blob_t *post_prime_blob = hb_blob_create_sub_blob (post_blob, 0, post::static_size);
     post *post_prime = (post *) hb_blob_get_data_writable (post_prime_blob, &post_prime_length);
     hb_blob_destroy (post_blob);
diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc
index c8fa39be..2b97a010 100644
--- a/src/hb-subset-glyf.cc
+++ b/src/hb-subset-glyf.cc
@@ -292,7 +292,7 @@ hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
                          hb_blob_t       **glyf_prime, /* OUT */
                          hb_blob_t       **loca_prime /* OUT */)
 {
-  hb_blob_t *glyf_blob = OT::Sanitizer<OT::glyf>().sanitize (plan->source->reference_table (HB_OT_TAG_glyf));
+  hb_blob_t *glyf_blob = OT::hb_sanitize_context_t().reference_table<OT::glyf> (plan->source);
   const char *glyf_data = hb_blob_get_data(glyf_blob, nullptr);
 
   OT::glyf::accelerator_t glyf;
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index b17fa31c..0199e65f 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -358,7 +358,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
    * full, PS. All of them point to the same name data with our unique name.
    */
 
-  blob = OT::Sanitizer<OT::OpenTypeFontFile>().sanitize (blob);
+  blob = OT::hb_sanitize_context_t().sanitize_blob<OT::OpenTypeFontFile> (blob);
 
   unsigned int length, new_length, name_str_len;
   const char *orig_sfnt_data = hb_blob_get_data (blob, &length);


More information about the HarfBuzz mailing list