diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 457e58c4aed4293599f88afc316502df89b8a7a3..92a5142eebfcbf3eb3fde671ec7bcb574ec01ddb 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 - 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 + inline hb_blob_t *reference_table (hb_face_t *face, hb_tag_t tableTag = Type::tableTag) + { + return sanitize_blob (face->reference_table (tableTag)); + } + mutable unsigned int debug_depth; const char *start, *end; private: @@ -362,7 +368,7 @@ template 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 (blob); } + inline hb_blob_t *sanitize (hb_blob_t *blob) { return c[0].template/*clang idiosyncrasy*/sanitize_blob (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 d05fc091c4e5e0c22eb62239235e6d8744d40985..fed43d470fde7ddefe5c618dbc35683a285ffc36 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().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_post)); + hb_blob_t *post_blob = OT::hb_sanitize_context_t().reference_table(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 c8fa39be807bf2a98dea3f31599a1972bc4703b7..2b97a010a19db54fdec0bed329f9712f93636b7c 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().sanitize (plan->source->reference_table (HB_OT_TAG_glyf)); + hb_blob_t *glyf_blob = OT::hb_sanitize_context_t().reference_table (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 b17fa31ca27a6dce227411282e9b91cb6025cf00..0199e65f8647b41d9b0d0aaae58a86f0cc75a16d 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().sanitize (blob); + blob = OT::hb_sanitize_context_t().sanitize_blob (blob); unsigned int length, new_length, name_str_len; const char *orig_sfnt_data = hb_blob_get_data (blob, &length);