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); }
This commit is contained in:
parent
62fa7cd1cc
commit
e7737b41d7
|
@ -279,7 +279,7 @@ struct hb_sanitize_context_t :
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
inline hb_blob_t *sanitize (hb_blob_t *blob)
|
inline hb_blob_t *sanitize_blob (hb_blob_t *blob)
|
||||||
{
|
{
|
||||||
bool sane;
|
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;
|
mutable unsigned int debug_depth;
|
||||||
const char *start, *end;
|
const char *start, *end;
|
||||||
private:
|
private:
|
||||||
|
@ -362,7 +368,7 @@ template <typename Type>
|
||||||
struct Sanitizer
|
struct Sanitizer
|
||||||
{
|
{
|
||||||
inline Sanitizer (unsigned int num_glyphs = 0) { c->set_num_glyphs (num_glyphs); }
|
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:
|
private:
|
||||||
hb_sanitize_context_t c[1];
|
hb_sanitize_context_t c[1];
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct post
|
||||||
inline bool subset (hb_subset_plan_t *plan) const
|
inline bool subset (hb_subset_plan_t *plan) const
|
||||||
{
|
{
|
||||||
unsigned int post_prime_length;
|
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);
|
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);
|
post *post_prime = (post *) hb_blob_get_data_writable (post_prime_blob, &post_prime_length);
|
||||||
hb_blob_destroy (post_blob);
|
hb_blob_destroy (post_blob);
|
||||||
|
|
|
@ -292,7 +292,7 @@ hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
|
||||||
hb_blob_t **glyf_prime, /* OUT */
|
hb_blob_t **glyf_prime, /* OUT */
|
||||||
hb_blob_t **loca_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);
|
const char *glyf_data = hb_blob_get_data(glyf_blob, nullptr);
|
||||||
|
|
||||||
OT::glyf::accelerator_t glyf;
|
OT::glyf::accelerator_t glyf;
|
||||||
|
|
|
@ -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.
|
* 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;
|
unsigned int length, new_length, name_str_len;
|
||||||
const char *orig_sfnt_data = hb_blob_get_data (blob, &length);
|
const char *orig_sfnt_data = hb_blob_get_data (blob, &length);
|
||||||
|
|
Loading…
Reference in New Issue