Remove OT namespace from hb-machinery-private.hh

This commit is contained in:
Behdad Esfahbod 2018-08-01 23:59:09 -07:00
parent cb1491f92e
commit ed7b2e58fc
12 changed files with 40 additions and 44 deletions

View File

@ -233,10 +233,10 @@ int main (int argc, char **argv)
svg.dump (svg_callback);
svg.fini ();
hb_blob_t* colr_blob = OT::hb_sanitize_context_t().reference_table<OT::COLR> (face);
hb_blob_t* colr_blob = hb_sanitize_context_t ().reference_table<OT::COLR> (face);
const OT::COLR *colr = colr_blob->as<OT::COLR> ();
hb_blob_t* cpal_blob = OT::hb_sanitize_context_t().reference_table<OT::CPAL> (face);
hb_blob_t* cpal_blob = hb_sanitize_context_t ().reference_table<OT::CPAL> (face);
const OT::CPAL *cpal = cpal_blob->as<OT::CPAL> ();
cairo_font_face_t *cairo_face;

View File

@ -61,7 +61,7 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
// static inline void
// _hb_aat_layout_create (hb_face_t *face)
// {
// hb_blob_t *morx_blob = OT::hb_sanitize_context_t().reference_table<AAT::morx> (face);
// hb_blob_t *morx_blob = hb_sanitize_context_t ().reference_table<AAT::morx> (face);
// morx_blob->as<AAT::morx> ();
// if (0)

View File

@ -52,7 +52,7 @@ hb_face_count (hb_blob_t *blob)
/* TODO We shouldn't be sanitizing blob. Port to run sanitizer and return if not sane. */
/* Make API signature const after. */
hb_blob_t *sanitized = OT::hb_sanitize_context_t().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob));
hb_blob_t *sanitized = hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob));
const OT::OpenTypeFontFile& ot = *sanitized->as<OT::OpenTypeFontFile> ();
unsigned int ret = ot.get_face_count ();
hb_blob_destroy (sanitized);
@ -190,7 +190,7 @@ hb_face_create (hb_blob_t *blob,
if (unlikely (!blob))
blob = hb_blob_get_empty ();
hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::hb_sanitize_context_t().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)), index);
hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)), index);
if (unlikely (!closure))
return hb_face_get_empty ();

View File

@ -35,9 +35,6 @@
#include "hb-iter-private.hh"
namespace OT {
/*
* Casts
*/
@ -593,7 +590,8 @@ struct BEInt<Type, 4>
* Lazy struct and blob loaders.
*/
/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */
/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t.
* I mean, yeah, only every method is different. */
template <typename T>
struct hb_lazy_loader_t
{
@ -643,7 +641,8 @@ struct hb_lazy_loader_t
mutable T *instance;
};
/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */
/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t.
* I mean, yeah, only every method is different. */
template <typename T>
struct hb_table_lazy_loader_t
{
@ -664,7 +663,7 @@ struct hb_table_lazy_loader_t
hb_blob_t *b = (hb_blob_t *) hb_atomic_ptr_get (&blob);
if (unlikely (!b))
{
b = OT::hb_sanitize_context_t().reference_table<T> (face);
b = hb_sanitize_context_t ().reference_table<T> (face);
if (!hb_atomic_ptr_cmpexch (&blob, nullptr, b))
{
hb_blob_destroy (b);
@ -692,7 +691,4 @@ struct hb_table_lazy_loader_t
};
} /* namespace OT */
#endif /* HB_MACHINERY_PRIVATE_HH */

View File

@ -44,10 +44,10 @@ struct hb_ot_font_t
OT::cmap::accelerator_t cmap;
OT::hmtx::accelerator_t h_metrics;
OT::vmtx::accelerator_t v_metrics;
OT::hb_lazy_loader_t<OT::glyf::accelerator_t> glyf;
OT::hb_lazy_loader_t<OT::CBDT::accelerator_t> cbdt;
OT::hb_lazy_loader_t<OT::post::accelerator_t> post;
OT::hb_lazy_loader_t<OT::kern::accelerator_t> kern;
hb_lazy_loader_t<OT::glyf::accelerator_t> glyf;
hb_lazy_loader_t<OT::CBDT::accelerator_t> cbdt;
hb_lazy_loader_t<OT::post::accelerator_t> post;
hb_lazy_loader_t<OT::kern::accelerator_t> kern;
};

View File

@ -172,11 +172,11 @@ struct hb_ot_layout_t
const struct OT::GPOS *gpos;
/* TODO Move the following out of this struct. */
OT::hb_table_lazy_loader_t<struct OT::BASE> base;
OT::hb_table_lazy_loader_t<struct OT::MATH> math;
OT::hb_table_lazy_loader_t<struct OT::fvar> fvar;
OT::hb_table_lazy_loader_t<struct OT::avar> avar;
OT::hb_table_lazy_loader_t<struct AAT::morx> morx;
hb_table_lazy_loader_t<struct OT::BASE> base;
hb_table_lazy_loader_t<struct OT::MATH> math;
hb_table_lazy_loader_t<struct OT::fvar> fvar;
hb_table_lazy_loader_t<struct OT::avar> avar;
hb_table_lazy_loader_t<struct AAT::morx> morx;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;

View File

@ -54,13 +54,13 @@ _hb_ot_layout_create (hb_face_t *face)
if (unlikely (!layout))
return nullptr;
layout->gdef_blob = OT::hb_sanitize_context_t().reference_table<OT::GDEF> (face);
layout->gdef_blob = hb_sanitize_context_t ().reference_table<OT::GDEF> (face);
layout->gdef = layout->gdef_blob->as<OT::GDEF> ();
layout->gsub_blob = OT::hb_sanitize_context_t().reference_table<OT::GSUB> (face);
layout->gsub_blob = hb_sanitize_context_t ().reference_table<OT::GSUB> (face);
layout->gsub = layout->gsub_blob->as<OT::GSUB> ();
layout->gpos_blob = OT::hb_sanitize_context_t().reference_table<OT::GPOS> (face);
layout->gpos_blob = hb_sanitize_context_t ().reference_table<OT::GPOS> (face);
layout->gpos = layout->gpos_blob->as<OT::GPOS> ();
layout->math.init (face);
@ -1116,7 +1116,7 @@ struct GPOSProxy
struct hb_get_subtables_context_t :
OT::hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
{
template <typename Type>
static inline bool apply_to (const void *obj, OT::hb_ot_apply_context_t *c)

View File

@ -79,12 +79,12 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
hb_stable_sort (&glyphs[0], num_glyphs, (int(*)(const OT::GlyphID*, const OT::GlyphID *)) OT::GlyphID::cmp, &substitutes[0]);
OT::Supplier<OT::GlyphID> glyphs_supplier (glyphs, num_glyphs);
OT::Supplier<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
Supplier<OT::GlyphID> glyphs_supplier (glyphs, num_glyphs);
Supplier<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
/* Each glyph takes four bytes max, and there's some overhead. */
char buf[(SHAPING_TABLE_LAST - SHAPING_TABLE_FIRST + 1) * 4 + 128];
OT::hb_serialize_context_t c (buf, sizeof (buf));
hb_serialize_context_t c (buf, sizeof (buf));
OT::SubstLookup *lookup = c.start_serialize<OT::SubstLookup> ();
bool ret = lookup->serialize_single (&c,
OT::LookupFlag::IgnoreMarks,
@ -155,15 +155,15 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
if (!num_ligatures)
return nullptr;
OT::Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
OT::Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
OT::Supplier<OT::GlyphID> ligatures_supplier (ligature_list, num_ligatures);
OT::Supplier<unsigned int > component_count_supplier (component_count_list, num_ligatures);
OT::Supplier<OT::GlyphID> component_supplier (component_list, num_ligatures);
Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
Supplier<OT::GlyphID> ligatures_supplier (ligature_list, num_ligatures);
Supplier<unsigned int > component_count_supplier (component_count_list, num_ligatures);
Supplier<OT::GlyphID> component_supplier (component_list, num_ligatures);
/* 16 bytes per ligature ought to be enough... */
char buf[ARRAY_LENGTH_CONST (ligature_list) * 16 + 128];
OT::hb_serialize_context_t c (buf, sizeof (buf));
hb_serialize_context_t c (buf, sizeof (buf));
OT::SubstLookup *lookup = c.start_serialize<OT::SubstLookup> ();
bool ret = lookup->serialize_ligature (&c,
OT::LookupFlag::IgnoreMarks,

View File

@ -38,7 +38,7 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
void
hb_face_t::load_num_glyphs (void) const
{
OT::hb_sanitize_context_t c = OT::hb_sanitize_context_t();
hb_sanitize_context_t c = hb_sanitize_context_t ();
c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */
hb_blob_t *maxp_blob = c.reference_table<OT::maxp> (this);
const OT::maxp *maxp_table = maxp_blob->as<OT::maxp> ();
@ -49,7 +49,7 @@ hb_face_t::load_num_glyphs (void) const
void
hb_face_t::load_upem (void) const
{
hb_blob_t *head_blob = OT::hb_sanitize_context_t().reference_table<OT::head> (this);
hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table<OT::head> (this);
const OT::head *head_table = head_blob->as<OT::head> ();
upem = head_table->get_upem ();
hb_blob_destroy (head_blob);

View File

@ -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::hb_sanitize_context_t().reference_table<OT::glyf> (plan->source);
hb_blob_t *glyf_blob = 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;

View File

@ -78,7 +78,7 @@ template<typename TableType>
static bool
_subset (hb_subset_plan_t *plan)
{
hb_blob_t *source_blob = OT::hb_sanitize_context_t().reference_table<TableType> (plan->source);
hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source);
const TableType *table = source_blob->as<TableType> ();
hb_tag_t tag = TableType::tableTag;
@ -157,14 +157,14 @@ _hb_subset_face_data_reference_blob (hb_subset_face_data_t *data)
if (unlikely (!buf))
return nullptr;
OT::hb_serialize_context_t c (buf, face_length);
hb_serialize_context_t c (buf, face_length);
OT::OpenTypeFontFile *f = c.start_serialize<OT::OpenTypeFontFile> ();
bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
OT::Supplier<hb_tag_t> tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0]));
OT::Supplier<hb_blob_t *> blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0]));
Supplier<hb_tag_t> tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0]));
Supplier<hb_blob_t *> blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0]));
bool ret = f->serialize_single (&c,
sfnt_tag,
tags_supplier,

View File

@ -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::hb_sanitize_context_t().sanitize_blob<OT::OpenTypeFontFile> (blob);
blob = 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);