From 1c6b3693245d38103cab224d75262d45dc88c71c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 15 Aug 2018 20:12:25 -0700 Subject: [PATCH 01/47] [ot] Rename hb_ot_layout_t to hb_ot_face_data_t --- src/hb-aat-layout.cc | 17 +---- src/hb-ot-color.cc | 6 +- src/hb-ot-layout-gpos-table.hh | 6 +- src/hb-ot-layout-gsub-table.hh | 8 +-- src/hb-ot-layout-gsubgpos-private.hh | 2 +- src/hb-ot-layout-private.hh | 12 ++-- src/hb-ot-layout.cc | 100 +++++++++++++-------------- src/hb-ot-math.cc | 2 +- src/hb-ot-shape.cc | 5 +- src/hb-ot-var.cc | 4 +- 10 files changed, 71 insertions(+), 91 deletions(-) diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 36d4037ad..fc706d6bd 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -51,25 +51,12 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr) *blob = hb_blob_get_empty (); return Null(AAT::morx); } - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - const AAT::morx& morx = *(layout->table.morx.get ()); + const AAT::morx& morx = *(hb_ot_face_data (face)->table.morx.get ()); if (blob) - *blob = layout->table.morx.get_blob (); + *blob = hb_ot_face_data (face)->table.morx.get_blob (); return morx; } -// static inline void -// _hb_aat_layout_create (hb_face_t *face) -// { -// hb_blob_t *morx_blob = hb_sanitize_context_t ().reference_table (face); -// morx_blob->as (); - -// if (0) -// { -// morx_blob->as > ()->get_value (1, face->get_num_glyphs ()); -// } -// } - void hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer) { diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index 86171c633..44550d78b 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -45,16 +45,14 @@ static inline const OT::COLR& _get_colr (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::COLR); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->colr.get ()); + return *(hb_ot_face_data (face)->colr.get ()); } static inline const OT::CPAL& _get_cpal (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CPAL); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->cpal.get ()); + return *(hb_ot_face_data (face)->cpal.get ()); } diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index fe34a328b..95bc588be 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1628,15 +1628,13 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) template /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->table.GPOS); - const PosLookup &l = gpos.get_lookup (lookup_index); + const PosLookup &l = hb_ot_face_data (c->face)->table.GPOS->get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->table.GPOS); - const PosLookup &l = gpos.get_lookup (lookup_index); + const PosLookup &l = hb_ot_face_data (c->face)->table.GPOS->get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 1d5a02a02..a2f78b8fc 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1335,7 +1335,7 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) { _hb_buffer_assert_gsubgpos_vars (buffer); - const GDEF &gdef = *hb_ot_layout_from_face (font->face)->table.GDEF; + const GDEF &gdef = *hb_ot_face_data (font->face)->table.GDEF; unsigned int count = buffer->len; for (unsigned int i = 0; i < count; i++) { @@ -1359,15 +1359,13 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) template /*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->table.GSUB); - const SubstLookup &l = gsub.get_lookup (lookup_index); + const SubstLookup &l = hb_ot_face_data (c->face)->table.GSUB->get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->table.GSUB); - const SubstLookup &l = gsub.get_lookup (lookup_index); + const SubstLookup &l = hb_ot_face_data (c->face)->table.GSUB->get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 40a2fc4cc..9b1a19f0e 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -480,7 +480,7 @@ struct hb_ot_apply_context_t : iter_input (), iter_context (), font (font_), face (font->face), buffer (buffer_), recurse_func (nullptr), - gdef (*hb_ot_layout_from_face (face)->table.GDEF), + gdef (*hb_ot_face_data (face)->table.GDEF), var_store (gdef.get_var_store ()), direction (buffer_->props.direction), lookup_mask (1), diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 612bc7fce..8f1e2c9c3 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -118,7 +118,7 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, /* - * hb_ot_layout_t + * hb_ot_face_data_t */ struct hb_ot_layout_lookup_accelerator_t @@ -178,7 +178,7 @@ struct hb_ot_layout_lookup_accelerator_t HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_TABLE -struct hb_ot_layout_t +struct hb_ot_face_data_t { unsigned int gsub_lookup_count; unsigned int gpos_lookup_count; @@ -212,14 +212,14 @@ struct hb_ot_layout_t }; -HB_INTERNAL hb_ot_layout_t * -_hb_ot_layout_create (hb_face_t *face); +HB_INTERNAL hb_ot_face_data_t * +_hb_ot_face_data_create (hb_face_t *face); HB_INTERNAL void -_hb_ot_layout_destroy (hb_ot_layout_t *layout); +_hb_ot_face_data_destroy (hb_ot_face_data_t *data); -#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot.get_relaxed ()) +#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) /* diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 09ff0e6c0..09f034336 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -149,101 +149,101 @@ _hb_ot_blacklist_gdef (unsigned int gdef_len, return false; } -void hb_ot_layout_t::tables_t::init0 (hb_face_t *face) +void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) { this->face = face; #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_TABLE } -void hb_ot_layout_t::tables_t::fini (void) +void hb_ot_face_data_t::tables_t::fini (void) { #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_TABLE } -hb_ot_layout_t * -_hb_ot_layout_create (hb_face_t *face) +hb_ot_face_data_t * +_hb_ot_face_data_create (hb_face_t *face) { - hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); - if (unlikely (!layout)) + hb_ot_face_data_t *data = (hb_ot_face_data_t *) calloc (1, sizeof (hb_ot_face_data_t)); + if (unlikely (!data)) return nullptr; - layout->table.init0 (face); + data->table.init0 (face); - const OT::GSUB &gsub = *layout->table.GSUB; - const OT::GPOS &gpos = *layout->table.GPOS; + const OT::GSUB &gsub = *data->table.GSUB; + const OT::GPOS &gpos = *data->table.GPOS; - if (unlikely (_hb_ot_blacklist_gdef (layout->table.GDEF.get_blob ()->length, - layout->table.GSUB.get_blob ()->length, - layout->table.GPOS.get_blob ()->length))) - layout->table.GDEF.set_stored (hb_blob_get_empty ()); + if (unlikely (_hb_ot_blacklist_gdef (data->table.GDEF.get_blob ()->length, + data->table.GSUB.get_blob ()->length, + data->table.GPOS.get_blob ()->length))) + data->table.GDEF.set_stored (hb_blob_get_empty ()); - unsigned int gsub_lookup_count = layout->gsub_lookup_count = gsub.get_lookup_count (); - unsigned int gpos_lookup_count = layout->gpos_lookup_count = gpos.get_lookup_count (); + unsigned int gsub_lookup_count = data->gsub_lookup_count = gsub.get_lookup_count (); + unsigned int gpos_lookup_count = data->gpos_lookup_count = gpos.get_lookup_count (); - layout->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - layout->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); + data->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); + data->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - if (unlikely ((gsub_lookup_count && !layout->gsub_accels) || - (gpos_lookup_count && !layout->gpos_accels))) + if (unlikely ((gsub_lookup_count && !data->gsub_accels) || + (gpos_lookup_count && !data->gpos_accels))) { - _hb_ot_layout_destroy (layout); + _hb_ot_face_data_destroy (data); return nullptr; } for (unsigned int i = 0; i < gsub_lookup_count; i++) - layout->gsub_accels[i].init (gsub.get_lookup (i)); + data->gsub_accels[i].init (gsub.get_lookup (i)); for (unsigned int i = 0; i < gpos_lookup_count; i++) - layout->gpos_accels[i].init (gpos.get_lookup (i)); + data->gpos_accels[i].init (gpos.get_lookup (i)); - return layout; + return data; } void -_hb_ot_layout_destroy (hb_ot_layout_t *layout) +_hb_ot_face_data_destroy (hb_ot_face_data_t *data) { - if (layout->gsub_accels) - for (unsigned int i = 0; i < layout->gsub_lookup_count; i++) - layout->gsub_accels[i].fini (); - if (layout->gpos_accels) - for (unsigned int i = 0; i < layout->gpos_lookup_count; i++) - layout->gpos_accels[i].fini (); + if (data->gsub_accels) + for (unsigned int i = 0; i < data->gsub_lookup_count; i++) + data->gsub_accels[i].fini (); + if (data->gpos_accels) + for (unsigned int i = 0; i < data->gpos_lookup_count; i++) + data->gpos_accels[i].fini (); - free (layout->gsub_accels); - free (layout->gpos_accels); + free (data->gsub_accels); + free (data->gpos_accels); - layout->table.fini (); + data->table.fini (); - free (layout); + free (data); } // static inline const OT::BASE& // _get_base (hb_face_t *face) // { // if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE); -// hb_ot_layout_t * layout = hb_ot_layout_from_face (face); -// return *(layout->base.get ()); +// hb_ot_face_data_t *data = hb_ot_face_data (face); +// return *(data->base.get ()); // } static inline const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); - return *hb_ot_layout_from_face (face)->table.GDEF; + return *hb_ot_face_data (face)->table.GDEF; } static inline const OT::GSUB& _get_gsub (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); - return *hb_ot_layout_from_face (face)->table.GSUB; + return *hb_ot_face_data (face)->table.GSUB; } static inline const OT::GPOS& _get_gpos (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); - return *hb_ot_layout_from_face (face)->table.GPOS; + return *hb_ot_face_data (face)->table.GPOS; } /* @@ -633,11 +633,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face, { case HB_OT_TAG_GSUB: { - return hb_ot_layout_from_face (face)->gsub_lookup_count; + return hb_ot_face_data (face)->gsub_lookup_count; } case HB_OT_TAG_GPOS: { - return hb_ot_layout_from_face (face)->gpos_lookup_count; + return hb_ot_face_data (face)->gpos_lookup_count; } } return 0; @@ -851,13 +851,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, { case HB_OT_TAG_GSUB: { - const OT::SubstLookup& l = hb_ot_layout_from_face (face)->table.GSUB->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->get_lookup (lookup_index); l.collect_glyphs (&c); return; } case HB_OT_TAG_GPOS: { - const OT::PosLookup& l = hb_ot_layout_from_face (face)->table.GPOS->get_lookup (lookup_index); + const OT::PosLookup& l = hb_ot_face_data (face)->table.GPOS->get_lookup (lookup_index); l.collect_glyphs (&c); return; } @@ -930,12 +930,12 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, unsigned int glyphs_length, hb_bool_t zero_context) { - if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false; + if (unlikely (lookup_index >= hb_ot_face_data (face)->gsub_lookup_count)) return false; OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); - const OT::SubstLookup& l = hb_ot_layout_from_face (face)->table.GSUB->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->get_lookup (lookup_index); - return l.would_apply (&c, &hb_ot_layout_from_face (face)->gsub_accels[lookup_index]); + return l.would_apply (&c, &hb_ot_face_data (face)->gsub_accels[lookup_index]); } void @@ -1091,8 +1091,8 @@ struct GSUBProxy typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : - table (*hb_ot_layout_from_face (face)->table.GSUB), - accels (hb_ot_layout_from_face (face)->gsub_accels) {} + table (*hb_ot_face_data (face)->table.GSUB), + accels (hb_ot_face_data (face)->gsub_accels) {} const OT::GSUB &table; const hb_ot_layout_lookup_accelerator_t *accels; @@ -1105,8 +1105,8 @@ struct GPOSProxy typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : - table (*hb_ot_layout_from_face (face)->table.GPOS), - accels (hb_ot_layout_from_face (face)->gpos_accels) {} + table (*hb_ot_face_data (face)->table.GPOS), + accels (hb_ot_face_data (face)->gpos_accels) {} const OT::GPOS &table; const hb_ot_layout_lookup_accelerator_t *accels; diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 66ce207a7..ead6259d4 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -33,7 +33,7 @@ static inline const OT::MATH& _get_math (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); + hb_ot_face_data_t * layout = hb_ot_face_data (face); return *(layout->table.MATH.get ()); } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 71632b563..91ac28fd6 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -27,7 +27,6 @@ */ #define HB_SHAPER ot -#define hb_ot_face_data_t hb_ot_layout_t #define hb_ot_shape_plan_data_t hb_ot_shape_plan_t #include "hb-shaper-impl-private.hh" @@ -135,13 +134,13 @@ HB_SHAPER_DATA_ENSURE_DEFINE(ot, face) hb_ot_face_data_t * _hb_ot_shaper_face_data_create (hb_face_t *face) { - return _hb_ot_layout_create (face); + return _hb_ot_face_data_create (face); } void _hb_ot_shaper_face_data_destroy (hb_ot_face_data_t *data) { - _hb_ot_layout_destroy (data); + _hb_ot_face_data_destroy (data); } diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index 6081ddfc3..5b890a3b9 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -40,14 +40,14 @@ static inline const OT::fvar& _get_fvar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); + hb_ot_face_data_t *layout = hb_ot_face_data (face); return *(layout->table.fvar.get ()); } static inline const OT::avar& _get_avar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); + hb_ot_face_data_t *layout = hb_ot_face_data (face); return *(layout->table.avar.get ()); } From 142ac5a6be6088771e0ee4b135ba753c80036a9a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 24 Aug 2018 10:07:49 -0700 Subject: [PATCH 02/47] [serialize] Add copy_bytes() and copy_blob() --- src/hb-dsalgs.hh | 3 +++ src/hb-machinery-private.hh | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 8cbe6584b..8d59c6cf3 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -502,6 +502,9 @@ struct hb_bytes_t { inline hb_bytes_t (void) : bytes (nullptr), len (0) {} inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {} + inline hb_bytes_t (const void *bytes_, unsigned int len_) : bytes ((const char *) bytes_), len (len_) {} + + inline void free (void) { ::free ((void *) bytes); bytes = nullptr; len = 0; } inline int cmp (const hb_bytes_t &a) const { diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh index 99ef485a3..05add1f4d 100644 --- a/src/hb-machinery-private.hh +++ b/src/hb-machinery-private.hh @@ -402,7 +402,7 @@ struct hb_serialize_context_t } template - inline Type *copy (void) + inline Type *copy (void) const { assert (!this->ran_out_of_room); unsigned int len = this->head - this->start; @@ -411,6 +411,25 @@ struct hb_serialize_context_t memcpy (p, this->start, len); return reinterpret_cast (p); } + inline hb_bytes_t copy_bytes (void) const + { + assert (!this->ran_out_of_room); + unsigned int len = this->head - this->start; + void *p = malloc (len); + if (p) + memcpy (p, this->start, len); + else + return hb_bytes_t (); + return hb_bytes_t (p, len); + } + inline hb_blob_t *copy_blob (void) const + { + assert (!this->ran_out_of_room); + return hb_blob_create (this->start, + this->head - this->start, + HB_MEMORY_MODE_DUPLICATE, + nullptr, nullptr); + } template inline Type *allocate_size (unsigned int size) From 29a9a0883877c598413de78cd0c61f07bc393b2c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 24 Aug 2018 10:24:45 -0700 Subject: [PATCH 03/47] [sanitize] Document how sanitize machinery works --- src/hb-machinery-private.hh | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh index 05add1f4d..b33dd996d 100644 --- a/src/hb-machinery-private.hh +++ b/src/hb-machinery-private.hh @@ -138,6 +138,68 @@ struct hb_dispatch_context_t /* * Sanitize + * + * + * === Introduction === + * + * The sanitize machinery is at the core of our zero-cost font loading. We + * mmap() font file into memory and create a blob out of it. Font subtables + * are returned as a readonly sub-blob of the main font blob. These table + * blobs are then sanitized before use, to ensure invalid memory access does + * not happen. The toplevel sanitize API use is like, eg. to load the 'head' + * table: + * + * hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table (face); + * + * The blob then can be converted to a head table struct with: + * + * const head *head_table = head_blob->as (); + * + * What the reference_table does is, to call hb_face_reference_table() to load + * the table blob, sanitize it and return either the sanitized blob, or empty + * blob if sanitization failed. The blob->as() function returns the null + * object of its template type argument if the blob is empty. Otherwise, it + * just casts the blob contents to the desired type. + * + * Sanitizing a blob of data with a type T works as follows (with minor + * simplification): + * + * - Cast blob content to T*, call sanitize() method of it, + * - If sanitize succeeded, return blob. + * - Otherwise, if blob is not writable, try making it writable, + * or copy if cannot be made writable in-place, + * - Call sanitize() again. Return blob if sanitize succeeded. + * - Return empty blob otherwise. + * + * + * === The sanitize() contract === + * + * The sanitize() method of each object type shall return true if it's safe to + * call other methods of the object, and false otherwise. + * + * Note that what sanitize() checks for might align with what the specification + * describes as valid table data, but does not have to be. In particular, we + * do NOT want to be pedantic and concern ourselves with validity checks that + * are irrelevant to our use of the table. On the contrary, we want to be + * lenient with error handling and accept invalid data to the extent that it + * does not impose extra burden on us. + * + * Based on the sanitize contract, one can see that what we check for depends + * on how we use the data in other table methods. Ie. if other table methods + * assume that offsets do NOT point out of the table data block, then that's + * something sanitize() must check for (GSUB/GPOS/GDEF/etc work this way). On + * the other hand, if other methods do such checks themselves, then sanitize() + * does not have to bother with them (glyf/local work this way). The choice + * depends on the table structure and sanitize() performance. For example, to + * check glyf/loca offsets in sanitize() would cost O(num-glyphs). We try hard + * to avoid such costs during font loading. By postponing such checks to the + * actual glyph loading, we reduce the sanitize cost to O(1) and total runtime + * cost to O(used-glyphs). As such, this is preferred. + * + * The same argument can be made re GSUB/GPOS/GDEF, but there, the table + * structure is so complicated that by checking all offsets at sanitize() time, + * we make the code much simpler in other methods, as offsets and referenced + * objectes do not need to be validated at each use site. */ /* This limits sanitizing time on really broken fonts. */ From 6cac9dc9ccb76945e9dfacafc169afad4a6e1e88 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 24 Aug 2018 10:29:45 -0700 Subject: [PATCH 04/47] [blob] Add as_bytes() --- src/hb-blob-private.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-blob-private.hh b/src/hb-blob-private.hh index 49ad68ece..0d3fad574 100644 --- a/src/hb-blob-private.hh +++ b/src/hb-blob-private.hh @@ -62,6 +62,10 @@ struct hb_blob_t { return unlikely (!data) ? &Null(Type) : reinterpret_cast (data); } + inline hb_bytes_t as_bytes (void) const + { + return hb_bytes_t (data, length); + } public: hb_object_header_t header; From aadb2a9188f143126392c0b0f139326dcf7f9c8d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 08:18:53 -0700 Subject: [PATCH 05/47] Add face-builder New API: +hb_face_builder_create +hb_face_builder_add_table --- docs/harfbuzz-sections.txt | 5 +- src/hb-face.cc | 149 +++++++++++++++++++++++++++++++++++++ src/hb-face.h | 14 ++++ src/hb-subset-plan.cc | 2 +- src/hb-subset-plan.hh | 2 +- src/hb-subset-private.hh | 7 -- src/hb-subset.cc | 129 -------------------------------- 7 files changed, 169 insertions(+), 139 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 16b662777..f98e8cc13 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -170,6 +170,7 @@ hb_coretext_font_get_ct_font
hb-face hb_face_count +hb_face_t hb_face_create hb_face_create_for_tables hb_face_destroy @@ -188,7 +189,8 @@ hb_face_set_glyph_count hb_face_set_index hb_face_set_upem hb_face_set_user_data -hb_face_t +hb_face_builder_create +hb_face_builder_add_table
@@ -226,6 +228,7 @@ hb_font_get_glyph hb_font_get_glyph_advance_for_direction hb_font_get_glyph_advance_func_t hb_font_get_glyph_advances_for_direction +hb_font_get_glyph_advances_func_t hb_font_get_glyph_contour_point hb_font_get_glyph_contour_point_for_origin hb_font_get_glyph_contour_point_func_t diff --git a/src/hb-face.cc b/src/hb-face.cc index 49f29d3fa..9cb0f2654 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -512,3 +512,152 @@ hb_face_get_table_tags (const hb_face_t *face, return ot_face.get_table_tags (start_offset, table_count, table_tags); } + + +/* + * face-builder: A face that has add_table(). + */ + +struct hb_face_builder_data_t +{ + struct table_entry_t + { + inline int cmp (const hb_tag_t *t) const + { + if (*t < tag) return -1; + if (*t > tag) return -1; + return 0; + } + + hb_tag_t tag; + hb_blob_t *blob; + }; + + hb_vector_t tables; +}; + +static hb_face_builder_data_t * +_hb_face_builder_data_create (void) +{ + hb_face_builder_data_t *data = (hb_face_builder_data_t *) calloc (1, sizeof (hb_face_builder_data_t)); + if (unlikely (!data)) + return nullptr; + + data->tables.init (); + + return data; +} + +static void +_hb_face_builder_data_destroy (void *user_data) +{ + hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; + + for (unsigned int i = 0; i < data->tables.len; i++) + hb_blob_destroy (data->tables[i].blob); + + data->tables.fini (); + + free (data); +} + +static hb_blob_t * +_hb_face_builder_data_reference_blob (hb_face_builder_data_t *data) +{ + + unsigned int table_count = data->tables.len; + unsigned int face_length = table_count * 16 + 12; + + for (unsigned int i = 0; i < table_count; i++) + face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); + + char *buf = (char *) malloc (face_length); + if (unlikely (!buf)) + return nullptr; + + hb_serialize_context_t c (buf, face_length); + OT::OpenTypeFontFile *f = c.start_serialize (); + + 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; + + Supplier tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0])); + Supplier blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0])); + bool ret = f->serialize_single (&c, + sfnt_tag, + tags_supplier, + blobs_supplier, + table_count); + + c.end_serialize (); + + if (unlikely (!ret)) + { + free (buf); + return nullptr; + } + + return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free); +} + +static hb_blob_t * +_hb_face_builder_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data) +{ + hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; + + if (!tag) + return _hb_face_builder_data_reference_blob (data); + + hb_face_builder_data_t::table_entry_t *entry = data->tables.lsearch (tag); + if (entry) + return hb_blob_reference (entry->blob); + + return nullptr; +} + + +/** + * hb_face_builder_create: + * + * Creates a #hb_face_t that can be used with hb_face_builder_add_table(). + * After tables are added to the face, it can be compiled to a binary + * font file by calling hb_face_reference_blob(). + * + * Return value: (transfer full) New face. + * + * Since: REPLACEME + **/ +hb_face_t * +hb_face_builder_create (void) +{ + hb_face_builder_data_t *data = _hb_face_builder_data_create (); + if (unlikely (!data)) return hb_face_get_empty (); + + return hb_face_create_for_tables (_hb_face_builder_reference_table, + data, + _hb_face_builder_data_destroy); +} + +/** + * hb_face_builder_add_table: + * + * Add table for @tag with data provided by @blob to the face. @face must + * be created using hb_face_builder_create(). + * + * Since: REPLACEME + **/ +hb_bool_t +hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) +{ + if (unlikely (face->destroy != (hb_destroy_func_t) _hb_face_builder_data_destroy)) + return false; + + hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data; + hb_face_builder_data_t::table_entry_t *entry = data->tables.push (); + + entry->tag = tag; + entry->blob = hb_blob_reference (blob); + + return true; +} + diff --git a/src/hb-face.h b/src/hb-face.h index 208092efc..2bc3e8957 100644 --- a/src/hb-face.h +++ b/src/hb-face.h @@ -120,6 +120,20 @@ hb_face_get_table_tags (const hb_face_t *face, unsigned int *table_count, /* IN/OUT */ hb_tag_t *table_tags /* OUT */); + +/* + * Builder face. + */ + +HB_EXTERN hb_face_t * +hb_face_builder_create (void); + +HB_EXTERN hb_bool_t +hb_face_builder_add_table (hb_face_t *face, + hb_tag_t tag, + hb_blob_t *blob); + + HB_END_DECLS #endif /* HB_FACE_H */ diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 125668272..6e556c20b 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -154,7 +154,7 @@ hb_subset_plan_create (hb_face_t *face, plan->unicodes = hb_set_create(); plan->glyphs.init(); plan->source = hb_face_reference (face); - plan->dest = hb_subset_face_create (); + plan->dest = hb_face_builder_create (); plan->codepoint_to_glyph = hb_map_create(); plan->glyph_map = hb_map_create(); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 7501294d7..b7f14d2ef 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -89,7 +89,7 @@ struct hb_subset_plan_t hb_blob_get_length (contents), hb_blob_get_length (source_blob)); hb_blob_destroy (source_blob); - return hb_subset_face_add_table(dest, tag, contents); + return hb_face_builder_add_table (dest, tag, contents); } }; diff --git a/src/hb-subset-private.hh b/src/hb-subset-private.hh index 6b2b207ff..42c93d7d3 100644 --- a/src/hb-subset-private.hh +++ b/src/hb-subset-private.hh @@ -34,8 +34,6 @@ #include "hb-font-private.hh" -typedef struct hb_subset_face_data_t hb_subset_face_data_t; - struct hb_subset_input_t { hb_object_header_t header; ASSERT_POD (); @@ -54,10 +52,5 @@ struct hb_subset_input_t { */ }; -HB_INTERNAL hb_face_t * -hb_subset_face_create (void); - -HB_INTERNAL hb_bool_t -hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob); #endif /* HB_SUBSET_PRIVATE_HH */ diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 411c6b861..88f6d6784 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -96,135 +96,6 @@ _subset (hb_subset_plan_t *plan) } -/* - * A face that has add_table(). - */ - -struct hb_subset_face_data_t -{ - struct table_entry_t - { - inline int cmp (const hb_tag_t *t) const - { - if (*t < tag) return -1; - if (*t > tag) return -1; - return 0; - } - - hb_tag_t tag; - hb_blob_t *blob; - }; - - hb_vector_t tables; -}; - -static hb_subset_face_data_t * -_hb_subset_face_data_create (void) -{ - hb_subset_face_data_t *data = (hb_subset_face_data_t *) calloc (1, sizeof (hb_subset_face_data_t)); - if (unlikely (!data)) - return nullptr; - - data->tables.init (); - - return data; -} - -static void -_hb_subset_face_data_destroy (void *user_data) -{ - hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data; - - for (unsigned int i = 0; i < data->tables.len; i++) - hb_blob_destroy (data->tables[i].blob); - - data->tables.fini (); - - free (data); -} - -static hb_blob_t * -_hb_subset_face_data_reference_blob (hb_subset_face_data_t *data) -{ - - unsigned int table_count = data->tables.len; - unsigned int face_length = table_count * 16 + 12; - - for (unsigned int i = 0; i < table_count; i++) - face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); - - char *buf = (char *) malloc (face_length); - if (unlikely (!buf)) - return nullptr; - - hb_serialize_context_t c (buf, face_length); - OT::OpenTypeFontFile *f = c.start_serialize (); - - 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; - - Supplier tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0])); - Supplier blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0])); - bool ret = f->serialize_single (&c, - sfnt_tag, - tags_supplier, - blobs_supplier, - table_count); - - c.end_serialize (); - - if (unlikely (!ret)) - { - free (buf); - return nullptr; - } - - return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free); -} - -static hb_blob_t * -_hb_subset_face_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data) -{ - hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data; - - if (!tag) - return _hb_subset_face_data_reference_blob (data); - - hb_subset_face_data_t::table_entry_t *entry = data->tables.lsearch (tag); - if (entry) - return hb_blob_reference (entry->blob); - - return nullptr; -} - -/* TODO: Move this to hb-face.h and rename to hb_face_builder_create() - * with hb_face_builder_add_table(). */ -hb_face_t * -hb_subset_face_create (void) -{ - hb_subset_face_data_t *data = _hb_subset_face_data_create (); - if (unlikely (!data)) return hb_face_get_empty (); - - return hb_face_create_for_tables (_hb_subset_face_reference_table, - data, - _hb_subset_face_data_destroy); -} - -hb_bool_t -hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) -{ - if (unlikely (face->destroy != (hb_destroy_func_t) _hb_subset_face_data_destroy)) - return false; - - hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data; - hb_subset_face_data_t::table_entry_t *entry = data->tables.push (); - - entry->tag = tag; - entry->blob = hb_blob_reference (blob); - - return true; -} - static bool _subset_table (hb_subset_plan_t *plan, hb_tag_t tag) From 531051b8b904cf4eb6a50bacebc11c2d85e40140 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 08:44:18 -0700 Subject: [PATCH 06/47] [ot-font] Return char-not-found if mapped to gid 0 OpenType cmap table can use gid=0 to mean "not covered" to produce more optimized cmap subtables. Return false from get_nominal_glyph() for those. hb-ft already does this. --- src/hb-ot-cmap-table.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 67a9c7dd9..8529c6a33 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -52,7 +52,7 @@ struct CmapSubtableFormat0 if (!gid) return false; *glyph = gid; - return true; + return *glyph != 0; } inline bool sanitize (hb_sanitize_context_t *c) const @@ -280,7 +280,7 @@ struct CmapSubtableFormat4 } *glyph = gid & 0xFFFFu; - return true; + return *glyph != 0; } static inline void get_all_codepoints_func (const void *obj, hb_set_t *out) @@ -398,7 +398,7 @@ struct CmapSubtableTrimmed if (!gid) return false; *glyph = gid; - return true; + return *glyph != 0; } inline bool sanitize (hb_sanitize_context_t *c) const @@ -433,7 +433,7 @@ struct CmapSubtableLongSegmented if (i == -1) return false; *glyph = T::group_get_glyph (groups[i], codepoint); - return true; + return *glyph != 0; } inline void get_all_codepoints (hb_set_t *out) const From d60c465627d76fcfbeb37d6b8f9382f3b84ace6e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 08:47:06 -0700 Subject: [PATCH 07/47] Rename get_all_codepoints() to collect_unicodes() --- src/hb-ot-cmap-table.hh | 26 +++++++++---------- src/hb-subset.cc | 6 ++--- src/hb-subset.h | 4 +-- test/api/test-subset-codepoints.c | 18 ++++++------- .../hb-subset-get-codepoints-fuzzer.cc | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 8529c6a33..925101f77 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -283,7 +283,7 @@ struct CmapSubtableFormat4 return *glyph != 0; } - static inline void get_all_codepoints_func (const void *obj, hb_set_t *out) + static inline void collect_unicodes_func (const void *obj, hb_set_t *out) { const accelerator_t *thiz = (const accelerator_t *) obj; for (unsigned int i = 0; i < thiz->segCount; i++) @@ -436,7 +436,7 @@ struct CmapSubtableLongSegmented return *glyph != 0; } - inline void get_all_codepoints (hb_set_t *out) const + inline void collect_unicodes (hb_set_t *out) const { for (unsigned int i = 0; i < this->groups.len; i++) { hb_set_add_range (out, @@ -939,24 +939,24 @@ struct cmap if (unlikely (symbol)) { this->get_glyph_func = get_glyph_from_symbol; - this->get_all_codepoints_func = null_get_all_codepoints_func; + this->collect_unicodes_func = collect_unicodes_func_nil; } else { switch (subtable->u.format) { /* Accelerate format 4 and format 12. */ default: this->get_glyph_func = get_glyph_from; - this->get_all_codepoints_func = null_get_all_codepoints_func; + this->collect_unicodes_func = collect_unicodes_func_nil; break; case 12: this->get_glyph_func = get_glyph_from; - this->get_all_codepoints_func = get_all_codepoints_from; + this->collect_unicodes_func = collect_unicodes_from; break; case 4: { this->format4_accel.init (&subtable->u.format4); this->get_glyph_data = &this->format4_accel; this->get_glyph_func = this->format4_accel.get_glyph_func; - this->get_all_codepoints_func = this->format4_accel.get_all_codepoints_func; + this->collect_unicodes_func = this->format4_accel.collect_unicodes_func; } break; } @@ -990,19 +990,19 @@ struct cmap return get_nominal_glyph (unicode, glyph); } - inline void get_all_codepoints (hb_set_t *out) const + inline void collect_unicodes (hb_set_t *out) const { - this->get_all_codepoints_func (get_glyph_data, out); + this->collect_unicodes_func (get_glyph_data, out); } protected: typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph); - typedef void (*hb_cmap_get_all_codepoints_func_t) (const void *obj, + typedef void (*hb_cmap_collect_unicodes_func_t) (const void *obj, hb_set_t *out); - static inline void null_get_all_codepoints_func (const void *obj, hb_set_t *out) + static inline void collect_unicodes_func_nil (const void *obj, hb_set_t *out) { // NOOP } @@ -1017,11 +1017,11 @@ struct cmap } template - static inline void get_all_codepoints_from (const void *obj, + static inline void collect_unicodes_from (const void *obj, hb_set_t *out) { const Type *typed_obj = (const Type *) obj; - typed_obj->get_all_codepoints (out); + typed_obj->collect_unicodes (out); } template @@ -1049,7 +1049,7 @@ struct cmap private: hb_cmap_get_glyph_func_t get_glyph_func; const void *get_glyph_data; - hb_cmap_get_all_codepoints_func_t get_all_codepoints_func; + hb_cmap_collect_unicodes_func_t collect_unicodes_func; CmapSubtableFormat4::accelerator_t format4_accel; diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 88f6d6784..2e991de20 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -237,15 +237,15 @@ hb_subset (hb_face_t *source, } /** - * hb_subset_get_all_codepoints: + * hb_subset_collect_unicodes: * @source: font face data to load. * @out: set to add the all codepoints covered by font face, source. */ void -hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out) +hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out) { OT::cmap::accelerator_t cmap; cmap.init (source); - cmap.get_all_codepoints (out); + cmap.collect_unicodes (out); cmap.fini(); } diff --git a/src/hb-subset.h b/src/hb-subset.h index f6d2ae0a0..b79b80946 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -80,9 +80,9 @@ hb_subset (hb_face_t *source, hb_subset_profile_t *profile, hb_subset_input_t *input); -/* hb_subset_get_all_codepoints */ +/* hb_subset_collect_unicodes */ HB_EXTERN void -hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out); +hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out); HB_END_DECLS diff --git a/test/api/test-subset-codepoints.c b/test/api/test-subset-codepoints.c index 3bd1fe062..a2c40cd67 100644 --- a/test/api/test-subset-codepoints.c +++ b/test/api/test-subset-codepoints.c @@ -28,12 +28,12 @@ #include "hb-subset-test.h" static void -test_get_all_codepoints_format4 (void) +test_collect_unicodes_format4 (void) { hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf"); hb_set_t *codepoints = hb_set_create(); - hb_subset_get_all_codepoints (face, codepoints); + hb_subset_collect_unicodes (face, codepoints); hb_codepoint_t cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); @@ -49,12 +49,12 @@ test_get_all_codepoints_format4 (void) } static void -test_get_all_codepoints_format12 (void) +test_collect_unicodes_format12 (void) { hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf"); hb_set_t *codepoints = hb_set_create(); - hb_subset_get_all_codepoints (face, codepoints); + hb_subset_collect_unicodes (face, codepoints); hb_codepoint_t cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); @@ -70,12 +70,12 @@ test_get_all_codepoints_format12 (void) } static void -test_get_all_codepoints (void) +test_collect_unicodes (void) { hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf"); hb_set_t *codepoints = hb_set_create(); - hb_subset_get_all_codepoints (face, codepoints); + hb_subset_collect_unicodes (face, codepoints); hb_codepoint_t cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); @@ -95,9 +95,9 @@ main (int argc, char **argv) { hb_test_init (&argc, &argv); - hb_test_add (test_get_all_codepoints); - hb_test_add (test_get_all_codepoints_format4); - hb_test_add (test_get_all_codepoints_format12); + hb_test_add (test_collect_unicodes); + hb_test_add (test_collect_unicodes_format4); + hb_test_add (test_collect_unicodes_format12); return hb_test_run(); } diff --git a/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc b/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc index 38f338ba4..bcdafebdf 100644 --- a/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc +++ b/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc @@ -13,7 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) hb_face_t *face = hb_face_create (blob, 0); hb_set_t *output = hb_set_create(); - hb_subset_get_all_codepoints (face, output); + hb_subset_collect_unicodes (face, output); hb_set_destroy (output); hb_face_destroy (face); From bd0e542525d41d9ebe51cbcab8151d65eb984b2e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 09:33:30 -0700 Subject: [PATCH 08/47] [cmap] Simplify collect_unicodes() Don't use accelerator (almost). Hooks up Format13 as well. --- src/hb-ot-cmap-table.hh | 52 +++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 925101f77..2f88a767d 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -283,17 +283,6 @@ struct CmapSubtableFormat4 return *glyph != 0; } - static inline void collect_unicodes_func (const void *obj, hb_set_t *out) - { - const accelerator_t *thiz = (const accelerator_t *) obj; - for (unsigned int i = 0; i < thiz->segCount; i++) - { - if (thiz->startCount[i] != 0xFFFFu - || thiz->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) - hb_set_add_range (out, thiz->startCount[i], thiz->endCount[i]); - } - } - const HBUINT16 *endCount; const HBUINT16 *startCount; const HBUINT16 *idDelta; @@ -309,6 +298,18 @@ struct CmapSubtableFormat4 accel.init (this); return accel.get_glyph_func (&accel, codepoint, glyph); } + inline void collect_unicodes (hb_set_t *out) const + { + unsigned int segCount = this->segCountX2 / 2; + const HBUINT16 *endCount = this->values; + const HBUINT16 *startCount = endCount + segCount + 1; + + for (unsigned int i = 0; i < segCount; i++) + { + if (startCount[i] != 0xFFFFu || endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) + hb_set_add_range (out, startCount[i], endCount[i]); + } + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -690,6 +691,19 @@ struct CmapSubtable default: return false; } } + inline void collect_unicodes (hb_set_t *out) const + { + switch (u.format) { +// case 0: u.format0 .collect_unicodes (out); return; + case 4: u.format4 .collect_unicodes (out); return; +// case 6: u.format6 .collect_unicodes (out); return; +// case 10: u.format10.collect_unicodes (out); return; + case 12: u.format12.collect_unicodes (out); return; + case 13: u.format13.collect_unicodes (out); return; + case 14: + default: return; + } + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -901,9 +915,10 @@ struct cmap { this->blob = hb_sanitize_context_t().reference_table (face); const cmap *table = this->blob->as (); - const CmapSubtable *subtable = nullptr; const CmapSubtableFormat14 *subtable_uvs = nullptr; + subtable = nullptr; + bool symbol = false; /* 32-bit subtables. */ if (!subtable) subtable = table->find_subtable (3, 10); @@ -939,24 +954,20 @@ struct cmap if (unlikely (symbol)) { this->get_glyph_func = get_glyph_from_symbol; - this->collect_unicodes_func = collect_unicodes_func_nil; } else { switch (subtable->u.format) { /* Accelerate format 4 and format 12. */ default: this->get_glyph_func = get_glyph_from; - this->collect_unicodes_func = collect_unicodes_func_nil; break; case 12: this->get_glyph_func = get_glyph_from; - this->collect_unicodes_func = collect_unicodes_from; break; case 4: { this->format4_accel.init (&subtable->u.format4); this->get_glyph_data = &this->format4_accel; this->get_glyph_func = this->format4_accel.get_glyph_func; - this->collect_unicodes_func = this->format4_accel.collect_unicodes_func; } break; } @@ -992,7 +1003,7 @@ struct cmap inline void collect_unicodes (hb_set_t *out) const { - this->collect_unicodes_func (get_glyph_data, out); + subtable->collect_unicodes (out); } protected: @@ -1002,11 +1013,6 @@ struct cmap typedef void (*hb_cmap_collect_unicodes_func_t) (const void *obj, hb_set_t *out); - static inline void collect_unicodes_func_nil (const void *obj, hb_set_t *out) - { - // NOOP - } - template static inline bool get_glyph_from (const void *obj, hb_codepoint_t codepoint, @@ -1047,9 +1053,9 @@ struct cmap } private: + const CmapSubtable *subtable; hb_cmap_get_glyph_func_t get_glyph_func; const void *get_glyph_data; - hb_cmap_collect_unicodes_func_t collect_unicodes_func; CmapSubtableFormat4::accelerator_t format4_accel; From 7d382fa276f44b7b163e98d434cc79f958bf87fb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 09:35:45 -0700 Subject: [PATCH 09/47] [cmap] Implement collect_unicodes() for Format0/6/10 --- src/hb-ot-cmap-table.hh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 2f88a767d..a25d13cfa 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -54,6 +54,12 @@ struct CmapSubtableFormat0 *glyph = gid; return *glyph != 0; } + inline void collect_unicodes (hb_set_t *out) const + { + for (unsigned int i = 0; i < 256; i++) + if (glyphIdArray[i]) + out->add (i); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -306,6 +312,7 @@ struct CmapSubtableFormat4 for (unsigned int i = 0; i < segCount; i++) { + /* XXX This does NOT skip over chars mapping to gid0... */ if (startCount[i] != 0xFFFFu || endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) hb_set_add_range (out, startCount[i], endCount[i]); } @@ -384,7 +391,7 @@ struct CmapSubtableLongGroup HBUINT32 startCharCode; /* First character code in this group. */ HBUINT32 endCharCode; /* Last character code in this group. */ HBUINT32 glyphID; /* Glyph index; interpretation depends on - * subtable format. */ + * subtable format. */ public: DEFINE_SIZE_STATIC (12); }; @@ -401,6 +408,14 @@ struct CmapSubtableTrimmed *glyph = gid; return *glyph != 0; } + inline void collect_unicodes (hb_set_t *out) const + { + hb_codepoint_t start = startCharCode; + unsigned int count = glyphIdArray.len; + for (unsigned int i = 0; i < count; i++) + if (glyphIdArray[i]) + out->add (start + i); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -694,10 +709,10 @@ struct CmapSubtable inline void collect_unicodes (hb_set_t *out) const { switch (u.format) { -// case 0: u.format0 .collect_unicodes (out); return; + case 0: u.format0 .collect_unicodes (out); return; case 4: u.format4 .collect_unicodes (out); return; -// case 6: u.format6 .collect_unicodes (out); return; -// case 10: u.format10.collect_unicodes (out); return; + case 6: u.format6 .collect_unicodes (out); return; + case 10: u.format10.collect_unicodes (out); return; case 12: u.format12.collect_unicodes (out); return; case 13: u.format13.collect_unicodes (out); return; case 14: From b41c43b4e112bfa38fef35694842f242c28a7da2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 15:25:03 -0700 Subject: [PATCH 10/47] Minor --- src/hb-ot-cmap-table.hh | 48 ++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index a25d13cfa..1152c8ea3 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -244,14 +244,12 @@ struct CmapSubtableFormat4 glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; } - static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { - const accelerator_t *thiz = (const accelerator_t *) obj; - /* Custom two-array bsearch. */ - int min = 0, max = (int) thiz->segCount - 1; - const HBUINT16 *startCount = thiz->startCount; - const HBUINT16 *endCount = thiz->endCount; + int min = 0, max = (int) this->segCount - 1; + const HBUINT16 *startCount = this->startCount; + const HBUINT16 *endCount = this->endCount; unsigned int i; while (min <= max) { @@ -270,24 +268,37 @@ struct CmapSubtableFormat4 found: hb_codepoint_t gid; - unsigned int rangeOffset = thiz->idRangeOffset[i]; + unsigned int rangeOffset = this->idRangeOffset[i]; if (rangeOffset == 0) - gid = codepoint + thiz->idDelta[i]; + gid = codepoint + this->idDelta[i]; else { /* Somebody has been smoking... */ - unsigned int index = rangeOffset / 2 + (codepoint - thiz->startCount[i]) + i - thiz->segCount; - if (unlikely (index >= thiz->glyphIdArrayLength)) + unsigned int index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount; + if (unlikely (index >= this->glyphIdArrayLength)) return false; - gid = thiz->glyphIdArray[index]; + gid = this->glyphIdArray[index]; if (unlikely (!gid)) return false; - gid += thiz->idDelta[i]; + gid += this->idDelta[i]; } *glyph = gid & 0xFFFFu; return *glyph != 0; } + static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) + { + return ((const accelerator_t *) obj)->get_glyph (codepoint, glyph); + } + inline void collect_unicodes (hb_set_t *out) const + { + for (unsigned int i = 0; i < this->segCount; i++) + { + /* XXX This does NOT skip over chars mapping to gid0... */ + if (this->startCount[i] != 0xFFFFu || this->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) + hb_set_add_range (out, this->startCount[i], this->endCount[i]); + } + } const HBUINT16 *endCount; const HBUINT16 *startCount; @@ -306,16 +317,9 @@ struct CmapSubtableFormat4 } inline void collect_unicodes (hb_set_t *out) const { - unsigned int segCount = this->segCountX2 / 2; - const HBUINT16 *endCount = this->values; - const HBUINT16 *startCount = endCount + segCount + 1; - - for (unsigned int i = 0; i < segCount; i++) - { - /* XXX This does NOT skip over chars mapping to gid0... */ - if (startCount[i] != 0xFFFFu || endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) - hb_set_add_range (out, startCount[i], endCount[i]); - } + accelerator_t accel; + accel.init (this); + accel.collect_unicodes (out); } inline bool sanitize (hb_sanitize_context_t *c) const From 02fe03e09a3258e07d2d6749990f6d31dd2a8525 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 15:33:05 -0700 Subject: [PATCH 11/47] [cmap] Factor out find_best_subtable --- src/hb-ot-cmap-table.hh | 52 ++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 1152c8ea3..173d62e63 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -928,6 +928,35 @@ struct cmap return result; } + const CmapSubtable *find_best_subtable (bool *symbol = nullptr) const + { + if (symbol) *symbol = false; + + const CmapSubtable *subtable; + + /* 32-bit subtables. */ + if ((subtable = this->find_subtable (3, 10))) return subtable; + if ((subtable = this->find_subtable (0, 6))) return subtable; + if ((subtable = this->find_subtable (0, 4))) return subtable; + + /* 16-bit subtables. */ + if ((subtable = this->find_subtable (3, 1))) return subtable; + if ((subtable = this->find_subtable (0, 3))) return subtable; + if ((subtable = this->find_subtable (0, 2))) return subtable; + if ((subtable = this->find_subtable (0, 1))) return subtable; + if ((subtable = this->find_subtable (0, 0))) return subtable; + + /* Symbol subtable. */ + if ((subtable = this->find_subtable (3, 0))) + { + if (symbol) *symbol = true; + return subtable; + } + + /* Meh. */ + return &Null(CmapSubtable); + } + struct accelerator_t { inline void init (hb_face_t *face) @@ -935,27 +964,8 @@ struct cmap this->blob = hb_sanitize_context_t().reference_table (face); const cmap *table = this->blob->as (); const CmapSubtableFormat14 *subtable_uvs = nullptr; - - subtable = nullptr; - - bool symbol = false; - /* 32-bit subtables. */ - if (!subtable) subtable = table->find_subtable (3, 10); - if (!subtable) subtable = table->find_subtable (0, 6); - if (!subtable) subtable = table->find_subtable (0, 4); - /* 16-bit subtables. */ - if (!subtable) subtable = table->find_subtable (3, 1); - if (!subtable) subtable = table->find_subtable (0, 3); - if (!subtable) subtable = table->find_subtable (0, 2); - if (!subtable) subtable = table->find_subtable (0, 1); - if (!subtable) subtable = table->find_subtable (0, 0); - if (!subtable) - { - subtable = table->find_subtable (3, 0); - if (subtable) symbol = true; - } - /* Meh. */ - if (!subtable) subtable = &Null(CmapSubtable); + bool symbol; + subtable = table->find_best_subtable (&symbol); /* UVS subtable. */ if (!subtable_uvs) From 1becabe06c0c58aaf69a9ba641508e77a60f3451 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 15:37:56 -0700 Subject: [PATCH 12/47] [cmap] Use bsearch to find subtables --- src/hb-ot-cmap-table.hh | 5 +---- test/shaping/data/in-house/tests/fuzzed.tests | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 173d62e63..a767354fe 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1101,10 +1101,7 @@ struct cmap key.platformID.set (platform_id); key.encodingID.set (encoding_id); - /* Note: We can use bsearch, but since it has no performance - * implications, we use lsearch and as such accept fonts with - * unsorted subtable list. */ - int result = encodingRecord./*bsearch*/lsearch (key); + int result = encodingRecord.bsearch (key); if (result == -1 || !encodingRecord[result].subtable) return nullptr; diff --git a/test/shaping/data/in-house/tests/fuzzed.tests b/test/shaping/data/in-house/tests/fuzzed.tests index 43a193341..a6ce93d02 100644 --- a/test/shaping/data/in-house/tests/fuzzed.tests +++ b/test/shaping/data/in-house/tests/fuzzed.tests @@ -10,7 +10,7 @@ ../fonts/fab39d60d758cb586db5a504f218442cd1395725.ttf:--font-funcs=ot:U+0041,U+0041:[gid0=0+1000|gid0=1+1000] ../fonts/205edd09bd3d141cc9580f650109556cc28b22cb.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] ../fonts/217a934cfe15c548b572c203dceb2befdf026462.ttf:--font-funcs=ot:U+0061,U+0061,U+0061:[] -../fonts/558661aa659912f4d30ecd27bd09835171a8e2b0.ttf:--font-funcs=ot:U+FFFD,U+E0100,U+FFFD,U+E0010:[] +../fonts/558661aa659912f4d30ecd27bd09835171a8e2b0.ttf:--font-funcs=ot:U+FFFD,U+E0100,U+FFFD,U+E0010:[gid3584=0+1000|gid1024=0+1000|gid1=0+1000|gid8=0+1000|gid3=0+1000|gid0=0+1000|gid1=0+1000|gid3584=0+1000|gid3584=2+1000|gid1024=2+1000|gid1=2+1000|gid8=2+1000|gid3=2+1000|gid0=2+1000|gid1=2+1000|gid3584=2+1000] ../fonts/a34a9191d9376bda419836effeef7e75c1386016.ttf:--font-funcs=ot:U+0041:[] ../fonts/a69118c2c2ada48ff803d9149daa54c9ebdae30e.ttf:--font-funcs=ot:U+0041:[gid0=0+1229] ../fonts/b6acef662e0beb8d5fcf5b61c6b0ca69537b7402.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] From 3336de24790ac1a12852ac2a3e2fff4d6bb19bc7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 15:41:25 -0700 Subject: [PATCH 13/47] [cmap] Remove unused code --- src/hb-ot-cmap-table.hh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index a767354fe..bf9874a3e 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1039,8 +1039,6 @@ struct cmap typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph); - typedef void (*hb_cmap_collect_unicodes_func_t) (const void *obj, - hb_set_t *out); template static inline bool get_glyph_from (const void *obj, @@ -1051,14 +1049,6 @@ struct cmap return typed_obj->get_glyph (codepoint, glyph); } - template - static inline void collect_unicodes_from (const void *obj, - hb_set_t *out) - { - const Type *typed_obj = (const Type *) obj; - typed_obj->collect_unicodes (out); - } - template static inline bool get_glyph_from_symbol (const void *obj, hb_codepoint_t codepoint, From 4806b3800d77603c203e8bb2e88baeb2b3a14f05 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 15:56:07 -0700 Subject: [PATCH 14/47] [cmap] Add hb_subset_collect_variation_selectors() To be moved to hb-face later. --- src/hb-ot-cmap-table.hh | 20 ++++++++++++++++---- src/hb-subset.cc | 30 ++++++++++++++++++++++++++---- src/hb-subset.h | 8 +++++++- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index bf9874a3e..2f115e2e4 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -594,7 +594,7 @@ struct UnicodeValueRange } HBUINT24 startUnicodeValue; /* First value in this range. */ - HBUINT8 additionalCount; /* Number of additional values in this + HBUINT8 additionalCount; /* Number of additional values in this * range. */ public: DEFINE_SIZE_STATIC (4); @@ -675,6 +675,13 @@ struct CmapSubtableFormat14 return record[record.bsearch(variation_selector)].get_glyph (codepoint, glyph, this); } + inline void collect_variation_selectors (hb_set_t *out) const + { + unsigned int count = record.len; + for (unsigned int i = 0; i < count; i++) + out->add (record.arrayZ[i].varSelector); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -977,7 +984,7 @@ struct cmap /* Meh. */ if (!subtable_uvs) subtable_uvs = &Null(CmapSubtableFormat14); - this->uvs_table = subtable_uvs; + this->subtable_uvs = subtable_uvs; this->get_glyph_data = subtable; if (unlikely (symbol)) @@ -1018,7 +1025,7 @@ struct cmap hb_codepoint_t variation_selector, hb_codepoint_t *glyph) const { - switch (this->uvs_table->get_glyph_variant (unicode, + switch (this->subtable_uvs->get_glyph_variant (unicode, variation_selector, glyph)) { @@ -1034,6 +1041,10 @@ struct cmap { subtable->collect_unicodes (out); } + inline void collect_variation_selectors (hb_set_t *out) const + { + subtable_uvs->collect_variation_selectors (out); + } protected: typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, @@ -1073,12 +1084,13 @@ struct cmap private: const CmapSubtable *subtable; + const CmapSubtableFormat14 *subtable_uvs; + hb_cmap_get_glyph_func_t get_glyph_func; const void *get_glyph_data; CmapSubtableFormat4::accelerator_t format4_accel; - const CmapSubtableFormat14 *uvs_table; hb_blob_t *blob; }; diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 2e991de20..01d9b89a2 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -238,14 +238,36 @@ hb_subset (hb_face_t *source, /** * hb_subset_collect_unicodes: - * @source: font face data to load. - * @out: set to add the all codepoints covered by font face, source. + * @face: font face. + * @out: set to add Unicode characters covered by @face to. + * + * Since: REPLACEME */ void -hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out) +hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out) { + /* XXX Use saved accel. */ OT::cmap::accelerator_t cmap; - cmap.init (source); + cmap.init (face); cmap.collect_unicodes (out); cmap.fini(); } + +/** + * hb_subset_collect_variation_selectors: + * @face: font face. + * @out: set to add Variation Selector characters covered by @face to. + * + * + * + * Since: REPLACEME + */ +void +hb_subset_collect_variation_selectors (hb_face_t *face, hb_set_t *out) +{ + /* XXX Use saved accel. */ + OT::cmap::accelerator_t cmap; + cmap.init (face); + cmap.collect_variation_selectors (out); + cmap.fini(); +} diff --git a/src/hb-subset.h b/src/hb-subset.h index b79b80946..745bacf23 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -80,10 +80,16 @@ hb_subset (hb_face_t *source, hb_subset_profile_t *profile, hb_subset_input_t *input); -/* hb_subset_collect_unicodes */ + +/* TODO Move to hb-face.h. */ + HB_EXTERN void hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out); +HB_EXTERN void +hb_subset_collect_variation_selectors (hb_face_t *source, hb_set_t *out); + + HB_END_DECLS #endif /* HB_SUBSET_H */ From 1dcf5fb038e7c2d3d03a50c4cd9869a922f9adf7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 16:11:26 -0700 Subject: [PATCH 15/47] [cmap Add hb_subset_collect_variation_unicodes() To be moved to hb-face.h later. --- src/hb-ot-cmap-table.hh | 59 ++++++++++++++++++++++++++++++++++------- src/hb-subset.cc | 25 ++++++++++++++++- src/hb-subset.h | 10 +++++-- 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 2f115e2e4..31f3b3094 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -296,7 +296,7 @@ struct CmapSubtableFormat4 { /* XXX This does NOT skip over chars mapping to gid0... */ if (this->startCount[i] != 0xFFFFu || this->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) - hb_set_add_range (out, this->startCount[i], this->endCount[i]); + out->add_range (this->startCount[i], this->endCount[i]); } } @@ -459,11 +459,9 @@ struct CmapSubtableLongSegmented inline void collect_unicodes (hb_set_t *out) const { for (unsigned int i = 0; i < this->groups.len; i++) { - hb_set_add_range (out, - MIN ((unsigned int) this->groups[i].startCharCode, - (unsigned int) HB_MAX_UNICODE_CODEPOINT_VALUE), - MIN ((unsigned int) this->groups[i].endCharCode, - (unsigned int) HB_MAX_UNICODE_CODEPOINT_VALUE)); + out->add_range (this->groups[i].startCharCode, + MIN ((hb_codepoint_t) this->groups[i].endCharCode, + (hb_codepoint_t) HB_MAX_UNICODE_CODEPOINT_VALUE)); } } @@ -600,7 +598,23 @@ struct UnicodeValueRange DEFINE_SIZE_STATIC (4); }; -typedef SortedArrayOf DefaultUVS; +struct DefaultUVS : SortedArrayOf +{ + inline void collect_unicodes (hb_set_t *out) const + { + unsigned int count = len; + for (unsigned int i = 0; i < count; i++) + { + hb_codepoint_t first = arrayZ[i].startUnicodeValue; + hb_codepoint_t last = MIN ((hb_codepoint_t) (first + arrayZ[i].additionalCount), + (hb_codepoint_t) HB_MAX_UNICODE_CODEPOINT_VALUE); + out->add_range (first, last); + } + } + + public: + DEFINE_SIZE_ARRAY (4, arrayZ); +}; struct UVSMapping { @@ -621,7 +635,18 @@ struct UVSMapping DEFINE_SIZE_STATIC (5); }; -typedef SortedArrayOf NonDefaultUVS; +struct NonDefaultUVS : SortedArrayOf +{ + inline void collect_unicodes (hb_set_t *out) const + { + unsigned int count = len; + for (unsigned int i = 0; i < count; i++) + out->add (arrayZ[i].glyphID); + } + + public: + DEFINE_SIZE_ARRAY (4, arrayZ); +}; struct VariationSelectorRecord { @@ -644,6 +669,12 @@ struct VariationSelectorRecord return GLYPH_VARIANT_NOT_FOUND; } + inline void collect_unicodes (hb_set_t *out, const void *base) const + { + (base+defaultUVS).collect_unicodes (out); + (base+nonDefaultUVS).collect_unicodes (out); + } + inline int cmp (const hb_codepoint_t &variation_selector) const { return varSelector.cmp (variation_selector); @@ -672,7 +703,7 @@ struct CmapSubtableFormat14 hb_codepoint_t variation_selector, hb_codepoint_t *glyph) const { - return record[record.bsearch(variation_selector)].get_glyph (codepoint, glyph, this); + return record[record.bsearch (variation_selector)].get_glyph (codepoint, glyph, this); } inline void collect_variation_selectors (hb_set_t *out) const @@ -681,6 +712,11 @@ struct CmapSubtableFormat14 for (unsigned int i = 0; i < count; i++) out->add (record.arrayZ[i].varSelector); } + inline void collect_variation_unicodes (hb_codepoint_t variation_selector, + hb_set_t *out) const + { + record[record.bsearch (variation_selector)].collect_unicodes (out, this); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -1045,6 +1081,11 @@ struct cmap { subtable_uvs->collect_variation_selectors (out); } + inline void collect_variation_unicodes (hb_codepoint_t variation_selector, + hb_set_t *out) const + { + subtable_uvs->collect_variation_unicodes (variation_selector, out); + } protected: typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 01d9b89a2..77d9e81c4 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -263,7 +263,8 @@ hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out) * Since: REPLACEME */ void -hb_subset_collect_variation_selectors (hb_face_t *face, hb_set_t *out) +hb_subset_collect_variation_selectors (hb_face_t *face, + hb_set_t *out) { /* XXX Use saved accel. */ OT::cmap::accelerator_t cmap; @@ -271,3 +272,25 @@ hb_subset_collect_variation_selectors (hb_face_t *face, hb_set_t *out) cmap.collect_variation_selectors (out); cmap.fini(); } + +/** + * hb_subset_collect_variation_unicodes: + * @face: font face. + * @out: set to add Unicode characters for @variation_selector covered by @face to. + * + * + * + * Since: REPLACEME + */ +void +hb_subset_collect_variation_unicodes (hb_face_t *face, + hb_codepoint_t variation_selector, + hb_set_t *out) +{ + /* XXX Use saved accel. */ + OT::cmap::accelerator_t cmap; + cmap.init (face); + cmap.collect_variation_unicodes (variation_selector, out); + cmap.fini(); +} + diff --git a/src/hb-subset.h b/src/hb-subset.h index 745bacf23..1e7d8f526 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -84,10 +84,16 @@ hb_subset (hb_face_t *source, /* TODO Move to hb-face.h. */ HB_EXTERN void -hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out); +hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out); HB_EXTERN void -hb_subset_collect_variation_selectors (hb_face_t *source, hb_set_t *out); +hb_subset_collect_variation_selectors (hb_face_t *face, + hb_set_t *out); + +HB_EXTERN void +hb_subset_collect_variation_unicodes (hb_face_t *face, + hb_codepoint_t variation_selector, + hb_set_t *out); HB_END_DECLS From c8cfb702e96bf4e89495fcc56f965c88bfa77dca Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 16:14:32 -0700 Subject: [PATCH 16/47] [cmap] Minor --- src/hb-ot-cmap-table.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 31f3b3094..dcdff008e 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -292,11 +292,13 @@ struct CmapSubtableFormat4 } inline void collect_unicodes (hb_set_t *out) const { - for (unsigned int i = 0; i < this->segCount; i++) + unsigned int count = this->segCount; + if (count && this->startCount[count - 1] == 0xFFFFu) + count--; /* Skip sentinel segment. */ + for (unsigned int i = 0; i < count; i++) { /* XXX This does NOT skip over chars mapping to gid0... */ - if (this->startCount[i] != 0xFFFFu || this->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) - out->add_range (this->startCount[i], this->endCount[i]); + out->add_range (this->startCount[i], this->endCount[i]); } } From ddea4d19cf6d64270e14418f02e7ff1f1b9458db Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 21:08:15 -0700 Subject: [PATCH 17/47] Add 1-param passthrough constructor to hb_auto_t<> And use. --- src/hb-dsalgs.hh | 1 + src/hb-ot-cmap-table.hh | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 8d59c6cf3..c7aa611e4 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -492,6 +492,7 @@ template struct hb_auto_t : Type { hb_auto_t (void) { Type::init (); } + template hb_auto_t (T1 t1) { Type::init (t1); } ~hb_auto_t (void) { Type::fini (); } private: /* Hide */ void init (void) {} diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index dcdff008e..af814bfb6 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -243,6 +243,7 @@ struct CmapSubtableFormat4 glyphIdArray = idRangeOffset + segCount; glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; } + inline void fini (void) {} inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { @@ -313,14 +314,12 @@ struct CmapSubtableFormat4 inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { - accelerator_t accel; - accel.init (this); + hb_auto_t accel (this); return accel.get_glyph_func (&accel, codepoint, glyph); } inline void collect_unicodes (hb_set_t *out) const { - accelerator_t accel; - accel.init (this); + hb_auto_t accel (this); accel.collect_unicodes (out); } From acce1fa3ea9707d0883cd66397fd187d3268905c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 21:15:39 -0700 Subject: [PATCH 18/47] Use new hb_auto_t<> constructor with Coverage::Iter --- src/hb-ot-layout-common-private.hh | 65 +++++++++++++++++++----------- src/hb-ot-layout-gsub-table.hh | 30 +++++--------- 2 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 89d5eae49..fa41241c0 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -743,6 +743,7 @@ struct CoverageFormat1 /* Older compilers need this to be public. */ struct Iter { inline void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; }; + inline void fini (void) {}; inline bool more (void) { return i < c->glyphArray.len; } inline void next (void) { i++; } inline hb_codepoint_t get_glyph (void) { return c->glyphArray[i]; } @@ -859,6 +860,7 @@ struct CoverageFormat2 i = c->rangeRecord.len; } } + inline void fini (void) {}; inline bool more (void) { return i < c->rangeRecord.len; } inline void next (void) { @@ -924,7 +926,8 @@ struct Coverage if (glyphs[i - 1] + 1 != glyphs[i]) num_ranges++; u.format.set (num_glyphs * 2 < num_ranges * 3 ? 1 : 2); - switch (u.format) { + switch (u.format) + { case 1: return_trace (u.format1.serialize (c, glyphs, num_glyphs)); case 2: return_trace (u.format2.serialize (c, glyphs, num_glyphs)); default:return_trace (false); @@ -935,25 +938,27 @@ struct Coverage { TRACE_SANITIZE (this); if (!u.format.sanitize (c)) return_trace (false); - switch (u.format) { + switch (u.format) + { case 1: return_trace (u.format1.sanitize (c)); case 2: return_trace (u.format2.sanitize (c)); default:return_trace (true); } } - inline bool intersects (const hb_set_t *glyphs) const { + inline bool intersects (const hb_set_t *glyphs) const + { /* TODO speed this up */ - Coverage::Iter iter; - for (iter.init (*this); iter.more (); iter.next ()) { + for (hb_auto_t iter (*this); iter.more (); iter.next ()) if (glyphs->has (iter.get_glyph ())) return true; - } return false; } - inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const { - switch (u.format) { + inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const + { + switch (u.format) + { case 1: return u.format1.intersects_coverage (glyphs, index); case 2: return u.format2.intersects_coverage (glyphs, index); default:return false; @@ -963,47 +968,61 @@ struct Coverage /* Might return false if array looks unsorted. * Used for faster rejection of corrupt data. */ template - inline bool add_coverage (set_t *glyphs) const { - switch (u.format) { + inline bool add_coverage (set_t *glyphs) const + { + switch (u.format) + { case 1: return u.format1.add_coverage (glyphs); case 2: return u.format2.add_coverage (glyphs); default:return false; } } - struct Iter { + struct Iter + { Iter (void) : format (0), u () {}; - inline void init (const Coverage &c_) { + inline void init (const Coverage &c_) + { format = c_.u.format; - switch (format) { + switch (format) + { case 1: u.format1.init (c_.u.format1); return; case 2: u.format2.init (c_.u.format2); return; - default: return; + default: return; } } - inline bool more (void) { - switch (format) { + inline void fini (void) {} + inline bool more (void) + { + switch (format) + { case 1: return u.format1.more (); case 2: return u.format2.more (); default:return false; } } - inline void next (void) { - switch (format) { + inline void next (void) + { + switch (format) + { case 1: u.format1.next (); break; case 2: u.format2.next (); break; - default: break; + default: break; } } - inline hb_codepoint_t get_glyph (void) { - switch (format) { + inline hb_codepoint_t get_glyph (void) + { + switch (format) + { case 1: return u.format1.get_glyph (); case 2: return u.format2.get_glyph (); default:return 0; } } - inline unsigned int get_coverage (void) { - switch (format) { + inline unsigned int get_coverage (void) + { + switch (format) + { case 1: return u.format1.get_coverage (); case 2: return u.format2.get_coverage (); default:return -1; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index a2f78b8fc..eaee7daa9 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -40,8 +40,7 @@ struct SingleSubstFormat1 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -55,8 +54,7 @@ struct SingleSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -125,9 +123,8 @@ struct SingleSubstFormat2 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = substitute.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -140,9 +137,8 @@ struct SingleSubstFormat2 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; unsigned int count = substitute.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -332,9 +328,8 @@ struct MultipleSubstFormat1 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = sequence.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -454,9 +449,8 @@ struct AlternateSubstFormat1 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = alternateSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -473,9 +467,8 @@ struct AlternateSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; unsigned int count = alternateSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -781,9 +774,8 @@ struct LigatureSubstFormat1 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = ligatureSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -796,9 +788,8 @@ struct LigatureSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; unsigned int count = ligatureSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -950,9 +941,8 @@ struct ReverseChainSingleSubstFormat1 return; const ArrayOf &substitute = StructAfter > (lookahead); - Coverage::Iter iter; count = substitute.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ From 28634db07e6ecbdb7e59ed8f989212272a97de86 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 21:23:43 -0700 Subject: [PATCH 19/47] [cmap] Fix skipping gid0 in Format4 collect_unicodes() --- src/hb-ot-cmap-table.hh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index af814bfb6..756b22d4c 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -298,8 +298,24 @@ struct CmapSubtableFormat4 count--; /* Skip sentinel segment. */ for (unsigned int i = 0; i < count; i++) { - /* XXX This does NOT skip over chars mapping to gid0... */ - out->add_range (this->startCount[i], this->endCount[i]); + unsigned int rangeOffset = this->idRangeOffset[i]; + if (rangeOffset == 0) + out->add_range (this->startCount[i], this->endCount[i]); + else + { + for (hb_codepoint_t codepoint = this->startCount[i]; + codepoint <= this->endCount[i]; + codepoint++) + { + unsigned int index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount; + if (unlikely (index >= this->glyphIdArrayLength)) + break; + hb_codepoint_t gid = this->glyphIdArray[index]; + if (unlikely (!gid)) + continue; + out->add (codepoint); + } + } } } From b09a0336ca856a2b1040e7fabd5819b64749e308 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 22:04:39 -0700 Subject: [PATCH 20/47] [cmap] More hb_auto_t<>(...) --- src/hb-subset.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 77d9e81c4..319987ce0 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -247,10 +247,8 @@ void hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out) { /* XXX Use saved accel. */ - OT::cmap::accelerator_t cmap; - cmap.init (face); + hb_auto_t cmap (face); cmap.collect_unicodes (out); - cmap.fini(); } /** @@ -267,10 +265,8 @@ hb_subset_collect_variation_selectors (hb_face_t *face, hb_set_t *out) { /* XXX Use saved accel. */ - OT::cmap::accelerator_t cmap; - cmap.init (face); + hb_auto_t cmap (face); cmap.collect_variation_selectors (out); - cmap.fini(); } /** @@ -288,9 +284,7 @@ hb_subset_collect_variation_unicodes (hb_face_t *face, hb_set_t *out) { /* XXX Use saved accel. */ - OT::cmap::accelerator_t cmap; - cmap.init (face); + hb_auto_t cmap (face); cmap.collect_variation_unicodes (variation_selector, out); - cmap.fini(); } From 82b12bcadd50c9e86bbe82623a1cbc0b4afdd237 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 22:07:17 -0700 Subject: [PATCH 21/47] [unicode] Add HB_UNICODE_MAX New API: HB_UNICODE_MAX --- docs/harfbuzz-sections.txt | 1 + src/hb-ot-cmap-table.hh | 8 ++------ src/hb-unicode.h | 3 +++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index f98e8cc13..043611e97 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -605,6 +605,7 @@ hb_shape_plan_t
hb-unicode +HB_UNICODE_MAX HB_UNICODE_MAX_DECOMPOSITION_LEN hb_unicode_combining_class hb_unicode_combining_class_func_t diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 756b22d4c..6ab578c25 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -37,10 +37,6 @@ */ #define HB_OT_TAG_cmap HB_TAG('c','m','a','p') -#ifndef HB_MAX_UNICODE_CODEPOINT_VALUE -#define HB_MAX_UNICODE_CODEPOINT_VALUE 0x10FFFF -#endif - namespace OT { @@ -478,7 +474,7 @@ struct CmapSubtableLongSegmented for (unsigned int i = 0; i < this->groups.len; i++) { out->add_range (this->groups[i].startCharCode, MIN ((hb_codepoint_t) this->groups[i].endCharCode, - (hb_codepoint_t) HB_MAX_UNICODE_CODEPOINT_VALUE)); + (hb_codepoint_t) HB_UNICODE_MAX)); } } @@ -624,7 +620,7 @@ struct DefaultUVS : SortedArrayOf { hb_codepoint_t first = arrayZ[i].startUnicodeValue; hb_codepoint_t last = MIN ((hb_codepoint_t) (first + arrayZ[i].additionalCount), - (hb_codepoint_t) HB_MAX_UNICODE_CODEPOINT_VALUE); + (hb_codepoint_t) HB_UNICODE_MAX); out->add_range (first, last); } } diff --git a/src/hb-unicode.h b/src/hb-unicode.h index 2657f4813..226c5d5c9 100644 --- a/src/hb-unicode.h +++ b/src/hb-unicode.h @@ -40,6 +40,9 @@ HB_BEGIN_DECLS +#define HB_UNICODE_MAX 0x10FFFFu + + /* hb_unicode_general_category_t */ /* Unicode Character Database property: General_Category (gc) */ From c77ae40852aabb1698da9e8d488f75bae2f4e734 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 22:36:36 -0700 Subject: [PATCH 22/47] Rename hb-*private.hh to hb-*.hh Sorry for the noise, downstream custom builders. Please adjust. --- src/Makefile.sources | 75 +++++++++---------- src/check-includes.sh | 8 +- src/dump-indic-data.cc | 2 +- src/dump-khmer-data.cc | 2 +- src/dump-myanmar-data.cc | 2 +- src/dump-use-data.cc | 2 +- src/gen-indic-table.py | 2 +- src/gen-use-table.py | 2 +- src/hb-aat-layout-ankr-table.hh | 2 +- src/hb-aat-layout-bsln-table.hh | 2 +- ...mon-private.hh => hb-aat-layout-common.hh} | 8 +- src/hb-aat-layout-feat-table.hh | 2 +- src/hb-aat-layout-kerx-table.hh | 4 +- src/hb-aat-layout-morx-table.hh | 6 +- src/hb-aat-layout-trak-table.hh | 6 +- src/hb-aat-layout.cc | 8 +- ...aat-layout-private.hh => hb-aat-layout.hh} | 14 ++-- src/hb-aat-ltag-table.hh | 2 +- src/{hb-atomic-private.hh => hb-atomic.hh} | 8 +- src/hb-blob.cc | 4 +- src/{hb-blob-private.hh => hb-blob.hh} | 8 +- src/hb-buffer-deserialize-json.hh | 2 +- src/hb-buffer-deserialize-json.rl | 2 +- src/hb-buffer-deserialize-text.hh | 2 +- src/hb-buffer-deserialize-text.rl | 2 +- src/hb-buffer-serialize.cc | 2 +- src/hb-buffer.cc | 4 +- src/{hb-buffer-private.hh => hb-buffer.hh} | 10 +-- src/hb-common.cc | 4 +- src/hb-coretext.cc | 4 +- src/hb-debug.hh | 4 +- src/hb-directwrite.cc | 4 +- src/hb-dsalgs.hh | 2 +- src/hb-face.cc | 8 +- src/{hb-face-private.hh => hb-face.hh} | 12 +-- src/hb-fallback-shape.cc | 2 +- src/hb-font.cc | 6 +- src/{hb-font-private.hh => hb-font.hh} | 12 +-- src/hb-ft.cc | 6 +- src/hb-glib.cc | 6 +- src/hb-gobject-enums.cc.tmpl | 2 +- src/hb-gobject-structs.cc | 2 +- src/hb-graphite2.cc | 2 +- src/hb-icu.cc | 6 +- src/{hb-iter-private.hh => hb-iter.hh} | 8 +- ...b-machinery-private.hh => hb-machinery.hh} | 12 +-- src/hb-map.cc | 2 +- src/{hb-map-private.hh => hb-map.hh} | 8 +- src/{hb-mutex-private.hh => hb-mutex.hh} | 8 +- src/hb-null.hh | 2 +- src/{hb-object-private.hh => hb-object.hh} | 14 ++-- ...b-open-file-private.hh => hb-open-file.hh} | 8 +- ...b-open-type-private.hh => hb-open-type.hh} | 14 ++-- src/hb-ot-cmap-table.hh | 4 +- src/hb-ot-color-cbdt-table.hh | 2 +- src/hb-ot-color-colr-table.hh | 2 +- src/hb-ot-color-cpal-table.hh | 2 +- src/hb-ot-color-sbix-table.hh | 2 +- src/hb-ot-color-svg-table.hh | 2 +- src/hb-ot-color.cc | 6 +- src/hb-ot-font.cc | 6 +- src/hb-ot-glyf-table.hh | 4 +- src/hb-ot-hdmx-table.hh | 2 +- src/hb-ot-head-table.hh | 2 +- src/hb-ot-hhea-table.hh | 2 +- src/hb-ot-hmtx-table.hh | 2 +- src/hb-ot-kern-table.hh | 2 +- src/hb-ot-layout-base-table.hh | 4 +- ...mmon-private.hh => hb-ot-layout-common.hh} | 14 ++-- src/hb-ot-layout-gdef-table.hh | 4 +- src/hb-ot-layout-gpos-table.hh | 2 +- src/hb-ot-layout-gsub-table.hh | 2 +- ...os-private.hh => hb-ot-layout-gsubgpos.hh} | 14 ++-- src/hb-ot-layout-jstf-table.hh | 2 +- src/hb-ot-layout.cc | 8 +- ...b-ot-layout-private.hh => hb-ot-layout.hh} | 16 ++-- src/hb-ot-map.cc | 4 +- src/{hb-ot-map-private.hh => hb-ot-map.hh} | 8 +- src/hb-ot-math-table.hh | 4 +- src/hb-ot-math.cc | 4 +- src/hb-ot-maxp-table.hh | 2 +- src/hb-ot-name-table.hh | 2 +- src/hb-ot-os2-table.hh | 2 +- src/hb-ot-os2-unicode-ranges.hh | 2 +- src/hb-ot-post-macroman.hh | 2 +- src/hb-ot-post-table.hh | 2 +- src/hb-ot-shape-complex-arabic-fallback.hh | 4 +- src/hb-ot-shape-complex-arabic-win1256.hh | 2 +- src/hb-ot-shape-complex-arabic.cc | 6 +- ...ivate.hh => hb-ot-shape-complex-arabic.hh} | 10 +-- src/hb-ot-shape-complex-default.cc | 2 +- src/hb-ot-shape-complex-hangul.cc | 2 +- src/hb-ot-shape-complex-hebrew.cc | 2 +- src/hb-ot-shape-complex-indic-machine.hh | 2 +- src/hb-ot-shape-complex-indic-machine.rl | 2 +- src/hb-ot-shape-complex-indic-table.cc | 2 +- src/hb-ot-shape-complex-indic.cc | 4 +- ...rivate.hh => hb-ot-shape-complex-indic.hh} | 12 +-- src/hb-ot-shape-complex-khmer-machine.hh | 2 +- src/hb-ot-shape-complex-khmer-machine.rl | 2 +- src/hb-ot-shape-complex-khmer.cc | 4 +- ...rivate.hh => hb-ot-shape-complex-khmer.hh} | 10 +-- src/hb-ot-shape-complex-myanmar-machine.hh | 2 +- src/hb-ot-shape-complex-myanmar-machine.rl | 2 +- src/hb-ot-shape-complex-myanmar.cc | 2 +- ...vate.hh => hb-ot-shape-complex-myanmar.hh} | 10 +-- src/hb-ot-shape-complex-thai.cc | 2 +- src/hb-ot-shape-complex-tibetan.cc | 2 +- src/hb-ot-shape-complex-use-machine.hh | 2 +- src/hb-ot-shape-complex-use-machine.rl | 2 +- src/hb-ot-shape-complex-use-table.cc | 2 +- src/hb-ot-shape-complex-use.cc | 4 +- ...-private.hh => hb-ot-shape-complex-use.hh} | 10 +-- ...plex-private.hh => hb-ot-shape-complex.hh} | 12 +-- src/hb-ot-shape-fallback.cc | 4 +- ...ack-private.hh => hb-ot-shape-fallback.hh} | 10 +-- src/hb-ot-shape-normalize.cc | 6 +- ...ze-private.hh => hb-ot-shape-normalize.hh} | 8 +- src/hb-ot-shape.cc | 20 ++--- ...{hb-ot-shape-private.hh => hb-ot-shape.hh} | 12 +-- src/hb-ot-tag.cc | 2 +- src/hb-ot-var-avar-table.hh | 2 +- src/hb-ot-var-fvar-table.hh | 2 +- src/hb-ot-var-hvar-table.hh | 2 +- src/hb-ot-var-mvar-table.hh | 2 +- src/hb-ot-var.cc | 4 +- ...set-digest-private.hh => hb-set-digest.hh} | 8 +- src/hb-set.cc | 2 +- src/{hb-set-private.hh => hb-set.hh} | 8 +- src/hb-shape-plan.cc | 10 +-- ...shape-plan-private.hh => hb-shape-plan.hh} | 10 +-- src/hb-shape.cc | 12 +-- ...aper-impl-private.hh => hb-shaper-impl.hh} | 16 ++-- src/hb-shaper.cc | 6 +- src/{hb-shaper-private.hh => hb-shaper.hh} | 8 +- src/hb-static.cc | 8 +- src/hb-string-array.hh | 2 +- src/hb-subset-glyf.cc | 2 +- src/hb-subset-glyf.hh | 2 +- src/hb-subset-input.cc | 4 +- src/hb-subset-plan.cc | 6 +- src/hb-subset-plan.hh | 6 +- src/hb-subset.cc | 8 +- src/{hb-subset-private.hh => hb-subset.hh} | 10 +-- src/hb-ucdn.cc | 6 +- src/hb-unicode.cc | 6 +- src/{hb-unicode-private.hh => hb-unicode.hh} | 8 +- src/hb-uniscribe.cc | 6 +- src/{hb-utf-private.hh => hb-utf.hh} | 8 +- src/{hb-vector-private.hh => hb-vector.hh} | 8 +- src/hb-warning.cc | 6 +- src/{hb-private.hh => hb.hh} | 12 +-- src/main.cc | 4 +- src/test-buffer-serialize.cc | 2 +- src/test-size-params.cc | 2 +- src/test-unicode-ranges.cc | 2 +- src/test-would-substitute.cc | 2 +- src/test.cc | 2 +- test/api/test-common.c | 1 - util/Makefile.am | 4 +- util/ansi-print.hh | 3 +- util/hb-subset.cc | 2 +- util/helper-cairo-ansi.hh | 2 +- util/helper-cairo.hh | 2 +- util/main-font-text.hh | 2 +- util/options.hh | 2 +- util/shape-consumer.hh | 2 +- util/view-cairo.hh | 2 +- 168 files changed, 452 insertions(+), 455 deletions(-) rename src/{hb-aat-layout-common-private.hh => hb-aat-layout-common.hh} (99%) rename src/{hb-aat-layout-private.hh => hb-aat-layout.hh} (84%) rename src/{hb-atomic-private.hh => hb-atomic.hh} (98%) rename src/{hb-blob-private.hh => hb-blob.hh} (94%) rename src/{hb-buffer-private.hh => hb-buffer.hh} (98%) rename src/{hb-face-private.hh => hb-face.hh} (94%) rename src/{hb-font-private.hh => hb-font.hh} (99%) rename src/{hb-iter-private.hh => hb-iter.hh} (97%) rename src/{hb-machinery-private.hh => hb-machinery.hh} (99%) rename src/{hb-map-private.hh => hb-map.hh} (98%) rename src/{hb-mutex-private.hh => hb-mutex.hh} (97%) rename src/{hb-object-private.hh => hb-object.hh} (97%) rename src/{hb-open-file-private.hh => hb-open-file.hh} (99%) rename src/{hb-open-type-private.hh => hb-open-type.hh} (98%) rename src/{hb-ot-layout-common-private.hh => hb-ot-layout-common.hh} (99%) rename src/{hb-ot-layout-gsubgpos-private.hh => hb-ot-layout-gsubgpos.hh} (99%) rename src/{hb-ot-layout-private.hh => hb-ot-layout.hh} (98%) rename src/{hb-ot-map-private.hh => hb-ot-map.hh} (98%) rename src/{hb-ot-shape-complex-arabic-private.hh => hb-ot-shape-complex-arabic.hh} (87%) rename src/{hb-ot-shape-complex-indic-private.hh => hb-ot-shape-complex-indic.hh} (98%) rename src/{hb-ot-shape-complex-khmer-private.hh => hb-ot-shape-complex-khmer.hh} (93%) rename src/{hb-ot-shape-complex-myanmar-private.hh => hb-ot-shape-complex-myanmar.hh} (95%) rename src/{hb-ot-shape-complex-use-private.hh => hb-ot-shape-complex-use.hh} (94%) rename src/{hb-ot-shape-complex-private.hh => hb-ot-shape-complex.hh} (98%) rename src/{hb-ot-shape-fallback-private.hh => hb-ot-shape-fallback.hh} (90%) rename src/{hb-ot-shape-normalize-private.hh => hb-ot-shape-normalize.hh} (93%) rename src/{hb-ot-shape-private.hh => hb-ot-shape.hh} (94%) rename src/{hb-set-digest-private.hh => hb-set-digest.hh} (97%) rename src/{hb-set-private.hh => hb-set.hh} (99%) rename src/{hb-shape-plan-private.hh => hb-shape-plan.hh} (92%) rename src/{hb-shaper-impl-private.hh => hb-shaper-impl.hh} (82%) rename src/{hb-shaper-private.hh => hb-shaper.hh} (97%) rename src/{hb-subset-private.hh => hb-subset.hh} (90%) rename src/{hb-unicode-private.hh => hb-unicode.hh} (99%) rename src/{hb-utf-private.hh => hb-utf.hh} (98%) rename src/{hb-vector-private.hh => hb-vector.hh} (97%) rename src/{hb-private.hh => hb.hh} (98%) diff --git a/src/Makefile.sources b/src/Makefile.sources index b981b0e26..32b49c952 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -1,28 +1,28 @@ # Base and default-included sources and headers HB_BASE_sources = \ - hb-atomic-private.hh \ - hb-blob-private.hh \ + hb-atomic.hh \ + hb-blob.hh \ hb-blob.cc \ - hb-buffer-private.hh \ + hb-buffer.hh \ hb-buffer-serialize.cc \ hb-buffer.cc \ hb-common.cc \ hb-debug.hh \ hb-dsalgs.hh \ - hb-face-private.hh \ + hb-face.hh \ hb-face.cc \ - hb-font-private.hh \ + hb-font.hh \ hb-font.cc \ - hb-iter-private.hh \ - hb-map-private.hh \ + hb-iter.hh \ + hb-map.hh \ hb-map.cc \ - hb-machinery-private.hh \ - hb-mutex-private.hh \ + hb-machinery.hh \ + hb-mutex.hh \ hb-null.hh \ - hb-object-private.hh \ - hb-open-file-private.hh \ - hb-open-type-private.hh \ + hb-object.hh \ + hb-open-file.hh \ + hb-open-type.hh \ hb-ot-color-cbdt-table.hh \ hb-ot-cmap-table.hh \ hb-ot-glyf-table.hh \ @@ -38,23 +38,23 @@ HB_BASE_sources = \ hb-ot-post-macroman.hh \ hb-ot-post-table.hh \ hb-ot-tag.cc \ - hb-private.hh \ - hb-set-digest-private.hh \ - hb-set-private.hh \ + hb.hh \ + hb-set-digest.hh \ + hb-set.hh \ hb-set.cc \ hb-shape.cc \ - hb-shape-plan-private.hh \ + hb-shape-plan.hh \ hb-shape-plan.cc \ hb-shaper-list.hh \ - hb-shaper-impl-private.hh \ - hb-shaper-private.hh \ + hb-shaper-impl.hh \ + hb-shaper.hh \ hb-shaper.cc \ hb-static.cc \ hb-string-array.hh \ - hb-unicode-private.hh \ + hb-unicode.hh \ hb-unicode.cc \ - hb-vector-private.hh \ - hb-utf-private.hh \ + hb-vector.hh \ + hb-utf.hh \ hb-warning.cc \ $(NULL) @@ -89,61 +89,61 @@ HB_FALLBACK_sources = \ HB_OT_sources = \ hb-aat-layout.cc \ - hb-aat-layout-common-private.hh \ + hb-aat-layout-common.hh \ hb-aat-layout-ankr-table.hh \ hb-aat-layout-bsln-table.hh \ hb-aat-layout-feat-table.hh \ hb-aat-layout-kerx-table.hh \ hb-aat-layout-morx-table.hh \ hb-aat-layout-trak-table.hh \ - hb-aat-layout-private.hh \ + hb-aat-layout.hh \ hb-aat-ltag-table.hh \ hb-ot-font.cc \ hb-ot-layout.cc \ hb-ot-layout-base-table.hh \ - hb-ot-layout-common-private.hh \ + hb-ot-layout-common.hh \ hb-ot-layout-gdef-table.hh \ hb-ot-layout-gpos-table.hh \ - hb-ot-layout-gsubgpos-private.hh \ + hb-ot-layout-gsubgpos.hh \ hb-ot-layout-gsub-table.hh \ hb-ot-layout-jstf-table.hh \ - hb-ot-layout-private.hh \ + hb-ot-layout.hh \ hb-ot-color.cc \ hb-ot-color-colr-table.hh \ hb-ot-color-cpal-table.hh \ hb-ot-color-sbix-table.hh \ hb-ot-color-svg-table.hh \ hb-ot-map.cc \ - hb-ot-map-private.hh \ + hb-ot-map.hh \ hb-ot-math.cc \ hb-ot-math-table.hh \ hb-ot-shape.cc \ hb-ot-shape-complex-arabic.cc \ hb-ot-shape-complex-arabic-fallback.hh \ - hb-ot-shape-complex-arabic-private.hh \ + hb-ot-shape-complex-arabic.hh \ hb-ot-shape-complex-arabic-table.hh \ hb-ot-shape-complex-arabic-win1256.hh \ hb-ot-shape-complex-default.cc \ hb-ot-shape-complex-hangul.cc \ hb-ot-shape-complex-hebrew.cc \ hb-ot-shape-complex-indic.cc \ - hb-ot-shape-complex-indic-private.hh \ + hb-ot-shape-complex-indic.hh \ hb-ot-shape-complex-indic-table.cc \ - hb-ot-shape-complex-khmer-private.hh \ + hb-ot-shape-complex-khmer.hh \ hb-ot-shape-complex-khmer.cc \ - hb-ot-shape-complex-myanmar-private.hh \ + hb-ot-shape-complex-myanmar.hh \ hb-ot-shape-complex-myanmar.cc \ hb-ot-shape-complex-thai.cc \ hb-ot-shape-complex-tibetan.cc \ hb-ot-shape-complex-use.cc \ - hb-ot-shape-complex-use-private.hh \ + hb-ot-shape-complex-use.hh \ hb-ot-shape-complex-use-table.cc \ - hb-ot-shape-complex-private.hh \ - hb-ot-shape-normalize-private.hh \ + hb-ot-shape-complex.hh \ + hb-ot-shape-normalize.hh \ hb-ot-shape-normalize.cc \ - hb-ot-shape-fallback-private.hh \ + hb-ot-shape-fallback.hh \ hb-ot-shape-fallback.cc \ - hb-ot-shape-private.hh \ + hb-ot-shape.hh \ hb-ot-var.cc \ hb-ot-var-avar-table.hh \ hb-ot-var-fvar-table.hh \ @@ -214,9 +214,6 @@ HB_SUBSET_sources = \ HB_SUBSET_headers = \ hb-subset.h \ - hb-subset-glyf.hh \ - hb-subset-plan.hh \ - hb-subset-private.hh \ $(NULL) HB_GOBJECT_DIST_sources = hb-gobject-structs.cc diff --git a/src/check-includes.sh b/src/check-includes.sh index fd565da53..f938f706c 100755 --- a/src/check-includes.sh +++ b/src/check-includes.sh @@ -23,14 +23,14 @@ grep -v 'hb[.]h:' | grep . >&2 && stat=1 -echo 'Checking that source files #include "hb-*private.hh" first (or none)' +echo 'Checking that source files #include a private header first (or none)' for x in $HBSOURCES; do test -f "$srcdir/$x" -a ! -f "$x" && x="$srcdir/$x" - grep '#.*\' "$x" /dev/null | grep -v 'include _' | head -n 1 + grep '#.*\' "$x" /dev/null | head -n 1 done | -grep -v '"hb-.*private[.]hh"' | -grep -v 'hb-private[.]hh:' | +grep -v '"hb-.*[.]hh"' | +grep -v 'hb[.]hh' | grep . >&2 && stat=1 diff --git a/src/dump-indic-data.cc b/src/dump-indic-data.cc index d57413884..a50688981 100644 --- a/src/dump-indic-data.cc +++ b/src/dump-indic-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" int main (void) diff --git a/src/dump-khmer-data.cc b/src/dump-khmer-data.cc index 7dd09b2b5..12871fa85 100644 --- a/src/dump-khmer-data.cc +++ b/src/dump-khmer-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-khmer-private.hh" +#include "hb-ot-shape-complex-khmer.hh" int main (void) diff --git a/src/dump-myanmar-data.cc b/src/dump-myanmar-data.cc index 2df9cd987..9f8b12ed2 100644 --- a/src/dump-myanmar-data.cc +++ b/src/dump-myanmar-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-myanmar-private.hh" +#include "hb-ot-shape-complex-myanmar.hh" int main (void) diff --git a/src/dump-use-data.cc b/src/dump-use-data.cc index 0e64688f1..4a8b25842 100644 --- a/src/dump-use-data.cc +++ b/src/dump-use-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-use-private.hh" +#include "hb-ot-shape-complex-use.hh" int main (void) diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py index 6252664ca..e65b9814a 100755 --- a/src/gen-indic-table.py +++ b/src/gen-indic-table.py @@ -102,7 +102,7 @@ for h in headers: print (" * %s" % (l.strip())) print (" */") print () -print ('#include "hb-ot-shape-complex-indic-private.hh"') +print ('#include "hb-ot-shape-complex-indic.hh"') print () # Shorten values diff --git a/src/gen-use-table.py b/src/gen-use-table.py index c742ebaca..a8724619a 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -394,7 +394,7 @@ for h in headers: print (" * %s" % (l.strip())) print (" */") print () -print ('#include "hb-ot-shape-complex-use-private.hh"') +print ('#include "hb-ot-shape-complex-use.hh"') print () total = 0 diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh index 3b7912b9d..a197cec81 100644 --- a/src/hb-aat-layout-ankr-table.hh +++ b/src/hb-aat-layout-ankr-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LAYOUT_ANKR_TABLE_HH #define HB_AAT_LAYOUT_ANKR_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * ankr -- Anchor Point diff --git a/src/hb-aat-layout-bsln-table.hh b/src/hb-aat-layout-bsln-table.hh index df2bf5b43..b86408626 100644 --- a/src/hb-aat-layout-bsln-table.hh +++ b/src/hb-aat-layout-bsln-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LAYOUT_BSLN_TABLE_HH #define HB_AAT_LAYOUT_BSLN_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * bsln -- Baseline diff --git a/src/hb-aat-layout-common-private.hh b/src/hb-aat-layout-common.hh similarity index 99% rename from src/hb-aat-layout-common-private.hh rename to src/hb-aat-layout-common.hh index d7f35052d..25f4fe14a 100644 --- a/src/hb-aat-layout-common-private.hh +++ b/src/hb-aat-layout-common.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_AAT_LAYOUT_COMMON_PRIVATE_HH -#define HB_AAT_LAYOUT_COMMON_PRIVATE_HH +#ifndef HB_AAT_LAYOUT_COMMON_HH +#define HB_AAT_LAYOUT_COMMON_HH -#include "hb-aat-layout-private.hh" +#include "hb-aat-layout.hh" namespace AAT { @@ -641,4 +641,4 @@ struct hb_aat_apply_context_t : } /* namespace AAT */ -#endif /* HB_AAT_LAYOUT_COMMON_PRIVATE_HH */ +#endif /* HB_AAT_LAYOUT_COMMON_HH */ diff --git a/src/hb-aat-layout-feat-table.hh b/src/hb-aat-layout-feat-table.hh index 3e070d795..b70076316 100644 --- a/src/hb-aat-layout-feat-table.hh +++ b/src/hb-aat-layout-feat-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LAYOUT_FEAT_TABLE_HH #define HB_AAT_LAYOUT_FEAT_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * feat -- Feature Name diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index cc03d6278..615a8f8d4 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -28,8 +28,8 @@ #ifndef HB_AAT_LAYOUT_KERX_TABLE_HH #define HB_AAT_LAYOUT_KERX_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-aat-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-aat-layout-common.hh" #include "hb-aat-layout-ankr-table.hh" /* diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index f25842457..ef452e22b 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -27,9 +27,9 @@ #ifndef HB_AAT_LAYOUT_MORX_TABLE_HH #define HB_AAT_LAYOUT_MORX_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-aat-layout-common-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-aat-layout-common.hh" +#include "hb-ot-layout-common.hh" /* * morx -- Extended Glyph Metamorphosis diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh index f5dc558c3..c4bec2cab 100644 --- a/src/hb-aat-layout-trak-table.hh +++ b/src/hb-aat-layout-trak-table.hh @@ -28,9 +28,9 @@ #ifndef HB_AAT_LAYOUT_TRAK_TABLE_HH #define HB_AAT_LAYOUT_TRAK_TABLE_HH -#include "hb-aat-layout-common-private.hh" -#include "hb-ot-layout-private.hh" -#include "hb-open-type-private.hh" +#include "hb-aat-layout-common.hh" +#include "hb-ot-layout.hh" +#include "hb-open-type.hh" /* * trak -- Tracking diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index fc706d6bd..24ec53bc8 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" -#include "hb-ot-layout-private.hh" -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout.hh" +#include "hb-ot-layout-gsubgpos.hh" -#include "hb-aat-layout-private.hh" +#include "hb-aat-layout.hh" #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-feat-table.hh" // Just so we compile it; unused otherwise. diff --git a/src/hb-aat-layout-private.hh b/src/hb-aat-layout.hh similarity index 84% rename from src/hb-aat-layout-private.hh rename to src/hb-aat-layout.hh index ce75c8e71..ac9c53539 100644 --- a/src/hb-aat-layout-private.hh +++ b/src/hb-aat-layout.hh @@ -24,14 +24,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_AAT_LAYOUT_PRIVATE_HH -#define HB_AAT_LAYOUT_PRIVATE_HH +#ifndef HB_AAT_LAYOUT_HH +#define HB_AAT_LAYOUT_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" -#include "hb-open-type-private.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" +#include "hb-open-type.hh" HB_INTERNAL void @@ -40,4 +40,4 @@ hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer); HB_INTERNAL void hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer); -#endif /* HB_AAT_LAYOUT_PRIVATE_HH */ +#endif /* HB_AAT_LAYOUT_HH */ diff --git a/src/hb-aat-ltag-table.hh b/src/hb-aat-ltag-table.hh index 15c4e89cb..e308ab28c 100644 --- a/src/hb-aat-ltag-table.hh +++ b/src/hb-aat-ltag-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LTAG_TABLE_HH #define HB_AAT_LTAG_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * ltag -- Language Tag diff --git a/src/hb-atomic-private.hh b/src/hb-atomic.hh similarity index 98% rename from src/hb-atomic-private.hh rename to src/hb-atomic.hh index 297c64698..d494c8955 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic.hh @@ -29,10 +29,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_ATOMIC_PRIVATE_HH -#define HB_ATOMIC_PRIVATE_HH +#ifndef HB_ATOMIC_HH +#define HB_ATOMIC_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -278,4 +278,4 @@ struct hb_atomic_ptr_t }; -#endif /* HB_ATOMIC_PRIVATE_HH */ +#endif /* HB_ATOMIC_HH */ diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 25c3e05aa..a335df308 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -30,8 +30,8 @@ #define _POSIX_C_SOURCE 200809L #endif -#include "hb-private.hh" -#include "hb-blob-private.hh" +#include "hb.hh" +#include "hb-blob.hh" #ifdef HAVE_SYS_MMAN_H #ifdef HAVE_UNISTD_H diff --git a/src/hb-blob-private.hh b/src/hb-blob.hh similarity index 94% rename from src/hb-blob-private.hh rename to src/hb-blob.hh index 0d3fad574..bee8c9794 100644 --- a/src/hb-blob-private.hh +++ b/src/hb-blob.hh @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_BLOB_PRIVATE_HH -#define HB_BLOB_PRIVATE_HH +#ifndef HB_BLOB_HH +#define HB_BLOB_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -83,4 +83,4 @@ struct hb_blob_t DECLARE_NULL_INSTANCE (hb_blob_t); -#endif /* HB_BLOB_PRIVATE_HH */ +#endif /* HB_BLOB_HH */ diff --git a/src/hb-buffer-deserialize-json.hh b/src/hb-buffer-deserialize-json.hh index 380f3c5fc..1f9e2e91d 100644 --- a/src/hb-buffer-deserialize-json.hh +++ b/src/hb-buffer-deserialize-json.hh @@ -29,7 +29,7 @@ #ifndef HB_BUFFER_DESERIALIZE_JSON_HH #define HB_BUFFER_DESERIALIZE_JSON_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-buffer-deserialize-json.hh" diff --git a/src/hb-buffer-deserialize-json.rl b/src/hb-buffer-deserialize-json.rl index ec9bc7c9a..f3abb027b 100644 --- a/src/hb-buffer-deserialize-json.rl +++ b/src/hb-buffer-deserialize-json.rl @@ -27,7 +27,7 @@ #ifndef HB_BUFFER_DESERIALIZE_JSON_HH #define HB_BUFFER_DESERIALIZE_JSON_HH -#include "hb-private.hh" +#include "hb.hh" %%{ diff --git a/src/hb-buffer-deserialize-text.hh b/src/hb-buffer-deserialize-text.hh index 5bca369f8..67f0a1252 100644 --- a/src/hb-buffer-deserialize-text.hh +++ b/src/hb-buffer-deserialize-text.hh @@ -29,7 +29,7 @@ #ifndef HB_BUFFER_DESERIALIZE_TEXT_HH #define HB_BUFFER_DESERIALIZE_TEXT_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-buffer-deserialize-text.hh" diff --git a/src/hb-buffer-deserialize-text.rl b/src/hb-buffer-deserialize-text.rl index 1d90979a9..6268a6c50 100644 --- a/src/hb-buffer-deserialize-text.rl +++ b/src/hb-buffer-deserialize-text.rl @@ -27,7 +27,7 @@ #ifndef HB_BUFFER_DESERIALIZE_TEXT_HH #define HB_BUFFER_DESERIALIZE_TEXT_HH -#include "hb-private.hh" +#include "hb.hh" %%{ diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc index 11471941d..1b6d14731 100644 --- a/src/hb-buffer-serialize.cc +++ b/src/hb-buffer-serialize.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-buffer-private.hh" +#include "hb-buffer.hh" static const char *serialize_formats[] = { diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index eb7b01caa..536ab5d53 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -27,8 +27,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-buffer-private.hh" -#include "hb-utf-private.hh" +#include "hb-buffer.hh" +#include "hb-utf.hh" /** diff --git a/src/hb-buffer-private.hh b/src/hb-buffer.hh similarity index 98% rename from src/hb-buffer-private.hh rename to src/hb-buffer.hh index a6c4b6963..3e38fe1de 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer.hh @@ -27,11 +27,11 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_BUFFER_PRIVATE_HH -#define HB_BUFFER_PRIVATE_HH +#ifndef HB_BUFFER_HH +#define HB_BUFFER_HH -#include "hb-private.hh" -#include "hb-unicode-private.hh" +#include "hb.hh" +#include "hb-unicode.hh" #ifndef HB_BUFFER_MAX_LEN_FACTOR @@ -386,4 +386,4 @@ _next_cluster (hb_buffer_t *buffer, unsigned int start) #define HB_BUFFER_ASSERT_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, assert_var, var ()) -#endif /* HB_BUFFER_PRIVATE_HH */ +#endif /* HB_BUFFER_HH */ diff --git a/src/hb-common.cc b/src/hb-common.cc index 614b71b7f..ed3fed2a3 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -26,9 +26,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-machinery-private.hh" +#include "hb-machinery.hh" #include #ifdef HAVE_XLOCALE_H diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 1b916a53d..a7ba85f83 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -28,8 +28,8 @@ #define HB_SHAPER coretext -#include "hb-private.hh" -#include "hb-shaper-impl-private.hh" +#include "hb.hh" +#include "hb-shaper-impl.hh" #include "hb-coretext.h" #include diff --git a/src/hb-debug.hh b/src/hb-debug.hh index 9056ffca2..49663d215 100644 --- a/src/hb-debug.hh +++ b/src/hb-debug.hh @@ -27,8 +27,8 @@ #ifndef HB_DEBUG_HH #define HB_DEBUG_HH -#include "hb-private.hh" -#include "hb-atomic-private.hh" +#include "hb.hh" +#include "hb-atomic.hh" #include "hb-dsalgs.hh" diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index baad81884..35197c238 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -22,9 +22,9 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -#include "hb-private.hh" +#include "hb.hh" #define HB_SHAPER directwrite -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" #include diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index c7aa611e4..ec5708eb7 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -27,7 +27,7 @@ #ifndef HB_DSALGS_HH #define HB_DSALGS_HH -#include "hb-private.hh" +#include "hb.hh" /* Void! For when we need a expression-type of void. */ diff --git a/src/hb-face.cc b/src/hb-face.cc index 9cb0f2654..b3956c456 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -26,11 +26,11 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-face-private.hh" -#include "hb-blob-private.hh" -#include "hb-open-file-private.hh" +#include "hb-face.hh" +#include "hb-blob.hh" +#include "hb-open-file.hh" /** diff --git a/src/hb-face-private.hh b/src/hb-face.hh similarity index 94% rename from src/hb-face-private.hh rename to src/hb-face.hh index 086ce6e96..f90453dbd 100644 --- a/src/hb-face-private.hh +++ b/src/hb-face.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_FACE_PRIVATE_HH -#define HB_FACE_PRIVATE_HH +#ifndef HB_FACE_HH +#define HB_FACE_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-shaper-private.hh" -#include "hb-shape-plan-private.hh" +#include "hb-shaper.hh" +#include "hb-shape-plan.hh" /* @@ -105,4 +105,4 @@ DECLARE_NULL_INSTANCE (hb_face_t); #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS -#endif /* HB_FACE_PRIVATE_HH */ +#endif /* HB_FACE_HH */ diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc index eff20f70c..dc8536c82 100644 --- a/src/hb-fallback-shape.cc +++ b/src/hb-fallback-shape.cc @@ -25,7 +25,7 @@ */ #define HB_SHAPER fallback -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face) diff --git a/src/hb-font.cc b/src/hb-font.cc index 857b8f577..bc831dd53 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" /* diff --git a/src/hb-font-private.hh b/src/hb-font.hh similarity index 99% rename from src/hb-font-private.hh rename to src/hb-font.hh index d3a413802..4c8d0aeec 100644 --- a/src/hb-font-private.hh +++ b/src/hb-font.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_FONT_PRIVATE_HH -#define HB_FONT_PRIVATE_HH +#ifndef HB_FONT_HH +#define HB_FONT_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-face-private.hh" -#include "hb-shaper-private.hh" +#include "hb-face.hh" +#include "hb-shaper.hh" /* @@ -601,4 +601,4 @@ DECLARE_NULL_INSTANCE (hb_font_t); #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS -#endif /* HB_FONT_PRIVATE_HH */ +#endif /* HB_FONT_HH */ diff --git a/src/hb-ft.cc b/src/hb-ft.cc index c8740d15c..5d6abb29d 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -27,12 +27,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-ft.h" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" #include FT_ADVANCES_H #include FT_MULTIPLE_MASTERS_H diff --git a/src/hb-glib.cc b/src/hb-glib.cc index 81ec612d7..18f3a81db 100644 --- a/src/hb-glib.cc +++ b/src/hb-glib.cc @@ -26,12 +26,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-glib.h" -#include "hb-unicode-private.hh" -#include "hb-machinery-private.hh" +#include "hb-unicode.hh" +#include "hb-machinery.hh" #if !GLIB_CHECK_VERSION(2,29,14) diff --git a/src/hb-gobject-enums.cc.tmpl b/src/hb-gobject-enums.cc.tmpl index ca458a384..e056df478 100644 --- a/src/hb-gobject-enums.cc.tmpl +++ b/src/hb-gobject-enums.cc.tmpl @@ -25,7 +25,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" /* g++ didn't like older gtype.h gcc-only code path. */ #include diff --git a/src/hb-gobject-structs.cc b/src/hb-gobject-structs.cc index 0c8e55733..1b8758583 100644 --- a/src/hb-gobject-structs.cc +++ b/src/hb-gobject-structs.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" /* g++ didn't like older gtype.h gcc-only code path. */ #include diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index 1f42a36f3..817278f30 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -27,7 +27,7 @@ */ #define HB_SHAPER graphite2 -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" #include "hb-graphite2.h" diff --git a/src/hb-icu.cc b/src/hb-icu.cc index bffae0714..564f71fe2 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -27,12 +27,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-icu.h" -#include "hb-unicode-private.hh" -#include "hb-machinery-private.hh" +#include "hb-unicode.hh" +#include "hb-machinery.hh" #include #include diff --git a/src/hb-iter-private.hh b/src/hb-iter.hh similarity index 97% rename from src/hb-iter-private.hh rename to src/hb-iter.hh index 314133ade..6fd6aed79 100644 --- a/src/hb-iter-private.hh +++ b/src/hb-iter.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_ITER_PRIVATE_HH -#define HB_ITER_PRIVATE_HH +#ifndef HB_ITER_HH +#define HB_ITER_HH -#include "hb-private.hh" +#include "hb.hh" /* Unified iterator object. @@ -146,4 +146,4 @@ m (void) } } -#endif /* HB_ITER_PRIVATE_HH */ +#endif /* HB_ITER_HH */ diff --git a/src/hb-machinery-private.hh b/src/hb-machinery.hh similarity index 99% rename from src/hb-machinery-private.hh rename to src/hb-machinery.hh index b33dd996d..56ecff851 100644 --- a/src/hb-machinery-private.hh +++ b/src/hb-machinery.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_MACHINERY_PRIVATE_HH -#define HB_MACHINERY_PRIVATE_HH +#ifndef HB_MACHINERY_HH +#define HB_MACHINERY_HH -#include "hb-private.hh" -#include "hb-blob-private.hh" +#include "hb.hh" +#include "hb-blob.hh" -#include "hb-iter-private.hh" +#include "hb-iter.hh" /* @@ -870,4 +870,4 @@ struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t @@ -251,4 +251,4 @@ struct hb_map_t }; -#endif /* HB_MAP_PRIVATE_HH */ +#endif /* HB_MAP_HH */ diff --git a/src/hb-mutex-private.hh b/src/hb-mutex.hh similarity index 97% rename from src/hb-mutex-private.hh rename to src/hb-mutex.hh index 14bde3103..d8cdf4b64 100644 --- a/src/hb-mutex-private.hh +++ b/src/hb-mutex.hh @@ -29,10 +29,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_MUTEX_PRIVATE_HH -#define HB_MUTEX_PRIVATE_HH +#ifndef HB_MUTEX_HH +#define HB_MUTEX_HH -#include "hb-private.hh" +#include "hb.hh" /* mutex */ @@ -138,4 +138,4 @@ struct hb_mutex_t }; -#endif /* HB_MUTEX_PRIVATE_HH */ +#endif /* HB_MUTEX_HH */ diff --git a/src/hb-null.hh b/src/hb-null.hh index 91efee644..19886a5c6 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -27,7 +27,7 @@ #ifndef HB_NULL_HH #define HB_NULL_HH -#include "hb-private.hh" +#include "hb.hh" /* diff --git a/src/hb-object-private.hh b/src/hb-object.hh similarity index 97% rename from src/hb-object-private.hh rename to src/hb-object.hh index 4955a68dc..ca85af691 100644 --- a/src/hb-object-private.hh +++ b/src/hb-object.hh @@ -29,13 +29,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OBJECT_PRIVATE_HH -#define HB_OBJECT_PRIVATE_HH +#ifndef HB_OBJECT_HH +#define HB_OBJECT_HH -#include "hb-private.hh" -#include "hb-atomic-private.hh" -#include "hb-mutex-private.hh" -#include "hb-vector-private.hh" +#include "hb.hh" +#include "hb-atomic.hh" +#include "hb-mutex.hh" +#include "hb-vector.hh" /* @@ -322,4 +322,4 @@ static inline void *hb_object_get_user_data (Type *obj, } -#endif /* HB_OBJECT_PRIVATE_HH */ +#endif /* HB_OBJECT_HH */ diff --git a/src/hb-open-file-private.hh b/src/hb-open-file.hh similarity index 99% rename from src/hb-open-file-private.hh rename to src/hb-open-file.hh index d47bff66e..97e736eeb 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file.hh @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OPEN_FILE_PRIVATE_HH -#define HB_OPEN_FILE_PRIVATE_HH +#ifndef HB_OPEN_FILE_HH +#define HB_OPEN_FILE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-head-table.hh" @@ -565,4 +565,4 @@ struct OpenTypeFontFile } /* namespace OT */ -#endif /* HB_OPEN_FILE_PRIVATE_HH */ +#endif /* HB_OPEN_FILE_HH */ diff --git a/src/hb-open-type-private.hh b/src/hb-open-type.hh similarity index 98% rename from src/hb-open-type-private.hh rename to src/hb-open-type.hh index 5580565f1..48a8eaa76 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OPEN_TYPE_PRIVATE_HH -#define HB_OPEN_TYPE_PRIVATE_HH +#ifndef HB_OPEN_TYPE_HH +#define HB_OPEN_TYPE_HH -#include "hb-private.hh" -#include "hb-blob-private.hh" -#include "hb-face-private.hh" -#include "hb-machinery-private.hh" +#include "hb.hh" +#include "hb-blob.hh" +#include "hb-face.hh" +#include "hb-machinery.hh" namespace OT { @@ -646,4 +646,4 @@ struct BinSearchArrayOf : SortedArrayOf {}; } /* namespace OT */ -#endif /* HB_OPEN_TYPE_PRIVATE_HH */ +#endif /* HB_OPEN_TYPE_HH */ diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 6ab578c25..dce298138 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -27,8 +27,8 @@ #ifndef HB_OT_CMAP_TABLE_HH #define HB_OT_CMAP_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-set-private.hh" +#include "hb-open-type.hh" +#include "hb-set.hh" #include "hb-subset-plan.hh" /* diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index 21c2f4773..8533b0365 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_COLOR_CBDT_TABLE_HH #define HB_OT_COLOR_CBDT_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * CBLC -- Color Bitmap Location diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index ce6702d2a..070226f18 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -25,7 +25,7 @@ #ifndef HB_OT_COLOR_COLR_TABLE_HH #define HB_OT_COLOR_COLR_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * COLR -- Color diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh index 2c312748d..2c9fced09 100644 --- a/src/hb-ot-color-cpal-table.hh +++ b/src/hb-ot-color-cpal-table.hh @@ -28,7 +28,7 @@ #ifndef HB_OT_COLOR_CPAL_TABLE_HH #define HB_OT_COLOR_CPAL_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 0461afa32..1b643c77a 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -25,7 +25,7 @@ #ifndef HB_OT_COLOR_SBIX_TABLE_HH #define HB_OT_COLOR_SBIX_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * sbix -- Standard Bitmap Graphics diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh index 3976694f8..ad9162f7c 100644 --- a/src/hb-ot-color-svg-table.hh +++ b/src/hb-ot-color-svg-table.hh @@ -25,7 +25,7 @@ #ifndef HB_OT_COLOR_SVG_TABLE_HH #define HB_OT_COLOR_SVG_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * SVG -- SVG (Scalable Vector Graphics) diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index 44550d78b..7cdff380e 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -25,7 +25,7 @@ * Google Author(s): Sascha Brawer */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-color-colr-table.hh" #include "hb-ot-color-cpal-table.hh" #include "hb-ot.h" @@ -33,8 +33,8 @@ #include #include -#include "hb-ot-layout-private.hh" -#include "hb-shaper-private.hh" +#include "hb-ot-layout.hh" +#include "hb-shaper.hh" #if 0 HB_MARK_AS_FLAG_T (hb_ot_color_palette_flags_t) diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index c559d8754..f6e69d9e2 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod, Roozbeh Pournader */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-ot.h" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index bcf89e462..a23269e56 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -27,11 +27,11 @@ #ifndef HB_OT_GLYF_TABLE_HH #define HB_OT_GLYF_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-head-table.hh" #include "hb-subset-glyf.hh" #include "hb-subset-plan.hh" -#include "hb-subset-private.hh" +#include "hb-subset.hh" namespace OT { diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh index 0951871ce..5ce5fe4ab 100644 --- a/src/hb-ot-hdmx-table.hh +++ b/src/hb-ot-hdmx-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_HDMX_TABLE_HH #define HB_OT_HDMX_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-subset-plan.hh" /* diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh index fded120be..602e365ce 100644 --- a/src/hb-ot-head-table.hh +++ b/src/hb-ot-head-table.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_HEAD_TABLE_HH #define HB_OT_HEAD_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * head -- Font Header diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh index efb42b616..3336cadd4 100644 --- a/src/hb-ot-hhea-table.hh +++ b/src/hb-ot-hhea-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_HHEA_TABLE_HH #define HB_OT_HHEA_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * hhea -- Horizontal Header diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 13fa9d6e0..6849172b9 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_HMTX_TABLE_HH #define HB_OT_HMTX_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-hhea-table.hh" #include "hb-ot-os2-table.hh" #include "hb-ot-var-hvar-table.hh" diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index b4d810952..ac6e9e459 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_KERN_TABLE_HH #define HB_OT_KERN_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * kern -- Kerning diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh index 96da07fb5..449e74550 100644 --- a/src/hb-ot-layout-base-table.hh +++ b/src/hb-ot-layout-base-table.hh @@ -28,8 +28,8 @@ #ifndef HB_OT_LAYOUT_BASE_TABLE_HH #define HB_OT_LAYOUT_BASE_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout-common.hh" namespace OT { diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common.hh similarity index 99% rename from src/hb-ot-layout-common-private.hh rename to src/hb-ot-layout-common.hh index fa41241c0..887f27e9e 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_LAYOUT_COMMON_PRIVATE_HH -#define HB_OT_LAYOUT_COMMON_PRIVATE_HH +#ifndef HB_OT_LAYOUT_COMMON_HH +#define HB_OT_LAYOUT_COMMON_HH -#include "hb-private.hh" -#include "hb-ot-layout-private.hh" -#include "hb-open-type-private.hh" -#include "hb-set-private.hh" +#include "hb.hh" +#include "hb-ot-layout.hh" +#include "hb-open-type.hh" +#include "hb-set.hh" #ifndef HB_MAX_NESTING_LEVEL @@ -1822,4 +1822,4 @@ struct Device } /* namespace OT */ -#endif /* HB_OT_LAYOUT_COMMON_PRIVATE_HH */ +#endif /* HB_OT_LAYOUT_COMMON_HH */ diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index d2b41a8ef..637f7f5c4 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -29,9 +29,9 @@ #ifndef HB_OT_LAYOUT_GDEF_TABLE_HH #define HB_OT_LAYOUT_GDEF_TABLE_HH -#include "hb-ot-layout-common-private.hh" +#include "hb-ot-layout-common.hh" -#include "hb-font-private.hh" +#include "hb-font.hh" namespace OT { diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 95bc588be..66767dfda 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_LAYOUT_GPOS_TABLE_HH #define HB_OT_LAYOUT_GPOS_TABLE_HH -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout-gsubgpos.hh" namespace OT { diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index eaee7daa9..d2c1fb9a1 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_LAYOUT_GSUB_TABLE_HH #define HB_OT_LAYOUT_GSUB_TABLE_HH -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout-gsubgpos.hh" namespace OT { diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos.hh similarity index 99% rename from src/hb-ot-layout-gsubgpos-private.hh rename to src/hb-ot-layout-gsubgpos.hh index 9b1a19f0e..76a7e2532 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -26,14 +26,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH -#define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH +#ifndef HB_OT_LAYOUT_GSUBGPOS_HH +#define HB_OT_LAYOUT_GSUBGPOS_HH -#include "hb-private.hh" -#include "hb-buffer-private.hh" -#include "hb-map-private.hh" +#include "hb.hh" +#include "hb-buffer.hh" +#include "hb-map.hh" #include "hb-ot-layout-gdef-table.hh" -#include "hb-set-private.hh" +#include "hb-set.hh" namespace OT { @@ -2403,4 +2403,4 @@ struct GSUBGPOS } /* namespace OT */ -#endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ +#endif /* HB_OT_LAYOUT_GSUBGPOS_HH */ diff --git a/src/hb-ot-layout-jstf-table.hh b/src/hb-ot-layout-jstf-table.hh index 7fabdebb2..e718c319f 100644 --- a/src/hb-ot-layout-jstf-table.hh +++ b/src/hb-ot-layout-jstf-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_LAYOUT_JSTF_TABLE_HH #define HB_OT_LAYOUT_JSTF_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-layout-gpos-table.hh" diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 09f034336..1fe45438c 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -28,10 +28,10 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-open-type-private.hh" -#include "hb-ot-layout-private.hh" -#include "hb-ot-map-private.hh" -#include "hb-map-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout.hh" +#include "hb-ot-map.hh" +#include "hb-map.hh" #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsub-table.hh" diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout.hh similarity index 98% rename from src/hb-ot-layout-private.hh rename to src/hb-ot-layout.hh index 8f1e2c9c3..9c705b7d2 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout.hh @@ -26,15 +26,15 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_LAYOUT_PRIVATE_HH -#define HB_OT_LAYOUT_PRIVATE_HH +#ifndef HB_OT_LAYOUT_HH +#define HB_OT_LAYOUT_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" -#include "hb-set-digest-private.hh" -#include "hb-open-type-private.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" +#include "hb-set-digest.hh" +#include "hb-open-type.hh" /* Private API corresponding to hb-ot-layout.h: */ @@ -701,4 +701,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer) #undef lig_props #undef glyph_props -#endif /* HB_OT_LAYOUT_PRIVATE_HH */ +#endif /* HB_OT_LAYOUT_HH */ diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index f26cac9b1..29f52dcc2 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -26,9 +26,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-map-private.hh" +#include "hb-ot-map.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-layout.hh" void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map.hh similarity index 98% rename from src/hb-ot-map-private.hh rename to src/hb-ot-map.hh index 4aaf32831..32a9e7e00 100644 --- a/src/hb-ot-map-private.hh +++ b/src/hb-ot-map.hh @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_MAP_PRIVATE_HH -#define HB_OT_MAP_PRIVATE_HH +#ifndef HB_OT_MAP_HH +#define HB_OT_MAP_HH -#include "hb-buffer-private.hh" +#include "hb-buffer.hh" struct hb_ot_shape_plan_t; @@ -250,4 +250,4 @@ struct hb_ot_map_builder_t -#endif /* HB_OT_MAP_PRIVATE_HH */ +#endif /* HB_OT_MAP_HH */ diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh index 2dd714580..b7ca167b1 100644 --- a/src/hb-ot-math-table.hh +++ b/src/hb-ot-math-table.hh @@ -27,8 +27,8 @@ #ifndef HB_OT_MATH_TABLE_HH #define HB_OT_MATH_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout-common.hh" #include "hb-ot-math.h" namespace OT { diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index ead6259d4..48adf8acc 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -24,9 +24,9 @@ * Igalia Author(s): Frédéric Wang */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-layout.hh" #include "hb-ot-math-table.hh" static inline const OT::MATH& diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh index 75aac4f44..cd2a85ebc 100644 --- a/src/hb-ot-maxp-table.hh +++ b/src/hb-ot-maxp-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_MAXP_TABLE_HH #define HB_OT_MAXP_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-subset-plan.hh" namespace OT { diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index bff85df27..a1de1193f 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_NAME_TABLE_HH #define HB_OT_NAME_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" namespace OT { diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh index 56bbab741..c5ad803a2 100644 --- a/src/hb-ot-os2-table.hh +++ b/src/hb-ot-os2-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_OS2_TABLE_HH #define HB_OT_OS2_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-os2-unicode-ranges.hh" #include "hb-subset-plan.hh" diff --git a/src/hb-ot-os2-unicode-ranges.hh b/src/hb-ot-os2-unicode-ranges.hh index cb1260784..42dfa4906 100644 --- a/src/hb-ot-os2-unicode-ranges.hh +++ b/src/hb-ot-os2-unicode-ranges.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_OS2_UNICODE_RANGES_HH #define HB_OT_OS2_UNICODE_RANGES_HH -#include "hb-private.hh" +#include "hb.hh" namespace OT { diff --git a/src/hb-ot-post-macroman.hh b/src/hb-ot-post-macroman.hh index dbbb97e5a..b4df8aaee 100644 --- a/src/hb-ot-post-macroman.hh +++ b/src/hb-ot-post-macroman.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_POST_MACROMAN_HH #if 0 /* Make checks happy. */ #define HB_OT_POST_MACROMAN_HH -#include "hb-private.hh" +#include "hb.hh" #endif diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 4f08a51a2..44918b1d6 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_POST_TABLE_HH #define HB_OT_POST_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-subset-plan.hh" #define HB_STRING_ARRAY_NAME format1_names diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index a55511aa0..03f46d848 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -27,9 +27,9 @@ #ifndef HB_OT_SHAPE_COMPLEX_ARABIC_FALLBACK_HH #define HB_OT_SHAPE_COMPLEX_ARABIC_FALLBACK_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-private.hh" +#include "hb-ot-shape.hh" #include "hb-ot-layout-gsub-table.hh" diff --git a/src/hb-ot-shape-complex-arabic-win1256.hh b/src/hb-ot-shape-complex-arabic-win1256.hh index 54c6cdc24..b15e145f2 100644 --- a/src/hb-ot-shape-complex-arabic-win1256.hh +++ b/src/hb-ot-shape-complex-arabic-win1256.hh @@ -313,7 +313,7 @@ OT_TABLE_END * Include a second time to get the table data... */ #if 0 -#include "hb-private.hh" /* Make check-includes.sh happy. */ +#include "hb.hh" /* Make check-includes.sh happy. */ #endif #ifdef OT_MEASURE #include "hb-ot-shape-complex-arabic-win1256.hh" diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index f4b397b93..ebc1d3d5f 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-ot-shape-complex-arabic-private.hh" -#include "hb-ot-shape-private.hh" +#include "hb.hh" +#include "hb-ot-shape-complex-arabic.hh" +#include "hb-ot-shape.hh" /* buffer var allocations */ diff --git a/src/hb-ot-shape-complex-arabic-private.hh b/src/hb-ot-shape-complex-arabic.hh similarity index 87% rename from src/hb-ot-shape-complex-arabic-private.hh rename to src/hb-ot-shape-complex-arabic.hh index fcedc7d74..5bf6ff633 100644 --- a/src/hb-ot-shape-complex-arabic-private.hh +++ b/src/hb-ot-shape-complex-arabic.hh @@ -26,12 +26,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_HH +#define HB_OT_SHAPE_COMPLEX_ARABIC_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" struct arabic_shape_plan_t; @@ -47,4 +47,4 @@ setup_masks_arabic_plan (const arabic_shape_plan_t *arabic_plan, hb_buffer_t *buffer, hb_script_t script); -#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_HH */ diff --git a/src/hb-ot-shape-complex-default.cc b/src/hb-ot-shape-complex-default.cc index 68a62a10d..45d5f4346 100644 --- a/src/hb-ot-shape-complex-default.cc +++ b/src/hb-ot-shape-complex-default.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 7420c5d18..ea731114a 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" /* Hangul shaper */ diff --git a/src/hb-ot-shape-complex-hebrew.cc b/src/hb-ot-shape-complex-hebrew.cc index 34cf28b8e..ba25258a3 100644 --- a/src/hb-ot-shape-complex-hebrew.cc +++ b/src/hb-ot-shape-complex-hebrew.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" static bool diff --git a/src/hb-ot-shape-complex-indic-machine.hh b/src/hb-ot-shape-complex-indic-machine.hh index 73f9d5871..f67a525c5 100644 --- a/src/hb-ot-shape-complex-indic-machine.hh +++ b/src/hb-ot-shape-complex-indic-machine.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-ot-shape-complex-indic-machine.hh" diff --git a/src/hb-ot-shape-complex-indic-machine.rl b/src/hb-ot-shape-complex-indic-machine.rl index 35e7ce906..d384a68c3 100644 --- a/src/hb-ot-shape-complex-indic-machine.rl +++ b/src/hb-ot-shape-complex-indic-machine.rl @@ -27,7 +27,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine indic_syllable_machine; diff --git a/src/hb-ot-shape-complex-indic-table.cc b/src/hb-ot-shape-complex-indic-table.cc index 54291bc22..b7e4e7c7c 100644 --- a/src/hb-ot-shape-complex-indic-table.cc +++ b/src/hb-ot-shape-complex-indic-table.cc @@ -14,7 +14,7 @@ * # Date: 2017-10-16, 24:39:00 GMT [KW] */ -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" #define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 16 chars; Avagraha */ diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index b52656f44..d4541bb18 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -24,8 +24,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-indic-private.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-shape-complex-indic.hh" +#include "hb-ot-layout.hh" /* diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic.hh similarity index 98% rename from src/hb-ot-shape-complex-indic-private.hh rename to src/hb-ot-shape-complex-indic.hh index bb7fff384..9e597797c 100644 --- a/src/hb-ot-shape-complex-indic-private.hh +++ b/src/hb-ot-shape-complex-indic.hh @@ -24,14 +24,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_INDIC_HH +#define HB_OT_SHAPE_COMPLEX_INDIC_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-private.hh" -#include "hb-ot-shape-private.hh" /* XXX Remove */ +#include "hb-ot-shape-complex.hh" +#include "hb-ot-shape.hh" /* XXX Remove */ /* buffer var allocations */ @@ -400,4 +400,4 @@ set_indic_properties (hb_glyph_info_t &info) } -#endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_INDIC_HH */ diff --git a/src/hb-ot-shape-complex-khmer-machine.hh b/src/hb-ot-shape-complex-khmer-machine.hh index d00102156..a7e1711eb 100644 --- a/src/hb-ot-shape-complex-khmer-machine.hh +++ b/src/hb-ot-shape-complex-khmer-machine.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-ot-shape-complex-khmer-machine.hh" diff --git a/src/hb-ot-shape-complex-khmer-machine.rl b/src/hb-ot-shape-complex-khmer-machine.rl index 54644d8aa..7c7951629 100644 --- a/src/hb-ot-shape-complex-khmer-machine.rl +++ b/src/hb-ot-shape-complex-khmer-machine.rl @@ -27,7 +27,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine khmer_syllable_machine; diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 264515e86..0b5b50a97 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -24,8 +24,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-khmer-private.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-shape-complex-khmer.hh" +#include "hb-ot-layout.hh" /* diff --git a/src/hb-ot-shape-complex-khmer-private.hh b/src/hb-ot-shape-complex-khmer.hh similarity index 93% rename from src/hb-ot-shape-complex-khmer-private.hh rename to src/hb-ot-shape-complex-khmer.hh index f90ef9674..3371c1302 100644 --- a/src/hb-ot-shape-complex-khmer-private.hh +++ b/src/hb-ot-shape-complex-khmer.hh @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_KHMER_HH +#define HB_OT_SHAPE_COMPLEX_KHMER_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" /* buffer var allocations */ @@ -121,4 +121,4 @@ set_khmer_properties (hb_glyph_info_t &info) } -#endif /* HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_KHMER_HH */ diff --git a/src/hb-ot-shape-complex-myanmar-machine.hh b/src/hb-ot-shape-complex-myanmar-machine.hh index fb67dd42e..7fa235178 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.hh +++ b/src/hb-ot-shape-complex-myanmar-machine.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-ot-shape-complex-myanmar-machine.hh" diff --git a/src/hb-ot-shape-complex-myanmar-machine.rl b/src/hb-ot-shape-complex-myanmar-machine.rl index 0cd84fa1b..62f51d1e9 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.rl +++ b/src/hb-ot-shape-complex-myanmar-machine.rl @@ -27,7 +27,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine myanmar_syllable_machine; diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index e4214b87e..8466f8129 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-myanmar-private.hh" +#include "hb-ot-shape-complex-myanmar.hh" /* diff --git a/src/hb-ot-shape-complex-myanmar-private.hh b/src/hb-ot-shape-complex-myanmar.hh similarity index 95% rename from src/hb-ot-shape-complex-myanmar-private.hh rename to src/hb-ot-shape-complex-myanmar.hh index 14d011d67..7b6fd4837 100644 --- a/src/hb-ot-shape-complex-myanmar-private.hh +++ b/src/hb-ot-shape-complex-myanmar.hh @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_HH +#define HB_OT_SHAPE_COMPLEX_MYANMAR_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" /* buffer var allocations */ @@ -168,4 +168,4 @@ set_myanmar_properties (hb_glyph_info_t &info) } -#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_HH */ diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc index 02d78ac04..1d18760e4 100644 --- a/src/hb-ot-shape-complex-thai.cc +++ b/src/hb-ot-shape-complex-thai.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" /* Thai / Lao shaper */ diff --git a/src/hb-ot-shape-complex-tibetan.cc b/src/hb-ot-shape-complex-tibetan.cc index eaac0bf68..9982ebc29 100644 --- a/src/hb-ot-shape-complex-tibetan.cc +++ b/src/hb-ot-shape-complex-tibetan.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" static const hb_tag_t tibetan_features[] = diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh index 0ec805afc..77ca3aeb5 100644 --- a/src/hb-ot-shape-complex-use-machine.hh +++ b/src/hb-ot-shape-complex-use-machine.hh @@ -31,7 +31,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 38 "hb-ot-shape-complex-use-machine.hh" diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index 7ec8a7fd1..a233b1200 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine use_syllable_machine; diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index 9c796f051..4862b7fe9 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -15,7 +15,7 @@ * UnicodeData.txt does not have a header. */ -#include "hb-ot-shape-complex-use-private.hh" +#include "hb-ot-shape-complex-use.hh" #define B USE_B /* BASE */ #define CGJ USE_CGJ /* CGJ */ diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index f8e86c9d6..676b15b6e 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -26,8 +26,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-use-private.hh" -#include "hb-ot-shape-complex-arabic-private.hh" +#include "hb-ot-shape-complex-use.hh" +#include "hb-ot-shape-complex-arabic.hh" /* buffer var allocations */ #define use_category() complex_var_u8_0() diff --git a/src/hb-ot-shape-complex-use-private.hh b/src/hb-ot-shape-complex-use.hh similarity index 94% rename from src/hb-ot-shape-complex-use-private.hh rename to src/hb-ot-shape-complex-use.hh index b4bda8bb7..b8123e791 100644 --- a/src/hb-ot-shape-complex-use-private.hh +++ b/src/hb-ot-shape-complex-use.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_USE_HH +#define HB_OT_SHAPE_COMPLEX_USE_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" #define USE_TABLE_ELEMENT_TYPE uint8_t @@ -94,4 +94,4 @@ enum use_category_t { HB_INTERNAL USE_TABLE_ELEMENT_TYPE hb_use_get_category (hb_codepoint_t u); -#endif /* HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_USE_HH */ diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex.hh similarity index 98% rename from src/hb-ot-shape-complex-private.hh rename to src/hb-ot-shape-complex.hh index 37a4d918b..a48a38a20 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex.hh @@ -24,13 +24,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_HH +#define HB_OT_SHAPE_COMPLEX_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-private.hh" -#include "hb-ot-shape-normalize-private.hh" +#include "hb-ot-shape.hh" +#include "hb-ot-shape-normalize.hh" @@ -390,4 +390,4 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) } -#endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_HH */ diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index fbf31ab24..5f43023be 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -24,8 +24,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-fallback-private.hh" -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-shape-fallback.hh" +#include "hb-ot-layout-gsubgpos.hh" static unsigned int recategorize_combining_class (hb_codepoint_t u, diff --git a/src/hb-ot-shape-fallback-private.hh b/src/hb-ot-shape-fallback.hh similarity index 90% rename from src/hb-ot-shape-fallback-private.hh rename to src/hb-ot-shape-fallback.hh index e134224df..730e7f280 100644 --- a/src/hb-ot-shape-fallback-private.hh +++ b/src/hb-ot-shape-fallback.hh @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_FALLBACK_PRIVATE_HH -#define HB_OT_SHAPE_FALLBACK_PRIVATE_HH +#ifndef HB_OT_SHAPE_FALLBACK_HH +#define HB_OT_SHAPE_FALLBACK_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-private.hh" +#include "hb-ot-shape.hh" HB_INTERNAL void _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan, @@ -50,4 +50,4 @@ HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer); -#endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_FALLBACK_HH */ diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 358450ee7..fd0b63aec 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-normalize-private.hh" -#include "hb-ot-shape-complex-private.hh" -#include "hb-ot-shape-private.hh" +#include "hb-ot-shape-normalize.hh" +#include "hb-ot-shape-complex.hh" +#include "hb-ot-shape.hh" /* diff --git a/src/hb-ot-shape-normalize-private.hh b/src/hb-ot-shape-normalize.hh similarity index 93% rename from src/hb-ot-shape-normalize-private.hh rename to src/hb-ot-shape-normalize.hh index c744e2645..4aea640b1 100644 --- a/src/hb-ot-shape-normalize-private.hh +++ b/src/hb-ot-shape-normalize.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_NORMALIZE_PRIVATE_HH -#define HB_OT_SHAPE_NORMALIZE_PRIVATE_HH +#ifndef HB_OT_SHAPE_NORMALIZE_HH +#define HB_OT_SHAPE_NORMALIZE_HH -#include "hb-private.hh" +#include "hb.hh" /* buffer var allocations, used during the normalization process */ @@ -66,4 +66,4 @@ struct hb_ot_shape_normalize_context_t }; -#endif /* HB_OT_SHAPE_NORMALIZE_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_NORMALIZE_HH */ diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 91ac28fd6..e571bd8a3 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -28,19 +28,19 @@ #define HB_SHAPER ot #define hb_ot_shape_plan_data_t hb_ot_shape_plan_t -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" -#include "hb-ot-shape-private.hh" -#include "hb-ot-shape-complex-private.hh" -#include "hb-ot-shape-fallback-private.hh" -#include "hb-ot-shape-normalize-private.hh" +#include "hb-ot-shape.hh" +#include "hb-ot-shape-complex.hh" +#include "hb-ot-shape-fallback.hh" +#include "hb-ot-shape-normalize.hh" -#include "hb-ot-layout-private.hh" -#include "hb-unicode-private.hh" -#include "hb-set-private.hh" +#include "hb-ot-layout.hh" +#include "hb-unicode.hh" +#include "hb-set.hh" -#include "hb-ot-layout-gsubgpos-private.hh" -#include "hb-aat-layout-private.hh" +#include "hb-ot-layout-gsubgpos.hh" +#include "hb-aat-layout.hh" static hb_tag_t common_features[] = { HB_TAG('c','c','m','p'), diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape.hh similarity index 94% rename from src/hb-ot-shape-private.hh rename to src/hb-ot-shape.hh index d6898263f..b3a490a37 100644 --- a/src/hb-ot-shape-private.hh +++ b/src/hb-ot-shape.hh @@ -24,13 +24,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_PRIVATE_HH -#define HB_OT_SHAPE_PRIVATE_HH +#ifndef HB_OT_SHAPE_HH +#define HB_OT_SHAPE_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-map-private.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-map.hh" +#include "hb-ot-layout.hh" @@ -109,4 +109,4 @@ struct hb_ot_shape_planner_t }; -#endif /* HB_OT_SHAPE_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_HH */ diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 991d8e77a..283723e27 100644 --- a/src/hb-ot-tag.cc +++ b/src/hb-ot-tag.cc @@ -26,7 +26,7 @@ * Google Author(s): Behdad Esfahbod, Roozbeh Pournader */ -#include "hb-private.hh" +#include "hb.hh" /* hb_script_t */ diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index ad063d32d..8343018b3 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_AVAR_TABLE_HH #define HB_OT_VAR_AVAR_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * avar -- Axis Variations diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 101476ed3..afd29046e 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_FVAR_TABLE_HH #define HB_OT_VAR_FVAR_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * fvar -- Font Variations diff --git a/src/hb-ot-var-hvar-table.hh b/src/hb-ot-var-hvar-table.hh index 2b384db71..086e922fd 100644 --- a/src/hb-ot-var-hvar-table.hh +++ b/src/hb-ot-var-hvar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_HVAR_TABLE_HH #define HB_OT_VAR_HVAR_TABLE_HH -#include "hb-ot-layout-common-private.hh" +#include "hb-ot-layout-common.hh" namespace OT { diff --git a/src/hb-ot-var-mvar-table.hh b/src/hb-ot-var-mvar-table.hh index dfde782f6..20dd2200c 100644 --- a/src/hb-ot-var-mvar-table.hh +++ b/src/hb-ot-var-mvar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_MVAR_TABLE_HH #define HB_OT_VAR_MVAR_TABLE_HH -#include "hb-ot-layout-common-private.hh" +#include "hb-ot-layout-common.hh" namespace OT { diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index 5b890a3b9..5d49ac149 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-layout.hh" #include "hb-ot-var-avar-table.hh" #include "hb-ot-var-fvar-table.hh" #include "hb-ot-var-mvar-table.hh" diff --git a/src/hb-set-digest-private.hh b/src/hb-set-digest.hh similarity index 97% rename from src/hb-set-digest-private.hh rename to src/hb-set-digest.hh index e099a8264..4cd7c3ff8 100644 --- a/src/hb-set-digest-private.hh +++ b/src/hb-set-digest.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SET_DIGEST_PRIVATE_HH -#define HB_SET_DIGEST_PRIVATE_HH +#ifndef HB_SET_DIGEST_HH +#define HB_SET_DIGEST_HH -#include "hb-private.hh" +#include "hb.hh" /* * The set digests here implement various "filters" that support @@ -176,4 +176,4 @@ typedef hb_set_digest_combiner_t > hb_set_digest_t; -#endif /* HB_SET_DIGEST_PRIVATE_HH */ +#endif /* HB_SET_DIGEST_HH */ diff --git a/src/hb-set.cc b/src/hb-set.cc index 25027e6c2..09dc4b483 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-set-private.hh" +#include "hb-set.hh" /* Public API */ diff --git a/src/hb-set-private.hh b/src/hb-set.hh similarity index 99% rename from src/hb-set-private.hh rename to src/hb-set.hh index 032ddb1ee..a179ad13d 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SET_PRIVATE_HH -#define HB_SET_PRIVATE_HH +#ifndef HB_SET_HH +#define HB_SET_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -697,4 +697,4 @@ struct hb_set_t }; -#endif /* HB_SET_PRIVATE_HH */ +#endif /* HB_SET_HH */ diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index 0d61d9e1f..b0cf1e92d 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -24,11 +24,11 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-shape-plan-private.hh" -#include "hb-shaper-private.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" +#include "hb.hh" +#include "hb-shape-plan.hh" +#include "hb-shaper.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" static void diff --git a/src/hb-shape-plan-private.hh b/src/hb-shape-plan.hh similarity index 92% rename from src/hb-shape-plan-private.hh rename to src/hb-shape-plan.hh index 7d020ff16..bf82b912b 100644 --- a/src/hb-shape-plan-private.hh +++ b/src/hb-shape-plan.hh @@ -24,11 +24,11 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SHAPE_PLAN_PRIVATE_HH -#define HB_SHAPE_PLAN_PRIVATE_HH +#ifndef HB_SHAPE_PLAN_HH +#define HB_SHAPE_PLAN_HH -#include "hb-private.hh" -#include "hb-shaper-private.hh" +#include "hb.hh" +#include "hb-shaper.hh" struct hb_shape_plan_t @@ -64,4 +64,4 @@ DECLARE_NULL_INSTANCE (hb_shape_plan_t); #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS -#endif /* HB_SHAPE_PLAN_PRIVATE_HH */ +#endif /* HB_SHAPE_PLAN_HH */ diff --git a/src/hb-shape.cc b/src/hb-shape.cc index d3e2692fe..e8eeff5b3 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-shaper-private.hh" -#include "hb-shape-plan-private.hh" -#include "hb-buffer-private.hh" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-shaper.hh" +#include "hb-shape-plan.hh" +#include "hb-buffer.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" /** * SECTION:hb-shape diff --git a/src/hb-shaper-impl-private.hh b/src/hb-shaper-impl.hh similarity index 82% rename from src/hb-shaper-impl-private.hh rename to src/hb-shaper-impl.hh index 4a10279c7..d40cb085a 100644 --- a/src/hb-shaper-impl-private.hh +++ b/src/hb-shaper-impl.hh @@ -24,15 +24,15 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SHAPER_IMPL_PRIVATE_HH -#define HB_SHAPER_IMPL_PRIVATE_HH +#ifndef HB_SHAPER_IMPL_HH +#define HB_SHAPER_IMPL_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-shaper-private.hh" -#include "hb-shape-plan-private.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" +#include "hb-shaper.hh" +#include "hb-shape-plan.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" #ifdef HB_SHAPER @@ -40,4 +40,4 @@ #endif -#endif /* HB_SHAPER_IMPL_PRIVATE_HH */ +#endif /* HB_SHAPER_IMPL_HH */ diff --git a/src/hb-shaper.cc b/src/hb-shaper.cc index 660dfb2bd..52418c082 100644 --- a/src/hb-shaper.cc +++ b/src/hb-shaper.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-shaper-private.hh" -#include "hb-machinery-private.hh" +#include "hb.hh" +#include "hb-shaper.hh" +#include "hb-machinery.hh" static const hb_shaper_pair_t all_shapers[] = { diff --git a/src/hb-shaper-private.hh b/src/hb-shaper.hh similarity index 97% rename from src/hb-shaper-private.hh rename to src/hb-shaper.hh index fb04bbc3c..361165e4f 100644 --- a/src/hb-shaper-private.hh +++ b/src/hb-shaper.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SHAPER_PRIVATE_HH -#define HB_SHAPER_PRIVATE_HH +#ifndef HB_SHAPER_HH +#define HB_SHAPER_HH -#include "hb-private.hh" +#include "hb.hh" typedef hb_bool_t hb_shape_func_t (hb_shape_plan_t *shape_plan, hb_font_t *font, @@ -131,4 +131,4 @@ struct hb_shaper_data_t { #define HB_SHAPERS_COUNT (sizeof (hb_shaper_data_t) / sizeof (void *)) -#endif /* HB_SHAPER_PRIVATE_HH */ +#endif /* HB_SHAPER_HH */ diff --git a/src/hb-static.cc b/src/hb-static.cc index ddecbba11..5112d77be 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-open-type-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout-common.hh" -#include "hb-face-private.hh" +#include "hb-face.hh" #include "hb-ot-head-table.hh" #include "hb-ot-maxp-table.hh" diff --git a/src/hb-string-array.hh b/src/hb-string-array.hh index 679841c87..c4cf666d7 100644 --- a/src/hb-string-array.hh +++ b/src/hb-string-array.hh @@ -29,7 +29,7 @@ #define HB_STRING_ARRAY_HH #endif -#include "hb-private.hh" +#include "hb.hh" /* Based on Bruno Haible's code in Appendix B of Ulrich Drepper's dsohowto.pdf: * https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf */ diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index 36af3beae..e335912f6 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -24,7 +24,7 @@ * Google Author(s): Garret Rieger, Roderick Sheeter */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-glyf-table.hh" #include "hb-set.h" #include "hb-subset-glyf.hh" diff --git a/src/hb-subset-glyf.hh b/src/hb-subset-glyf.hh index 99b76db9b..c564206bd 100644 --- a/src/hb-subset-glyf.hh +++ b/src/hb-subset-glyf.hh @@ -27,7 +27,7 @@ #ifndef HB_SUBSET_GLYF_HH #define HB_SUBSET_GLYF_HH -#include "hb-private.hh" +#include "hb.hh" #include "hb-subset-plan.hh" diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 74470fd1f..d68550d70 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -24,8 +24,8 @@ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod */ -#include "hb-subset-private.hh" -#include "hb-set-private.hh" +#include "hb-subset.hh" +#include "hb-set.hh" /** * hb_subset_input_create_or_fail: diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 6e556c20b..1f643dc08 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -24,9 +24,9 @@ * Google Author(s): Garret Rieger, Roderick Sheeter */ -#include "hb-map-private.hh" -#include "hb-subset-private.hh" -#include "hb-set-private.hh" +#include "hb-map.hh" +#include "hb-subset.hh" +#include "hb-set.hh" #include "hb-subset-plan.hh" #include "hb-ot-cmap-table.hh" diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index b7f14d2ef..0f44f4b23 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -27,12 +27,12 @@ #ifndef HB_SUBSET_PLAN_HH #define HB_SUBSET_PLAN_HH -#include "hb-private.hh" +#include "hb.hh" #include "hb-subset.h" -#include "hb-subset-private.hh" +#include "hb-subset.hh" -#include "hb-map-private.hh" +#include "hb-map.hh" struct hb_subset_plan_t { diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 319987ce0..ad8a1106e 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -24,14 +24,14 @@ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-open-type-private.hh" +#include "hb.hh" +#include "hb-open-type.hh" #include "hb-subset-glyf.hh" -#include "hb-subset-private.hh" +#include "hb-subset.hh" #include "hb-subset-plan.hh" -#include "hb-open-file-private.hh" +#include "hb-open-file.hh" #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" #include "hb-ot-hdmx-table.hh" diff --git a/src/hb-subset-private.hh b/src/hb-subset.hh similarity index 90% rename from src/hb-subset-private.hh rename to src/hb-subset.hh index 42c93d7d3..e2993cda4 100644 --- a/src/hb-subset-private.hh +++ b/src/hb-subset.hh @@ -24,15 +24,15 @@ * Google Author(s): Garret Rieger, Roderick Sheeter */ -#ifndef HB_SUBSET_PRIVATE_HH -#define HB_SUBSET_PRIVATE_HH +#ifndef HB_SUBSET_HH +#define HB_SUBSET_HH -#include "hb-private.hh" +#include "hb.hh" #include "hb-subset.h" -#include "hb-font-private.hh" +#include "hb-font.hh" struct hb_subset_input_t { hb_object_header_t header; @@ -53,4 +53,4 @@ struct hb_subset_input_t { }; -#endif /* HB_SUBSET_PRIVATE_HH */ +#endif /* HB_SUBSET_HH */ diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc index 56d13e7cd..624c1eb41 100644 --- a/src/hb-ucdn.cc +++ b/src/hb-ucdn.cc @@ -14,10 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-unicode-private.hh" -#include "hb-machinery-private.hh" +#include "hb-unicode.hh" +#include "hb-machinery.hh" #include "ucdn.h" diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 8cb417233..bb1cd6821 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -28,9 +28,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-unicode-private.hh" +#include "hb-unicode.hh" @@ -450,7 +450,7 @@ hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, } -/* See hb-unicode-private.hh for details. */ +/* See hb-unicode.hh for details. */ const uint8_t _hb_modified_combining_class[256] = { diff --git a/src/hb-unicode-private.hh b/src/hb-unicode.hh similarity index 99% rename from src/hb-unicode-private.hh rename to src/hb-unicode.hh index fb16ba437..e6bca5f08 100644 --- a/src/hb-unicode-private.hh +++ b/src/hb-unicode.hh @@ -28,10 +28,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_UNICODE_PRIVATE_HH -#define HB_UNICODE_PRIVATE_HH +#ifndef HB_UNICODE_HH +#define HB_UNICODE_HH -#include "hb-private.hh" +#include "hb.hh" extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256]; @@ -366,4 +366,4 @@ DECLARE_NULL_INSTANCE (hb_unicode_funcs_t); FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \ FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL))) -#endif /* HB_UNICODE_PRIVATE_HH */ +#endif /* HB_UNICODE_HH */ diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 11b7384fa..4a77c8c1f 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #define HB_SHAPER uniscribe -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" #include #include @@ -34,7 +34,7 @@ #include "hb-uniscribe.h" -#include "hb-open-file-private.hh" +#include "hb-open-file.hh" #include "hb-ot-name-table.hh" #include "hb-ot-tag.h" diff --git a/src/hb-utf-private.hh b/src/hb-utf.hh similarity index 98% rename from src/hb-utf-private.hh rename to src/hb-utf.hh index 211eb4dc0..eccb632e4 100644 --- a/src/hb-utf-private.hh +++ b/src/hb-utf.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_UTF_PRIVATE_HH -#define HB_UTF_PRIVATE_HH +#ifndef HB_UTF_HH +#define HB_UTF_HH -#include "hb-private.hh" +#include "hb.hh" struct hb_utf8_t @@ -279,4 +279,4 @@ struct hb_latin1_t } }; -#endif /* HB_UTF_PRIVATE_HH */ +#endif /* HB_UTF_HH */ diff --git a/src/hb-vector-private.hh b/src/hb-vector.hh similarity index 97% rename from src/hb-vector-private.hh rename to src/hb-vector.hh index 1ef20d438..31341747c 100644 --- a/src/hb-vector-private.hh +++ b/src/hb-vector.hh @@ -25,10 +25,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_VECTOR_PRIVATE_HH -#define HB_VECTOR_PRIVATE_HH +#ifndef HB_VECTOR_HH +#define HB_VECTOR_HH -#include "hb-private.hh" +#include "hb.hh" template @@ -235,4 +235,4 @@ struct hb_vector_t }; -#endif /* HB_VECTOR_PRIVATE_HH */ +#endif /* HB_VECTOR_HH */ diff --git a/src/hb-warning.cc b/src/hb-warning.cc index f7a87b5ab..9fb410038 100644 --- a/src/hb-warning.cc +++ b/src/hb-warning.cc @@ -24,14 +24,14 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #if defined(HB_ATOMIC_INT_NIL) #error "Could not find any system to define atomic_int macros, library WILL NOT be thread-safe" -#error "Check hb-atomic-private.hh for possible resolutions." +#error "Check hb-atomic.hh for possible resolutions." #endif #if defined(HB_MUTEX_IMPL_NIL) #error "Could not find any system to define mutex macros, library WILL NOT be thread-safe" -#error "Check hb-mutex-private.hh for possible resolutions." +#error "Check hb-mutex.hh for possible resolutions." #endif diff --git a/src/hb-private.hh b/src/hb.hh similarity index 98% rename from src/hb-private.hh rename to src/hb.hh index efe7bda9e..557ae6b35 100644 --- a/src/hb-private.hh +++ b/src/hb.hh @@ -26,8 +26,8 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_PRIVATE_HH -#define HB_PRIVATE_HH +#ifndef HB_HH +#define HB_HH #define _GNU_SOURCE 1 @@ -470,11 +470,11 @@ _hb_memalign(void **memptr, size_t alignment, size_t size) /* Headers we include for everyone. Keep sorted. They express dependency amongst * themselves, but no other file should include them.*/ -#include "hb-atomic-private.hh" +#include "hb-atomic.hh" #include "hb-debug.hh" #include "hb-dsalgs.hh" -#include "hb-mutex-private.hh" +#include "hb-mutex.hh" #include "hb-null.hh" -#include "hb-object-private.hh" +#include "hb-object.hh" -#endif /* HB_PRIVATE_HH */ +#endif /* HB_HH */ diff --git a/src/main.cc b/src/main.cc index 98a1320bf..490b76e5b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -25,9 +25,9 @@ */ #include "hb-static.cc" -#include "hb-open-file-private.hh" +#include "hb-open-file.hh" #include "hb-ot-layout-gdef-table.hh" -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout-gsubgpos.hh" #ifdef HAVE_GLIB #include diff --git a/src/test-buffer-serialize.cc b/src/test-buffer-serialize.cc index 39eb13da7..a91f4f7e9 100644 --- a/src/test-buffer-serialize.cc +++ b/src/test-buffer-serialize.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" #include "hb-ot.h" diff --git a/src/test-size-params.cc b/src/test-size-params.cc index 3c43852b3..e53a47d8d 100644 --- a/src/test-size-params.cc +++ b/src/test-size-params.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" #include "hb-ot.h" diff --git a/src/test-unicode-ranges.cc b/src/test-unicode-ranges.cc index dbc5fa426..1334ea030 100644 --- a/src/test-unicode-ranges.cc +++ b/src/test-unicode-ranges.cc @@ -24,7 +24,7 @@ * Google Author(s): Garret Rieger */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-ot-os2-unicode-ranges.hh" diff --git a/src/test-would-substitute.cc b/src/test-would-substitute.cc index 1836d720c..268f7db98 100644 --- a/src/test-would-substitute.cc +++ b/src/test-would-substitute.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" #include "hb-ot.h" diff --git a/src/test.cc b/src/test.cc index cf59e00ac..f0eace8c4 100644 --- a/src/test.cc +++ b/src/test.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" diff --git a/test/api/test-common.c b/test/api/test-common.c index f6f0d4851..e9fae1351 100644 --- a/test/api/test-common.c +++ b/test/api/test-common.c @@ -32,7 +32,6 @@ static void test_types_int (void) { - /* We already ASSERT_STATIC these in hb-private.h, but anyway */ g_assert_cmpint (sizeof (int8_t), ==, 1); g_assert_cmpint (sizeof (uint8_t), ==, 1); g_assert_cmpint (sizeof (int16_t), ==, 2); diff --git a/util/Makefile.am b/util/Makefile.am index d4ab9cdc5..b8bf88418 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -47,7 +47,9 @@ hb_shape_SOURCES = $(HB_SHAPE_sources) bin_PROGRAMS += hb-shape hb_subset_SOURCES = $(HB_SUBSET_CLI_sources) -hb_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +hb_subset_LDADD = \ + $(LDADD) \ + $(top_builddir)/src/libharfbuzz-subset.la bin_PROGRAMS += hb-subset if HAVE_OT diff --git a/util/ansi-print.hh b/util/ansi-print.hh index 1ea5b3742..9640d892d 100644 --- a/util/ansi-print.hh +++ b/util/ansi-print.hh @@ -27,8 +27,7 @@ #ifndef ANSI_PRINT_HH #define ANSI_PRINT_HH -#include "hb-private.hh" -#include /* for int types */ +#include "hb.hh" void ansi_print_image_rgb24 (const uint32_t *data, diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 20617554c..a15495fa2 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -29,7 +29,7 @@ #include "main-font-text.hh" #include "hb-subset.h" -#include "hb-subset-private.hh" +#include "hb-subset.hh" /* XXX */ /* * Command line interface to the harfbuzz font subsetter. diff --git a/util/helper-cairo-ansi.hh b/util/helper-cairo-ansi.hh index cf18ea495..bc2313219 100644 --- a/util/helper-cairo-ansi.hh +++ b/util/helper-cairo-ansi.hh @@ -27,7 +27,7 @@ #ifndef HELPER_CAIRO_ANSI_HH #define HELPER_CAIRO_ANSI_HH -#include "hb-private.hh" +#include "hb.hh" #include diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index 50bc0af09..1613ce427 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -27,7 +27,7 @@ #ifndef HELPER_CAIRO_HH #define HELPER_CAIRO_HH -#include "hb-private.hh" +#include "hb.hh" #include "options.hh" #include diff --git a/util/main-font-text.hh b/util/main-font-text.hh index 3390371c5..01bd2d4d9 100644 --- a/util/main-font-text.hh +++ b/util/main-font-text.hh @@ -27,7 +27,7 @@ #ifndef HB_MAIN_FONT_TEXT_HH #define HB_MAIN_FONT_TEXT_HH -#include "hb-private.hh" +#include "hb.hh" #include "options.hh" /* main() body for utilities taking font and processing text.*/ diff --git a/util/options.hh b/util/options.hh index 2160d5ec3..345790943 100644 --- a/util/options.hh +++ b/util/options.hh @@ -27,7 +27,7 @@ #ifndef OPTIONS_HH #define OPTIONS_HH -#include "hb-private.hh" +#include "hb.hh" #include #include diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh index fa419f185..da0d88033 100644 --- a/util/shape-consumer.hh +++ b/util/shape-consumer.hh @@ -27,7 +27,7 @@ #ifndef HB_SHAPE_CONSUMER_HH #define HB_SHAPE_CONSUMER_HH -#include "hb-private.hh" +#include "hb.hh" #include "options.hh" diff --git a/util/view-cairo.hh b/util/view-cairo.hh index 00df68c29..677f74b38 100644 --- a/util/view-cairo.hh +++ b/util/view-cairo.hh @@ -27,7 +27,7 @@ #ifndef VIEW_CAIRO_HH #define VIEW_CAIRO_HH -#include "hb-private.hh" +#include "hb.hh" #include "options.hh" #include "helper-cairo.hh" From 66384db97c439a64d729f9206657d0b37ec0cb32 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 22:39:17 -0700 Subject: [PATCH 23/47] Minor --- src/hb-subset.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-subset.hh b/src/hb-subset.hh index e2993cda4..e3023d654 100644 --- a/src/hb-subset.hh +++ b/src/hb-subset.hh @@ -34,7 +34,8 @@ #include "hb-font.hh" -struct hb_subset_input_t { +struct hb_subset_input_t +{ hb_object_header_t header; ASSERT_POD (); From dae39c58fb63c2211e2842121bbe6d5b8b18651b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 22:44:39 -0700 Subject: [PATCH 24/47] [face] Introduce character-map API New API: +hb_face_collect_unicodes +hb_face_collect_variation_selectors +hb_face_collect_variation_unicodes --- docs/harfbuzz-sections.txt | 3 + src/hb-face.cc | 61 ++++++++++++++++++- src/hb-face.h | 19 ++++++ src/hb-subset.cc | 53 ---------------- src/hb-subset.h | 15 ----- test/api/test-subset-codepoints.c | 6 +- .../hb-subset-get-codepoints-fuzzer.cc | 2 +- 7 files changed, 86 insertions(+), 73 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 043611e97..ca0e908fe 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -189,6 +189,9 @@ hb_face_set_glyph_count hb_face_set_index hb_face_set_upem hb_face_set_user_data +hb_face_collect_unicodes +hb_face_collect_variation_selectors +hb_face_collect_variation_unicodes hb_face_builder_create hb_face_builder_add_table
diff --git a/src/hb-face.cc b/src/hb-face.cc index b3956c456..286b1f2ca 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -31,6 +31,7 @@ #include "hb-face.hh" #include "hb-blob.hh" #include "hb-open-file.hh" +#include "hb-ot-cmap-table.hh" /** @@ -514,6 +515,65 @@ hb_face_get_table_tags (const hb_face_t *face, } +/* + * Character set. + */ + +/** + * hb_face_collect_unicodes: + * @face: font face. + * @out: set to add Unicode characters covered by @face to. + * + * Since: REPLACEME + */ +void +hb_face_collect_unicodes (hb_face_t *face, + hb_set_t *out) +{ + /* XXX Use saved accel. */ + hb_auto_t cmap (face); + cmap.collect_unicodes (out); +} + +/** + * hb_face_collect_variation_selectors: + * @face: font face. + * @out: set to add Variation Selector characters covered by @face to. + * + * + * + * Since: REPLACEME + */ +void +hb_face_collect_variation_selectors (hb_face_t *face, + hb_set_t *out) +{ + /* XXX Use saved accel. */ + hb_auto_t cmap (face); + cmap.collect_variation_selectors (out); +} + +/** + * hb_face_collect_variation_unicodes: + * @face: font face. + * @out: set to add Unicode characters for @variation_selector covered by @face to. + * + * + * + * Since: REPLACEME + */ +void +hb_face_collect_variation_unicodes (hb_face_t *face, + hb_codepoint_t variation_selector, + hb_set_t *out) +{ + /* XXX Use saved accel. */ + hb_auto_t cmap (face); + cmap.collect_variation_unicodes (variation_selector, out); +} + + + /* * face-builder: A face that has add_table(). */ @@ -660,4 +720,3 @@ hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) return true; } - diff --git a/src/hb-face.h b/src/hb-face.h index 2bc3e8957..e8ff090d5 100644 --- a/src/hb-face.h +++ b/src/hb-face.h @@ -33,6 +33,7 @@ #include "hb-common.h" #include "hb-blob.h" +#include "hb-set.h" HB_BEGIN_DECLS @@ -121,6 +122,24 @@ hb_face_get_table_tags (const hb_face_t *face, hb_tag_t *table_tags /* OUT */); +/* + * Character set. + */ + +HB_EXTERN void +hb_face_collect_unicodes (hb_face_t *face, + hb_set_t *out); + +HB_EXTERN void +hb_face_collect_variation_selectors (hb_face_t *face, + hb_set_t *out); + +HB_EXTERN void +hb_face_collect_variation_unicodes (hb_face_t *face, + hb_codepoint_t variation_selector, + hb_set_t *out); + + /* * Builder face. */ diff --git a/src/hb-subset.cc b/src/hb-subset.cc index ad8a1106e..1ba160591 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -235,56 +235,3 @@ hb_subset (hb_face_t *source, hb_subset_plan_destroy (plan); return result; } - -/** - * hb_subset_collect_unicodes: - * @face: font face. - * @out: set to add Unicode characters covered by @face to. - * - * Since: REPLACEME - */ -void -hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out) -{ - /* XXX Use saved accel. */ - hb_auto_t cmap (face); - cmap.collect_unicodes (out); -} - -/** - * hb_subset_collect_variation_selectors: - * @face: font face. - * @out: set to add Variation Selector characters covered by @face to. - * - * - * - * Since: REPLACEME - */ -void -hb_subset_collect_variation_selectors (hb_face_t *face, - hb_set_t *out) -{ - /* XXX Use saved accel. */ - hb_auto_t cmap (face); - cmap.collect_variation_selectors (out); -} - -/** - * hb_subset_collect_variation_unicodes: - * @face: font face. - * @out: set to add Unicode characters for @variation_selector covered by @face to. - * - * - * - * Since: REPLACEME - */ -void -hb_subset_collect_variation_unicodes (hb_face_t *face, - hb_codepoint_t variation_selector, - hb_set_t *out) -{ - /* XXX Use saved accel. */ - hb_auto_t cmap (face); - cmap.collect_variation_unicodes (variation_selector, out); -} - diff --git a/src/hb-subset.h b/src/hb-subset.h index 1e7d8f526..8b7fcc6c9 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -81,21 +81,6 @@ hb_subset (hb_face_t *source, hb_subset_input_t *input); -/* TODO Move to hb-face.h. */ - -HB_EXTERN void -hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out); - -HB_EXTERN void -hb_subset_collect_variation_selectors (hb_face_t *face, - hb_set_t *out); - -HB_EXTERN void -hb_subset_collect_variation_unicodes (hb_face_t *face, - hb_codepoint_t variation_selector, - hb_set_t *out); - - HB_END_DECLS #endif /* HB_SUBSET_H */ diff --git a/test/api/test-subset-codepoints.c b/test/api/test-subset-codepoints.c index a2c40cd67..affe93149 100644 --- a/test/api/test-subset-codepoints.c +++ b/test/api/test-subset-codepoints.c @@ -33,7 +33,7 @@ test_collect_unicodes_format4 (void) hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf"); hb_set_t *codepoints = hb_set_create(); - hb_subset_collect_unicodes (face, codepoints); + hb_face_collect_unicodes (face, codepoints); hb_codepoint_t cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); @@ -54,7 +54,7 @@ test_collect_unicodes_format12 (void) hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf"); hb_set_t *codepoints = hb_set_create(); - hb_subset_collect_unicodes (face, codepoints); + hb_face_collect_unicodes (face, codepoints); hb_codepoint_t cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); @@ -75,7 +75,7 @@ test_collect_unicodes (void) hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf"); hb_set_t *codepoints = hb_set_create(); - hb_subset_collect_unicodes (face, codepoints); + hb_face_collect_unicodes (face, codepoints); hb_codepoint_t cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); diff --git a/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc b/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc index bcdafebdf..3d43627b3 100644 --- a/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc +++ b/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc @@ -13,7 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) hb_face_t *face = hb_face_create (blob, 0); hb_set_t *output = hb_set_create(); - hb_subset_collect_unicodes (face, output); + hb_face_collect_unicodes (face, output); hb_set_destroy (output); hb_face_destroy (face); From d950022c8ae3f85546272b38b187d6ed9f5ff16f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 23:06:37 -0700 Subject: [PATCH 25/47] Add hb-ot-face.cc/hh --- src/Makefile.sources | 2 + src/hb-ot-face.cc | 206 +++++++++++++++++++++++++++++++++++++++++++ src/hb-ot-face.hh | 144 ++++++++++++++++++++++++++++++ src/hb-ot-layout.cc | 172 ------------------------------------ src/hb-ot-layout.hh | 108 +---------------------- src/hb-ot-math.cc | 2 +- src/hb-ot-var.cc | 2 +- 7 files changed, 355 insertions(+), 281 deletions(-) create mode 100644 src/hb-ot-face.cc create mode 100644 src/hb-ot-face.hh diff --git a/src/Makefile.sources b/src/Makefile.sources index 32b49c952..0d975383c 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -98,6 +98,8 @@ HB_OT_sources = \ hb-aat-layout-trak-table.hh \ hb-aat-layout.hh \ hb-aat-ltag-table.hh \ + hb-ot-face.hh \ + hb-ot-face.cc \ hb-ot-font.cc \ hb-ot-layout.cc \ hb-ot-layout-base-table.hh \ diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc new file mode 100644 index 000000000..819a90008 --- /dev/null +++ b/src/hb-ot-face.cc @@ -0,0 +1,206 @@ +/* + * Copyright © 2018 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +#include "hb-ot-face.hh" + +#include "hb-ot-layout-gdef-table.hh" +#include "hb-ot-layout-gsub-table.hh" +#include "hb-ot-layout-gpos-table.hh" + + +static bool +_hb_ot_blacklist_gdef (unsigned int gdef_len, + unsigned int gsub_len, + unsigned int gpos_len) +{ + /* The ugly business of blacklisting individual fonts' tables happen here! + * See this thread for why we finally had to bend in and do this: + * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html + * + * In certain versions of Times New Roman Italic and Bold Italic, + * ASCII double quotation mark U+0022 has wrong glyph class 3 (mark) + * in GDEF. Many versions of Tahoma have bad GDEF tables that + * incorrectly classify some spacing marks such as certain IPA + * symbols as glyph class 3. So do older versions of Microsoft + * Himalaya, and the version of Cantarell shipped by Ubuntu 16.04. + * + * Nuke the GDEF tables of to avoid unwanted width-zeroing. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 + * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 + * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 + */ +#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) + switch ENCODE(gdef_len, gsub_len, gpos_len) + { + /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ + case ENCODE (442, 2874, 42038): + /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */ + case ENCODE (430, 2874, 40662): + /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */ + case ENCODE (442, 2874, 39116): + /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */ + case ENCODE (430, 2874, 39374): + /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */ + case ENCODE (490, 3046, 41638): + /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */ + case ENCODE (478, 3046, 41902): + /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */ + case ENCODE (898, 12554, 46470): + /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */ + case ENCODE (910, 12566, 47732): + /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */ + case ENCODE (928, 23298, 59332): + /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ + case ENCODE (940, 23310, 60732): + /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (964, 23836, 60072): + /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (976, 23832, 61456): + /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ + case ENCODE (994, 24474, 60336): + /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ + case ENCODE (1006, 24470, 61740): + /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (1006, 24576, 61346): + /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (1018, 24572, 62828): + /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ + case ENCODE (1006, 24576, 61352): + /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ + case ENCODE (1018, 24572, 62834): + /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ + case ENCODE (832, 7324, 47162): + /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ + case ENCODE (844, 7302, 45474): + /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ + case ENCODE (180, 13054, 7254): + /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ + case ENCODE (192, 12638, 7254): + /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ + case ENCODE (192, 12690, 7254): + /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */ + /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */ + case ENCODE (188, 248, 3852): + /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ + /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ + case ENCODE (188, 264, 3426): + /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ + case ENCODE (1058, 47032, 11818): + /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ + case ENCODE (1046, 47030, 12600): + /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ + case ENCODE (1058, 71796, 16770): + /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ + case ENCODE (1046, 71790, 17862): + /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ + case ENCODE (1046, 71788, 17112): + /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ + case ENCODE (1058, 71794, 17514): + /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ + case ENCODE (1330, 109904, 57938): + /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ + case ENCODE (1330, 109904, 58972): + /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf + * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ + case ENCODE (1004, 59092, 14836): + return true; +#undef ENCODE + } + return false; +} + + +void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) +{ + this->face = face; +#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_TABLE +} +void hb_ot_face_data_t::tables_t::fini (void) +{ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_TABLE +} + +hb_ot_face_data_t * +_hb_ot_face_data_create (hb_face_t *face) +{ + hb_ot_face_data_t *data = (hb_ot_face_data_t *) calloc (1, sizeof (hb_ot_face_data_t)); + if (unlikely (!data)) + return nullptr; + + data->table.init0 (face); + + const OT::GSUB &gsub = *data->table.GSUB; + const OT::GPOS &gpos = *data->table.GPOS; + + if (unlikely (_hb_ot_blacklist_gdef (data->table.GDEF.get_blob ()->length, + data->table.GSUB.get_blob ()->length, + data->table.GPOS.get_blob ()->length))) + data->table.GDEF.set_stored (hb_blob_get_empty ()); + + unsigned int gsub_lookup_count = data->gsub_lookup_count = gsub.get_lookup_count (); + unsigned int gpos_lookup_count = data->gpos_lookup_count = gpos.get_lookup_count (); + + data->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); + data->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); + + if (unlikely ((gsub_lookup_count && !data->gsub_accels) || + (gpos_lookup_count && !data->gpos_accels))) + { + _hb_ot_face_data_destroy (data); + return nullptr; + } + + for (unsigned int i = 0; i < gsub_lookup_count; i++) + data->gsub_accels[i].init (gsub.get_lookup (i)); + for (unsigned int i = 0; i < gpos_lookup_count; i++) + data->gpos_accels[i].init (gpos.get_lookup (i)); + + return data; +} + +void +_hb_ot_face_data_destroy (hb_ot_face_data_t *data) +{ + if (data->gsub_accels) + for (unsigned int i = 0; i < data->gsub_lookup_count; i++) + data->gsub_accels[i].fini (); + if (data->gpos_accels) + for (unsigned int i = 0; i < data->gpos_lookup_count; i++) + data->gpos_accels[i].fini (); + + free (data->gsub_accels); + free (data->gpos_accels); + + data->table.fini (); + + free (data); +} + diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh new file mode 100644 index 000000000..ade14f4a6 --- /dev/null +++ b/src/hb-ot-face.hh @@ -0,0 +1,144 @@ +/* + * Copyright © 2007,2008,2009 Red Hat, Inc. + * Copyright © 2012,2013 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_OT_FACE_HH +#define HB_OT_FACE_HH + +#include "hb.hh" + +#include "hb-machinery.hh" +#include "hb-set-digest.hh" + + +/* + * hb_ot_face_data_t + */ + +struct hb_ot_layout_lookup_accelerator_t +{ + template + inline void init (const TLookup &lookup) + { + digest.init (); + lookup.add_coverage (&digest); + } + + inline void fini (void) + { + } + + inline bool may_have (hb_codepoint_t g) const { + return digest.may_have (g); + } + + private: + hb_set_digest_t digest; +}; + +/* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. + * This is as good as any place. */ +#define HB_OT_LAYOUT_TABLES \ + /* OpenType shaping. */ \ + HB_OT_LAYOUT_TABLE(OT, GDEF) \ + HB_OT_LAYOUT_TABLE(OT, GSUB) \ + HB_OT_LAYOUT_TABLE(OT, GPOS) \ + HB_OT_LAYOUT_TABLE(OT, JSTF) \ + HB_OT_LAYOUT_TABLE(OT, BASE) \ + /* AAT shaping. */ \ + HB_OT_LAYOUT_TABLE(AAT, morx) \ + HB_OT_LAYOUT_TABLE(AAT, kerx) \ + HB_OT_LAYOUT_TABLE(AAT, ankr) \ + HB_OT_LAYOUT_TABLE(AAT, trak) \ + /* OpenType variations. */ \ + HB_OT_LAYOUT_TABLE(OT, fvar) \ + HB_OT_LAYOUT_TABLE(OT, avar) \ + HB_OT_LAYOUT_TABLE(OT, MVAR) \ + /* OpenType color. */ \ + HB_OT_LAYOUT_TABLE(OT, COLR) \ + HB_OT_LAYOUT_TABLE(OT, CPAL) \ + HB_OT_LAYOUT_TABLE(OT, CBDT) \ + HB_OT_LAYOUT_TABLE(OT, CBLC) \ + HB_OT_LAYOUT_TABLE(OT, sbix) \ + HB_OT_LAYOUT_TABLE(OT, svg) \ + /* OpenType math. */ \ + HB_OT_LAYOUT_TABLE(OT, MATH) \ + /* OpenType fundamentals. */ \ + HB_OT_LAYOUT_TABLE(OT, post) \ + /* */ + +/* Declare tables. */ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } +HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_TABLE + +struct hb_ot_face_data_t +{ + unsigned int gsub_lookup_count; + unsigned int gpos_lookup_count; + + hb_ot_layout_lookup_accelerator_t *gsub_accels; + hb_ot_layout_lookup_accelerator_t *gpos_accels; + + /* Various non-shaping tables. */ + struct tables_t + { + HB_INTERNAL void init0 (hb_face_t *face); + HB_INTERNAL void fini (void); + +#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ + HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) + enum order_t + { + ORDER_ZERO, +#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ + HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_TABLE + }; + + hb_face_t *face; /* MUST be JUST before the lazy loaders. */ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ + hb_table_lazy_loader_t Type; + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_TABLE + } table; +}; + + +HB_INTERNAL hb_ot_face_data_t * +_hb_ot_face_data_create (hb_face_t *face); + +HB_INTERNAL void +_hb_ot_face_data_destroy (hb_ot_face_data_t *data); + + +#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) + + + +#endif /* HB_OT_FACE_HH */ diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 1fe45438c..b9bb17fc8 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -47,178 +47,6 @@ #include "hb-ot-name-table.hh" -static bool -_hb_ot_blacklist_gdef (unsigned int gdef_len, - unsigned int gsub_len, - unsigned int gpos_len) -{ - /* The ugly business of blacklisting individual fonts' tables happen here! - * See this thread for why we finally had to bend in and do this: - * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html - * - * In certain versions of Times New Roman Italic and Bold Italic, - * ASCII double quotation mark U+0022 has wrong glyph class 3 (mark) - * in GDEF. Many versions of Tahoma have bad GDEF tables that - * incorrectly classify some spacing marks such as certain IPA - * symbols as glyph class 3. So do older versions of Microsoft - * Himalaya, and the version of Cantarell shipped by Ubuntu 16.04. - * - * Nuke the GDEF tables of to avoid unwanted width-zeroing. - * - * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 - * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 - * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 - */ -#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) - switch ENCODE(gdef_len, gsub_len, gpos_len) - { - /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ - case ENCODE (442, 2874, 42038): - /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */ - case ENCODE (430, 2874, 40662): - /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */ - case ENCODE (442, 2874, 39116): - /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */ - case ENCODE (430, 2874, 39374): - /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */ - case ENCODE (490, 3046, 41638): - /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */ - case ENCODE (478, 3046, 41902): - /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */ - case ENCODE (898, 12554, 46470): - /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */ - case ENCODE (910, 12566, 47732): - /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */ - case ENCODE (928, 23298, 59332): - /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ - case ENCODE (940, 23310, 60732): - /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (964, 23836, 60072): - /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (976, 23832, 61456): - /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ - case ENCODE (994, 24474, 60336): - /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ - case ENCODE (1006, 24470, 61740): - /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (1006, 24576, 61346): - /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (1018, 24572, 62828): - /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ - case ENCODE (1006, 24576, 61352): - /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ - case ENCODE (1018, 24572, 62834): - /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ - case ENCODE (832, 7324, 47162): - /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ - case ENCODE (844, 7302, 45474): - /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ - case ENCODE (180, 13054, 7254): - /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ - case ENCODE (192, 12638, 7254): - /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ - case ENCODE (192, 12690, 7254): - /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */ - /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */ - case ENCODE (188, 248, 3852): - /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ - /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ - case ENCODE (188, 264, 3426): - /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ - case ENCODE (1058, 47032, 11818): - /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ - case ENCODE (1046, 47030, 12600): - /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ - case ENCODE (1058, 71796, 16770): - /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ - case ENCODE (1046, 71790, 17862): - /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ - case ENCODE (1046, 71788, 17112): - /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ - case ENCODE (1058, 71794, 17514): - /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ - case ENCODE (1330, 109904, 57938): - /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ - case ENCODE (1330, 109904, 58972): - /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf - * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ - case ENCODE (1004, 59092, 14836): - return true; -#undef ENCODE - } - return false; -} - -void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) -{ - this->face = face; -#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE -} -void hb_ot_face_data_t::tables_t::fini (void) -{ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE -} - -hb_ot_face_data_t * -_hb_ot_face_data_create (hb_face_t *face) -{ - hb_ot_face_data_t *data = (hb_ot_face_data_t *) calloc (1, sizeof (hb_ot_face_data_t)); - if (unlikely (!data)) - return nullptr; - - data->table.init0 (face); - - const OT::GSUB &gsub = *data->table.GSUB; - const OT::GPOS &gpos = *data->table.GPOS; - - if (unlikely (_hb_ot_blacklist_gdef (data->table.GDEF.get_blob ()->length, - data->table.GSUB.get_blob ()->length, - data->table.GPOS.get_blob ()->length))) - data->table.GDEF.set_stored (hb_blob_get_empty ()); - - unsigned int gsub_lookup_count = data->gsub_lookup_count = gsub.get_lookup_count (); - unsigned int gpos_lookup_count = data->gpos_lookup_count = gpos.get_lookup_count (); - - data->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - data->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - - if (unlikely ((gsub_lookup_count && !data->gsub_accels) || - (gpos_lookup_count && !data->gpos_accels))) - { - _hb_ot_face_data_destroy (data); - return nullptr; - } - - for (unsigned int i = 0; i < gsub_lookup_count; i++) - data->gsub_accels[i].init (gsub.get_lookup (i)); - for (unsigned int i = 0; i < gpos_lookup_count; i++) - data->gpos_accels[i].init (gpos.get_lookup (i)); - - return data; -} - -void -_hb_ot_face_data_destroy (hb_ot_face_data_t *data) -{ - if (data->gsub_accels) - for (unsigned int i = 0; i < data->gsub_lookup_count; i++) - data->gsub_accels[i].fini (); - if (data->gpos_accels) - for (unsigned int i = 0; i < data->gpos_lookup_count; i++) - data->gpos_accels[i].fini (); - - free (data->gsub_accels); - free (data->gpos_accels); - - data->table.fini (); - - free (data); -} - // static inline const OT::BASE& // _get_base (hb_face_t *face) // { diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 9c705b7d2..2790aecbf 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -33,8 +33,8 @@ #include "hb-font.hh" #include "hb-buffer.hh" -#include "hb-set-digest.hh" #include "hb-open-type.hh" +#include "hb-ot-face.hh" /* Private API corresponding to hb-ot-layout.h: */ @@ -116,112 +116,6 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer); - -/* - * hb_ot_face_data_t - */ - -struct hb_ot_layout_lookup_accelerator_t -{ - template - inline void init (const TLookup &lookup) - { - digest.init (); - lookup.add_coverage (&digest); - } - - inline void fini (void) - { - } - - inline bool may_have (hb_codepoint_t g) const { - return digest.may_have (g); - } - - private: - hb_set_digest_t digest; -}; - -/* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. - * This is as good as any place. */ -#define HB_OT_LAYOUT_TABLES \ - /* OpenType shaping. */ \ - HB_OT_LAYOUT_TABLE(OT, GDEF) \ - HB_OT_LAYOUT_TABLE(OT, GSUB) \ - HB_OT_LAYOUT_TABLE(OT, GPOS) \ - HB_OT_LAYOUT_TABLE(OT, JSTF) \ - HB_OT_LAYOUT_TABLE(OT, BASE) \ - /* AAT shaping. */ \ - HB_OT_LAYOUT_TABLE(AAT, morx) \ - HB_OT_LAYOUT_TABLE(AAT, kerx) \ - HB_OT_LAYOUT_TABLE(AAT, ankr) \ - HB_OT_LAYOUT_TABLE(AAT, trak) \ - /* OpenType variations. */ \ - HB_OT_LAYOUT_TABLE(OT, fvar) \ - HB_OT_LAYOUT_TABLE(OT, avar) \ - HB_OT_LAYOUT_TABLE(OT, MVAR) \ - /* OpenType color. */ \ - HB_OT_LAYOUT_TABLE(OT, COLR) \ - HB_OT_LAYOUT_TABLE(OT, CPAL) \ - HB_OT_LAYOUT_TABLE(OT, CBDT) \ - HB_OT_LAYOUT_TABLE(OT, CBLC) \ - HB_OT_LAYOUT_TABLE(OT, sbix) \ - HB_OT_LAYOUT_TABLE(OT, svg) \ - /* OpenType math. */ \ - HB_OT_LAYOUT_TABLE(OT, MATH) \ - /* OpenType fundamentals. */ \ - HB_OT_LAYOUT_TABLE(OT, post) \ - /* */ - -/* Declare tables. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } -HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE - -struct hb_ot_face_data_t -{ - unsigned int gsub_lookup_count; - unsigned int gpos_lookup_count; - - hb_ot_layout_lookup_accelerator_t *gsub_accels; - hb_ot_layout_lookup_accelerator_t *gpos_accels; - - /* Various non-shaping tables. */ - struct tables_t - { - HB_INTERNAL void init0 (hb_face_t *face); - HB_INTERNAL void fini (void); - -#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ - HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) - enum order_t - { - ORDER_ZERO, -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE - }; - - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - hb_table_lazy_loader_t Type; - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE - } table; -}; - - -HB_INTERNAL hb_ot_face_data_t * -_hb_ot_face_data_create (hb_face_t *face); - -HB_INTERNAL void -_hb_ot_face_data_destroy (hb_ot_face_data_t *data); - - -#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) - - /* * Buffer var routines. */ diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 48adf8acc..645c3d62e 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -26,7 +26,7 @@ #include "hb-open-type.hh" -#include "hb-ot-layout.hh" +#include "hb-ot-face.hh" #include "hb-ot-math-table.hh" static inline const OT::MATH& diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index 5d49ac149..a2f2d3e51 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -26,7 +26,7 @@ #include "hb-open-type.hh" -#include "hb-ot-layout.hh" +#include "hb-ot-face.hh" #include "hb-ot-var-avar-table.hh" #include "hb-ot-var-fvar-table.hh" #include "hb-ot-var-mvar-table.hh" From 62fc54725a3863473829f3a3748c9336e4dc0787 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 23:15:52 -0700 Subject: [PATCH 26/47] [ot-font] Fallback vertical advance to UPEM Used to be ascent+descent. Whatever. This is more convenient for upcoming changes. --- src/hb-ot-font.cc | 2 +- test/shaping/data/in-house/tests/vertical.tests | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index f6e69d9e2..6e6415a7a 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -46,7 +46,7 @@ struct hb_ot_font_t { cmap.init (face); h_metrics.init (face); - v_metrics.init (face, h_metrics.ascender - h_metrics.descender); /* TODO Can we do this lazily? */ + v_metrics.init (face); this->face = face; glyf.init (); diff --git a/test/shaping/data/in-house/tests/vertical.tests b/test/shaping/data/in-house/tests/vertical.tests index 17df28e6a..a16a7a002 100644 --- a/test/shaping/data/in-house/tests/vertical.tests +++ b/test/shaping/data/in-house/tests/vertical.tests @@ -1,3 +1,3 @@ ../fonts/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t --font-funcs=ft:U+300C:[uni300C.vert=0@-512,-578+0,-1024] ../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ft:U+0041,U+0042:[gid1=0@-654,-2128+0,-2789|gid2=1@-665,-2125+0,-2789] -../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-2189+0,-2789|gid2=1@-665,-2189+0,-2789] +../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-2189+0,-2048|gid2=1@-665,-2189+0,-2048] From f36ae6f8a82485bbf727f24dfd7da8f32002cad6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 23:19:34 -0700 Subject: [PATCH 27/47] [ot-font] Make everything (cmap/metrics) lazy --- src/hb-machinery.hh | 5 +++++ src/hb-ot-font.cc | 51 +++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 56ecff851..293b64a30 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -763,6 +763,10 @@ struct hb_lazy_loader_t : hb_data_wrapper_t } return p; } + inline Stored * get_stored_relaxed (void) const + { + return this->instance.get_relaxed (); + } inline void set_stored (Stored *instance_) { @@ -776,6 +780,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t } inline const Returned * get (void) const { return Funcs::convert (get_stored ()); } + inline const Returned * get_relaxed (void) const { return Funcs::convert (get_stored_relaxed ()); } inline Returned * get_unconst (void) const { return const_cast (Funcs::convert (get_stored ())); } /* To be possibly overloaded by subclasses. */ diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 6e6415a7a..19149ca50 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -44,11 +44,10 @@ struct hb_ot_font_t { inline void init (hb_face_t *face) { - cmap.init (face); - h_metrics.init (face); - v_metrics.init (face); - this->face = face; + cmap.init (); + h_metrics.init (); + v_metrics.init (); glyf.init (); cbdt.init (); post.init (); @@ -59,22 +58,20 @@ struct hb_ot_font_t cmap.fini (); h_metrics.fini (); v_metrics.fini (); - glyf.fini (); cbdt.fini (); post.fini (); kern.fini (); } - OT::cmap::accelerator_t cmap; - OT::hmtx::accelerator_t h_metrics; - OT::vmtx::accelerator_t v_metrics; - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ - hb_face_lazy_loader_t<1, OT::glyf::accelerator_t> glyf; - hb_face_lazy_loader_t<2, OT::CBDT::accelerator_t> cbdt; - hb_face_lazy_loader_t<3, OT::post::accelerator_t> post; - hb_face_lazy_loader_t<4, OT::kern::accelerator_t> kern; + hb_face_lazy_loader_t<1, OT::cmap::accelerator_t> cmap; + hb_face_lazy_loader_t<2, OT::hmtx::accelerator_t> h_metrics; + hb_face_lazy_loader_t<3, OT::vmtx::accelerator_t> v_metrics; + hb_face_lazy_loader_t<4, OT::glyf::accelerator_t> glyf; + hb_face_lazy_loader_t<5, OT::CBDT::accelerator_t> cbdt; + hb_face_lazy_loader_t<6, OT::post::accelerator_t> post; + hb_face_lazy_loader_t<7, OT::kern::accelerator_t> kern; }; @@ -111,7 +108,7 @@ hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return ot_font->cmap.get_nominal_glyph (unicode, glyph); + return ot_font->cmap.get_relaxed()->get_nominal_glyph (unicode, glyph); } static hb_bool_t @@ -123,7 +120,7 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph); + return ot_font->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph); } static hb_position_t @@ -133,7 +130,7 @@ hb_ot_get_glyph_h_advance (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return font->em_scale_x (ot_font->h_metrics.get_advance (glyph, font)); + return font->em_scale_x (ot_font->h_metrics.get_relaxed ()->get_advance (glyph, font)); } static hb_position_t @@ -143,7 +140,7 @@ hb_ot_get_glyph_v_advance (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph, font)); + return font->em_scale_y (-(int) ot_font->v_metrics.get_relaxed ()->get_advance (glyph, font)); } static hb_position_t @@ -205,11 +202,11 @@ hb_ot_get_font_h_extents (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender); - metrics->descender = font->em_scale_y (ot_font->h_metrics.descender); - metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap); + metrics->ascender = font->em_scale_y (ot_font->h_metrics.get_relaxed ()->ascender); + metrics->descender = font->em_scale_y (ot_font->h_metrics.get_relaxed ()->descender); + metrics->line_gap = font->em_scale_y (ot_font->h_metrics.get_relaxed ()->line_gap); // TODO Hook up variations. - return ot_font->h_metrics.has_font_extents; + return ot_font->h_metrics.get_relaxed ()->has_font_extents; } static hb_bool_t @@ -219,11 +216,11 @@ hb_ot_get_font_v_extents (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender); - metrics->descender = font->em_scale_x (ot_font->v_metrics.descender); - metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap); + metrics->ascender = font->em_scale_x (ot_font->v_metrics.get_relaxed ()->ascender); + metrics->descender = font->em_scale_x (ot_font->v_metrics.get_relaxed ()->descender); + metrics->line_gap = font->em_scale_x (ot_font->v_metrics.get_relaxed ()->line_gap); // TODO Hook up variations. - return ot_font->v_metrics.has_font_extents; + return ot_font->v_metrics.get_relaxed ()->has_font_extents; } #ifdef HB_USE_ATEXIT @@ -288,6 +285,10 @@ hb_ot_font_set_funcs (hb_font_t *font) if (unlikely (!ot_font)) return; + ot_font->cmap.get (); + ot_font->h_metrics.get (); + ot_font->v_metrics.get (); + hb_font_set_funcs (font, _hb_ot_get_font_funcs (), ot_font, From 71f8893eff56bff651e3df6288becc68ecea6cd1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 23:27:45 -0700 Subject: [PATCH 28/47] [ot-font] Use init0 --- src/hb-ot-font.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 19149ca50..1ec6423ec 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -42,16 +42,16 @@ struct hb_ot_font_t { - inline void init (hb_face_t *face) + inline void init0 (hb_face_t *face) { this->face = face; - cmap.init (); - h_metrics.init (); - v_metrics.init (); - glyf.init (); - cbdt.init (); - post.init (); - kern.init (); + cmap.init0 (); + h_metrics.init0 (); + v_metrics.init0 (); + glyf.init0 (); + cbdt.init0 (); + post.init0 (); + kern.init0 (); } inline void fini (void) { @@ -83,7 +83,7 @@ _hb_ot_font_create (hb_face_t *face) if (unlikely (!ot_font)) return nullptr; - ot_font->init (face); + ot_font->init0 (face); return ot_font; } From 1c48a7ef06b82ef9ca013066d1fb3c6fda82aa0c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 23:54:06 -0700 Subject: [PATCH 29/47] [ot-font] Cache tables on face, not font --- src/hb-ot-cmap-table.hh | 1 + src/hb-ot-face.cc | 2 + src/hb-ot-face.hh | 55 ++++++++++++++++++++++---- src/hb-ot-font.cc | 75 +++--------------------------------- src/hb-ot-layout-gsubgpos.hh | 1 + src/hb-ot-layout.hh | 1 - 6 files changed, 58 insertions(+), 77 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index dce298138..6ff23e3d3 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1017,6 +1017,7 @@ struct cmap { inline void init (hb_face_t *face) { + /* TODO Switch to using table from face->ot.table. */ this->blob = hb_sanitize_context_t().reference_table (face); const cmap *table = this->blob->as (); const CmapSubtableFormat14 *subtable_uvs = nullptr; diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index 819a90008..121037f83 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -156,6 +156,7 @@ _hb_ot_face_data_create (hb_face_t *face) return nullptr; data->table.init0 (face); + data->accel.init0 (face); const OT::GSUB &gsub = *data->table.GSUB; const OT::GPOS &gpos = *data->table.GPOS; @@ -199,6 +200,7 @@ _hb_ot_face_data_destroy (hb_ot_face_data_t *data) free (data->gsub_accels); free (data->gpos_accels); + data->accel.fini (); data->table.fini (); free (data); diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index ade14f4a6..25d830d10 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -34,6 +34,13 @@ #include "hb-machinery.hh" #include "hb-set-digest.hh" +#include "hb-ot-cmap-table.hh" +#include "hb-ot-glyf-table.hh" +#include "hb-ot-hmtx-table.hh" +#include "hb-ot-kern-table.hh" +#include "hb-ot-post-table.hh" +#include "hb-ot-color-cbdt-table.hh" + /* * hb_ot_face_data_t @@ -98,13 +105,7 @@ HB_OT_LAYOUT_TABLES struct hb_ot_face_data_t { - unsigned int gsub_lookup_count; - unsigned int gpos_lookup_count; - - hb_ot_layout_lookup_accelerator_t *gsub_accels; - hb_ot_layout_lookup_accelerator_t *gpos_accels; - - /* Various non-shaping tables. */ + /* All the president's tables. */ struct tables_t { HB_INTERNAL void init0 (hb_face_t *face); @@ -127,6 +128,46 @@ struct hb_ot_face_data_t HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_TABLE } table; + + struct accelerator_t + { + inline void init0 (hb_face_t *face) + { + this->face = face; + cmap.init0 (); + h_metrics.init0 (); + v_metrics.init0 (); + glyf.init0 (); + cbdt.init0 (); + post.init0 (); + kern.init0 (); + } + inline void fini (void) + { + cmap.fini (); + h_metrics.fini (); + v_metrics.fini (); + glyf.fini (); + cbdt.fini (); + post.fini (); + kern.fini (); + } + + hb_face_t *face; /* MUST be JUST before the lazy loaders. */ + hb_face_lazy_loader_t<1, OT::cmap::accelerator_t> cmap; + hb_face_lazy_loader_t<2, OT::hmtx::accelerator_t> h_metrics; + hb_face_lazy_loader_t<3, OT::vmtx::accelerator_t> v_metrics; + hb_face_lazy_loader_t<4, OT::glyf::accelerator_t> glyf; + hb_face_lazy_loader_t<5, OT::CBDT::accelerator_t> cbdt; + hb_face_lazy_loader_t<6, OT::post::accelerator_t> post; + hb_face_lazy_loader_t<7, OT::kern::accelerator_t> kern; + } accel; + + /* More accelerators. Merge into previous. */ + unsigned int gsub_lookup_count; + unsigned int gpos_lookup_count; + hb_ot_layout_lookup_accelerator_t *gsub_accels; + hb_ot_layout_lookup_accelerator_t *gpos_accels; }; diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 1ec6423ec..60af5fb19 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -30,73 +30,10 @@ #include "hb-font.hh" #include "hb-machinery.hh" - -#include "hb-ot-cmap-table.hh" -#include "hb-ot-glyf-table.hh" -#include "hb-ot-hmtx-table.hh" -#include "hb-ot-kern-table.hh" -#include "hb-ot-post-table.hh" - -#include "hb-ot-color-cbdt-table.hh" +#include "hb-ot-face.hh" -struct hb_ot_font_t -{ - inline void init0 (hb_face_t *face) - { - this->face = face; - cmap.init0 (); - h_metrics.init0 (); - v_metrics.init0 (); - glyf.init0 (); - cbdt.init0 (); - post.init0 (); - kern.init0 (); - } - inline void fini (void) - { - cmap.fini (); - h_metrics.fini (); - v_metrics.fini (); - glyf.fini (); - cbdt.fini (); - post.fini (); - kern.fini (); - } - - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ - hb_face_lazy_loader_t<1, OT::cmap::accelerator_t> cmap; - hb_face_lazy_loader_t<2, OT::hmtx::accelerator_t> h_metrics; - hb_face_lazy_loader_t<3, OT::vmtx::accelerator_t> v_metrics; - hb_face_lazy_loader_t<4, OT::glyf::accelerator_t> glyf; - hb_face_lazy_loader_t<5, OT::CBDT::accelerator_t> cbdt; - hb_face_lazy_loader_t<6, OT::post::accelerator_t> post; - hb_face_lazy_loader_t<7, OT::kern::accelerator_t> kern; -}; - - -static hb_ot_font_t * -_hb_ot_font_create (hb_face_t *face) -{ - hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t)); - - if (unlikely (!ot_font)) - return nullptr; - - ot_font->init0 (face); - - return ot_font; -} - -static void -_hb_ot_font_destroy (void *data) -{ - hb_ot_font_t *ot_font = (hb_ot_font_t *) data; - - ot_font->fini (); - - free (ot_font); -} +typedef hb_ot_face_data_t::accelerator_t hb_ot_font_t; static hb_bool_t @@ -281,10 +218,10 @@ _hb_ot_get_font_funcs (void) void hb_ot_font_set_funcs (hb_font_t *font) { - hb_ot_font_t *ot_font = _hb_ot_font_create (font->face); - if (unlikely (!ot_font)) - return; + if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return; + hb_ot_font_t *ot_font = &hb_ot_face_data (font->face)->accel; + /* Load them lazies. We access them with get_relaxed() for performance. */ ot_font->cmap.get (); ot_font->h_metrics.get (); ot_font->v_metrics.get (); @@ -292,5 +229,5 @@ hb_ot_font_set_funcs (hb_font_t *font) hb_font_set_funcs (font, _hb_ot_get_font_funcs (), ot_font, - _hb_ot_font_destroy); + nullptr); } diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 76a7e2532..d21c3dea0 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -32,6 +32,7 @@ #include "hb.hh" #include "hb-buffer.hh" #include "hb-map.hh" +#include "hb-ot-face.hh" #include "hb-ot-layout-gdef-table.hh" #include "hb-set.hh" diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 2790aecbf..fcc0998f5 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -34,7 +34,6 @@ #include "hb-font.hh" #include "hb-buffer.hh" #include "hb-open-type.hh" -#include "hb-ot-face.hh" /* Private API corresponding to hb-ot-layout.h: */ From 59bca0d2cb6010bc237afb2255ccda3b8dd0585d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 00:06:12 -0700 Subject: [PATCH 30/47] [ot-font] Rename --- src/hb-ot-face.hh | 12 ++++++------ src/hb-ot-font.cc | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 25d830d10..29ec6a73c 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -135,8 +135,8 @@ struct hb_ot_face_data_t { this->face = face; cmap.init0 (); - h_metrics.init0 (); - v_metrics.init0 (); + hmtx.init0 (); + vmtx.init0 (); glyf.init0 (); cbdt.init0 (); post.init0 (); @@ -145,8 +145,8 @@ struct hb_ot_face_data_t inline void fini (void) { cmap.fini (); - h_metrics.fini (); - v_metrics.fini (); + hmtx.fini (); + vmtx.fini (); glyf.fini (); cbdt.fini (); post.fini (); @@ -155,8 +155,8 @@ struct hb_ot_face_data_t hb_face_t *face; /* MUST be JUST before the lazy loaders. */ hb_face_lazy_loader_t<1, OT::cmap::accelerator_t> cmap; - hb_face_lazy_loader_t<2, OT::hmtx::accelerator_t> h_metrics; - hb_face_lazy_loader_t<3, OT::vmtx::accelerator_t> v_metrics; + hb_face_lazy_loader_t<2, OT::hmtx::accelerator_t> hmtx; + hb_face_lazy_loader_t<3, OT::vmtx::accelerator_t> vmtx; hb_face_lazy_loader_t<4, OT::glyf::accelerator_t> glyf; hb_face_lazy_loader_t<5, OT::CBDT::accelerator_t> cbdt; hb_face_lazy_loader_t<6, OT::post::accelerator_t> post; diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 60af5fb19..618311534 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -67,7 +67,7 @@ hb_ot_get_glyph_h_advance (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return font->em_scale_x (ot_font->h_metrics.get_relaxed ()->get_advance (glyph, font)); + return font->em_scale_x (ot_font->hmtx.get_relaxed ()->get_advance (glyph, font)); } static hb_position_t @@ -77,7 +77,7 @@ hb_ot_get_glyph_v_advance (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return font->em_scale_y (-(int) ot_font->v_metrics.get_relaxed ()->get_advance (glyph, font)); + return font->em_scale_y (-(int) ot_font->vmtx.get_relaxed ()->get_advance (glyph, font)); } static hb_position_t @@ -139,11 +139,11 @@ hb_ot_get_font_h_extents (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - metrics->ascender = font->em_scale_y (ot_font->h_metrics.get_relaxed ()->ascender); - metrics->descender = font->em_scale_y (ot_font->h_metrics.get_relaxed ()->descender); - metrics->line_gap = font->em_scale_y (ot_font->h_metrics.get_relaxed ()->line_gap); + metrics->ascender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->ascender); + metrics->descender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->descender); + metrics->line_gap = font->em_scale_y (ot_font->hmtx.get_relaxed ()->line_gap); // TODO Hook up variations. - return ot_font->h_metrics.get_relaxed ()->has_font_extents; + return ot_font->hmtx.get_relaxed ()->has_font_extents; } static hb_bool_t @@ -153,11 +153,11 @@ hb_ot_get_font_v_extents (hb_font_t *font, void *user_data HB_UNUSED) { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - metrics->ascender = font->em_scale_x (ot_font->v_metrics.get_relaxed ()->ascender); - metrics->descender = font->em_scale_x (ot_font->v_metrics.get_relaxed ()->descender); - metrics->line_gap = font->em_scale_x (ot_font->v_metrics.get_relaxed ()->line_gap); + metrics->ascender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->ascender); + metrics->descender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->descender); + metrics->line_gap = font->em_scale_x (ot_font->vmtx.get_relaxed ()->line_gap); // TODO Hook up variations. - return ot_font->v_metrics.get_relaxed ()->has_font_extents; + return ot_font->vmtx.get_relaxed ()->has_font_extents; } #ifdef HB_USE_ATEXIT @@ -223,8 +223,8 @@ hb_ot_font_set_funcs (hb_font_t *font) /* Load them lazies. We access them with get_relaxed() for performance. */ ot_font->cmap.get (); - ot_font->h_metrics.get (); - ot_font->v_metrics.get (); + ot_font->hmtx.get (); + ot_font->vmtx.get (); hb_font_set_funcs (font, _hb_ot_get_font_funcs (), From 7f8b6fe67d64b41786edbf8650efb1c0deba573f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 00:07:12 -0700 Subject: [PATCH 31/47] Minor --- src/hb-ot-face.hh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 29ec6a73c..3bda84d6a 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -95,7 +95,6 @@ struct hb_ot_layout_lookup_accelerator_t /* OpenType math. */ \ HB_OT_LAYOUT_TABLE(OT, MATH) \ /* OpenType fundamentals. */ \ - HB_OT_LAYOUT_TABLE(OT, post) \ /* */ /* Declare tables. */ From e6cb9380651c753485f721bd3df523d03be41d91 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 00:21:29 -0700 Subject: [PATCH 32/47] [ot-face] Unify accelerators and tables --- src/hb-machinery.hh | 4 +-- src/hb-ot-cmap-table.hh | 3 ++- src/hb-ot-face.cc | 6 +++-- src/hb-ot-face.hh | 58 +++++++++++------------------------------ src/hb-ot-font.cc | 6 ++--- 5 files changed, 26 insertions(+), 51 deletions(-) diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 293b64a30..35a8b6c15 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -815,9 +815,9 @@ struct hb_lazy_loader_t : hb_data_wrapper_t /* Specializations. */ -template +template struct hb_face_lazy_loader_t : hb_lazy_loader_t, + hb_face_lazy_loader_t, hb_face_t, WheresFace> {}; template diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 6ff23e3d3..cdf67f1e4 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -843,7 +843,8 @@ struct cmap { static const hb_tag_t tableTag = HB_OT_TAG_cmap; - struct subset_plan { + struct subset_plan + { subset_plan(void) { format4_segments.init(); diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index 121037f83..7b97ce51d 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -138,13 +138,17 @@ void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) { this->face = face; #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE } void hb_ot_face_data_t::tables_t::fini (void) { #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE } @@ -156,7 +160,6 @@ _hb_ot_face_data_create (hb_face_t *face) return nullptr; data->table.init0 (face); - data->accel.init0 (face); const OT::GSUB &gsub = *data->table.GSUB; const OT::GPOS &gpos = *data->table.GPOS; @@ -200,7 +203,6 @@ _hb_ot_face_data_destroy (hb_ot_face_data_t *data) free (data->gsub_accels); free (data->gpos_accels); - data->accel.fini (); data->table.fini (); free (data); diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 3bda84d6a..bbbc6e2c5 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -85,21 +85,23 @@ struct hb_ot_layout_lookup_accelerator_t HB_OT_LAYOUT_TABLE(OT, fvar) \ HB_OT_LAYOUT_TABLE(OT, avar) \ HB_OT_LAYOUT_TABLE(OT, MVAR) \ - /* OpenType color. */ \ - HB_OT_LAYOUT_TABLE(OT, COLR) \ - HB_OT_LAYOUT_TABLE(OT, CPAL) \ - HB_OT_LAYOUT_TABLE(OT, CBDT) \ - HB_OT_LAYOUT_TABLE(OT, CBLC) \ - HB_OT_LAYOUT_TABLE(OT, sbix) \ - HB_OT_LAYOUT_TABLE(OT, svg) \ /* OpenType math. */ \ HB_OT_LAYOUT_TABLE(OT, MATH) \ /* OpenType fundamentals. */ \ + HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \ + HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \ + HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \ + HB_OT_LAYOUT_ACCELERATOR(OT, post) \ + HB_OT_LAYOUT_ACCELERATOR(OT, kern) \ + HB_OT_LAYOUT_ACCELERATOR(OT, glyf) \ + HB_OT_LAYOUT_ACCELERATOR(OT, CBDT) \ /* */ /* Declare tables. */ #define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE struct hb_ot_face_data_t @@ -115,53 +117,23 @@ struct hb_ot_face_data_t enum order_t { ORDER_ZERO, -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), +#define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE }; hb_face_t *face; /* MUST be JUST before the lazy loaders. */ #define HB_OT_LAYOUT_TABLE(Namespace, Type) \ hb_table_lazy_loader_t Type; +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ + hb_face_lazy_loader_t Type; HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE } table; - struct accelerator_t - { - inline void init0 (hb_face_t *face) - { - this->face = face; - cmap.init0 (); - hmtx.init0 (); - vmtx.init0 (); - glyf.init0 (); - cbdt.init0 (); - post.init0 (); - kern.init0 (); - } - inline void fini (void) - { - cmap.fini (); - hmtx.fini (); - vmtx.fini (); - glyf.fini (); - cbdt.fini (); - post.fini (); - kern.fini (); - } - - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ - hb_face_lazy_loader_t<1, OT::cmap::accelerator_t> cmap; - hb_face_lazy_loader_t<2, OT::hmtx::accelerator_t> hmtx; - hb_face_lazy_loader_t<3, OT::vmtx::accelerator_t> vmtx; - hb_face_lazy_loader_t<4, OT::glyf::accelerator_t> glyf; - hb_face_lazy_loader_t<5, OT::CBDT::accelerator_t> cbdt; - hb_face_lazy_loader_t<6, OT::post::accelerator_t> post; - hb_face_lazy_loader_t<7, OT::kern::accelerator_t> kern; - } accel; - /* More accelerators. Merge into previous. */ unsigned int gsub_lookup_count; unsigned int gpos_lookup_count; diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 618311534..c96cba41d 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -33,7 +33,7 @@ #include "hb-ot-face.hh" -typedef hb_ot_face_data_t::accelerator_t hb_ot_font_t; +typedef hb_ot_face_data_t::tables_t hb_ot_font_t; static hb_bool_t @@ -101,7 +101,7 @@ hb_ot_get_glyph_extents (hb_font_t *font, const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; bool ret = ot_font->glyf->get_extents (glyph, extents); if (!ret) - ret = ot_font->cbdt->get_extents (glyph, extents); + ret = ot_font->CBDT->get_extents (glyph, extents); // TODO Hook up side-bearings variations. extents->x_bearing = font->em_scale_x (extents->x_bearing); extents->y_bearing = font->em_scale_y (extents->y_bearing); @@ -219,7 +219,7 @@ void hb_ot_font_set_funcs (hb_font_t *font) { if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return; - hb_ot_font_t *ot_font = &hb_ot_face_data (font->face)->accel; + hb_ot_font_t *ot_font = &hb_ot_face_data (font->face)->table; /* Load them lazies. We access them with get_relaxed() for performance. */ ot_font->cmap.get (); From 963413fc5454d92621ae83a8d9c9324e404b8166 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 00:47:55 -0700 Subject: [PATCH 33/47] WIP --- src/hb-ot-cmap-table.hh | 1 - src/hb-ot-face.hh | 22 ---------------------- src/hb-ot-layout-gpos-table.hh | 2 ++ src/hb-ot-layout-gsub-table.hh | 2 ++ src/hb-ot-layout-gsubgpos.hh | 31 ++++++++++++++++++++++++++++++- src/hb-ot-layout.hh | 18 +++++++++++++++++- 6 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index cdf67f1e4..c357714e2 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1018,7 +1018,6 @@ struct cmap { inline void init (hb_face_t *face) { - /* TODO Switch to using table from face->ot.table. */ this->blob = hb_sanitize_context_t().reference_table (face); const cmap *table = this->blob->as (); const CmapSubtableFormat14 *subtable_uvs = nullptr; diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index bbbc6e2c5..1466f11be 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -32,7 +32,6 @@ #include "hb.hh" #include "hb-machinery.hh" -#include "hb-set-digest.hh" #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" @@ -46,27 +45,6 @@ * hb_ot_face_data_t */ -struct hb_ot_layout_lookup_accelerator_t -{ - template - inline void init (const TLookup &lookup) - { - digest.init (); - lookup.add_coverage (&digest); - } - - inline void fini (void) - { - } - - inline bool may_have (hb_codepoint_t g) const { - return digest.may_have (g); - } - - private: - hb_set_digest_t digest; -}; - /* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. * This is as good as any place. */ #define HB_OT_LAYOUT_TABLES \ diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 66767dfda..e1a405063 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1522,6 +1522,8 @@ struct GPOS : GSUBGPOS const OffsetTo &list = CastR > (lookupList); return_trace (list.sanitize (c, this)); } + + typedef GSUBGPOS::accelerator_t accelerator_t; }; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index d2c1fb9a1..59e8a43f2 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1317,6 +1317,8 @@ struct GSUB : GSUBGPOS const OffsetTo &list = CastR > (lookupList); return_trace (list.sanitize (c, this)); } + + typedef GSUBGPOS::accelerator_t accelerator_t; }; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index d21c3dea0..44b595ae1 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -988,7 +988,6 @@ struct LookupRecord DEFINE_SIZE_STATIC (4); }; - template static inline void recurse_lookups (context_t *c, unsigned int lookupCount, @@ -2382,6 +2381,36 @@ struct GSUBGPOS (version.to_int () < 0x00010001u || featureVars.sanitize (c, this))); } + template + struct accelerator_t + { + inline void init (hb_face_t *face) + { + this->blob = hb_sanitize_context_t().reference_table (face); + const T &table = *this->blob->as (); + + this->lookup_count = table.get_lookup_count (); + + this->accels = (hb_ot_layout_lookup_accelerator_t *) calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); + if (unlikely (!this->accels)) + this->lookup_count = 0; + + for (unsigned int i = 0; i < this->lookup_count; i++) + this->accels[i].init (table.get_lookup (i)); + } + + inline void fini (void) + { + hb_blob_destroy (this->blob); + free (accels); + } + + private: + hb_blob_t *blob; + unsigned int lookup_count; + hb_ot_layout_lookup_accelerator_t *accels; + }; + protected: FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set * to 0x00010000u */ diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index fcc0998f5..02c8c7b27 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -34,6 +34,7 @@ #include "hb-font.hh" #include "hb-buffer.hh" #include "hb-open-type.hh" +#include "hb-set-digest.hh" /* Private API corresponding to hb-ot-layout.h: */ @@ -86,7 +87,22 @@ hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer); -struct hb_ot_layout_lookup_accelerator_t; +struct hb_ot_layout_lookup_accelerator_t +{ + template + inline void init (const TLookup &lookup) + { + digest.init (); + lookup.add_coverage (&digest); + } + inline void fini (void) {} + + inline bool may_have (hb_codepoint_t g) const + { return digest.may_have (g); } + + private: + hb_set_digest_t digest; +}; namespace OT { struct hb_ot_apply_context_t; From b929100f8782816c2621715f6c007ecefc419d83 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 01:15:47 -0700 Subject: [PATCH 34/47] [ot-face] Unify GSUB/GPOS accelerators in the table accelerator framework --- src/hb-aat-layout.cc | 4 +--- src/hb-ot-face.cc | 40 ++-------------------------------- src/hb-ot-face.hh | 25 ++++++++++----------- src/hb-ot-layout-gpos-table.hh | 2 +- src/hb-ot-layout-gsub-table.hh | 6 ++--- src/hb-ot-layout-gsubgpos.hh | 24 ++++++++++---------- src/hb-ot-layout.cc | 33 ++++++++++++++-------------- src/hb-ot-layout.hh | 17 +++++++++++++++ src/hb-ot-shape.cc | 1 + 9 files changed, 66 insertions(+), 86 deletions(-) diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 24ec53bc8..c481e6a88 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -26,9 +26,7 @@ #include "hb-open-type.hh" -#include "hb-ot-layout.hh" -#include "hb-ot-layout-gsubgpos.hh" - +#include "hb-ot-face.hh" #include "hb-aat-layout.hh" #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index 7b97ce51d..52411d5ca 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -26,10 +26,6 @@ #include "hb-ot-face.hh" -#include "hb-ot-layout-gdef-table.hh" -#include "hb-ot-layout-gsub-table.hh" -#include "hb-ot-layout-gpos-table.hh" - static bool _hb_ot_blacklist_gdef (unsigned int gdef_len, @@ -161,50 +157,18 @@ _hb_ot_face_data_create (hb_face_t *face) data->table.init0 (face); - const OT::GSUB &gsub = *data->table.GSUB; - const OT::GPOS &gpos = *data->table.GPOS; - if (unlikely (_hb_ot_blacklist_gdef (data->table.GDEF.get_blob ()->length, - data->table.GSUB.get_blob ()->length, - data->table.GPOS.get_blob ()->length))) + data->table.GSUB->blob->length, + data->table.GPOS->blob->length))) data->table.GDEF.set_stored (hb_blob_get_empty ()); - unsigned int gsub_lookup_count = data->gsub_lookup_count = gsub.get_lookup_count (); - unsigned int gpos_lookup_count = data->gpos_lookup_count = gpos.get_lookup_count (); - - data->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - data->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - - if (unlikely ((gsub_lookup_count && !data->gsub_accels) || - (gpos_lookup_count && !data->gpos_accels))) - { - _hb_ot_face_data_destroy (data); - return nullptr; - } - - for (unsigned int i = 0; i < gsub_lookup_count; i++) - data->gsub_accels[i].init (gsub.get_lookup (i)); - for (unsigned int i = 0; i < gpos_lookup_count; i++) - data->gpos_accels[i].init (gpos.get_lookup (i)); - return data; } void _hb_ot_face_data_destroy (hb_ot_face_data_t *data) { - if (data->gsub_accels) - for (unsigned int i = 0; i < data->gsub_lookup_count; i++) - data->gsub_accels[i].fini (); - if (data->gpos_accels) - for (unsigned int i = 0; i < data->gpos_lookup_count; i++) - data->gpos_accels[i].fini (); - - free (data->gsub_accels); - free (data->gpos_accels); - data->table.fini (); - free (data); } diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 1466f11be..dd17fbc88 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -33,12 +33,19 @@ #include "hb-machinery.hh" + +#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) + + #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" #include "hb-ot-hmtx-table.hh" #include "hb-ot-kern-table.hh" #include "hb-ot-post-table.hh" #include "hb-ot-color-cbdt-table.hh" +#include "hb-ot-layout-gdef-table.hh" +#include "hb-ot-layout-gsub-table.hh" +#include "hb-ot-layout-gpos-table.hh" /* @@ -50,8 +57,6 @@ #define HB_OT_LAYOUT_TABLES \ /* OpenType shaping. */ \ HB_OT_LAYOUT_TABLE(OT, GDEF) \ - HB_OT_LAYOUT_TABLE(OT, GSUB) \ - HB_OT_LAYOUT_TABLE(OT, GPOS) \ HB_OT_LAYOUT_TABLE(OT, JSTF) \ HB_OT_LAYOUT_TABLE(OT, BASE) \ /* AAT shaping. */ \ @@ -66,6 +71,8 @@ /* OpenType math. */ \ HB_OT_LAYOUT_TABLE(OT, MATH) \ /* OpenType fundamentals. */ \ + HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \ + HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \ HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \ HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \ HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \ @@ -104,19 +111,13 @@ struct hb_ot_face_data_t hb_face_t *face; /* MUST be JUST before the lazy loaders. */ #define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - hb_table_lazy_loader_t Type; + hb_table_lazy_loader_t Type; #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ - hb_face_lazy_loader_t Type; + hb_face_lazy_loader_t Type; HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE } table; - - /* More accelerators. Merge into previous. */ - unsigned int gsub_lookup_count; - unsigned int gpos_lookup_count; - hb_ot_layout_lookup_accelerator_t *gsub_accels; - hb_ot_layout_lookup_accelerator_t *gpos_accels; }; @@ -127,8 +128,4 @@ HB_INTERNAL void _hb_ot_face_data_destroy (hb_ot_face_data_t *data); -#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) - - - #endif /* HB_OT_FACE_HH */ diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index e1a405063..f55df2072 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1636,7 +1636,7 @@ template /*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const PosLookup &l = hb_ot_face_data (c->face)->table.GPOS->get_lookup (lookup_index); + const PosLookup &l = _get_gpos (c->face).get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 59e8a43f2..991b5566b 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1327,7 +1327,7 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) { _hb_buffer_assert_gsubgpos_vars (buffer); - const GDEF &gdef = *hb_ot_face_data (font->face)->table.GDEF; + const GDEF &gdef = _get_gdef (font->face); unsigned int count = buffer->len; for (unsigned int i = 0; i < count; i++) { @@ -1351,13 +1351,13 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) template /*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const SubstLookup &l = hb_ot_face_data (c->face)->table.GSUB->get_lookup (lookup_index); + const SubstLookup &l = _get_gsub (c->face).get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const SubstLookup &l = hb_ot_face_data (c->face)->table.GSUB->get_lookup (lookup_index); + const SubstLookup &l = _get_gsub (c->face).get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 44b595ae1..e7d20fd06 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -32,9 +32,9 @@ #include "hb.hh" #include "hb-buffer.hh" #include "hb-map.hh" -#include "hb-ot-face.hh" -#include "hb-ot-layout-gdef-table.hh" #include "hb-set.hh" +#include "hb-ot-layout-common.hh" +#include "hb-ot-layout-gdef-table.hh" namespace OT { @@ -481,7 +481,7 @@ struct hb_ot_apply_context_t : iter_input (), iter_context (), font (font_), face (font->face), buffer (buffer_), recurse_func (nullptr), - gdef (*hb_ot_face_data (face)->table.GDEF), + gdef (_get_gdef (face)), var_store (gdef.get_var_store ()), direction (buffer_->props.direction), lookup_mask (1), @@ -2387,28 +2387,30 @@ struct GSUBGPOS inline void init (hb_face_t *face) { this->blob = hb_sanitize_context_t().reference_table (face); - const T &table = *this->blob->as (); + table = this->blob->as (); - this->lookup_count = table.get_lookup_count (); + this->lookup_count = table->get_lookup_count (); this->accels = (hb_ot_layout_lookup_accelerator_t *) calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); if (unlikely (!this->accels)) this->lookup_count = 0; for (unsigned int i = 0; i < this->lookup_count; i++) - this->accels[i].init (table.get_lookup (i)); + this->accels[i].init (table->get_lookup (i)); } inline void fini (void) { + for (unsigned int i = 0; i < this->lookup_count; i++) + this->accels[i].fini (); + free (this->accels); hb_blob_destroy (this->blob); - free (accels); } - private: - hb_blob_t *blob; - unsigned int lookup_count; - hb_ot_layout_lookup_accelerator_t *accels; + hb_blob_t *blob; + const T *table; + unsigned int lookup_count; + hb_ot_layout_lookup_accelerator_t *accels; }; protected: diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index b9bb17fc8..ffbb38bbc 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -30,6 +30,7 @@ #include "hb-open-type.hh" #include "hb-ot-layout.hh" +#include "hb-ot-face.hh" #include "hb-ot-map.hh" #include "hb-map.hh" @@ -55,23 +56,23 @@ // return *(data->base.get ()); // } -static inline const OT::GDEF& +inline const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); return *hb_ot_face_data (face)->table.GDEF; } -static inline const OT::GSUB& +inline const OT::GSUB& _get_gsub (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); - return *hb_ot_face_data (face)->table.GSUB; + return *hb_ot_face_data (face)->table.GSUB->table; } -static inline const OT::GPOS& +inline const OT::GPOS& _get_gpos (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); - return *hb_ot_face_data (face)->table.GPOS; + return *hb_ot_face_data (face)->table.GPOS->table; } /* @@ -461,11 +462,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face, { case HB_OT_TAG_GSUB: { - return hb_ot_face_data (face)->gsub_lookup_count; + return hb_ot_face_data (face)->table.GSUB->lookup_count; } case HB_OT_TAG_GPOS: { - return hb_ot_face_data (face)->gpos_lookup_count; + return hb_ot_face_data (face)->table.GPOS->lookup_count; } } return 0; @@ -679,13 +680,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, { case HB_OT_TAG_GSUB: { - const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } case HB_OT_TAG_GPOS: { - const OT::PosLookup& l = hb_ot_face_data (face)->table.GPOS->get_lookup (lookup_index); + const OT::PosLookup& l = hb_ot_face_data (face)->table.GPOS->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } @@ -758,12 +759,12 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, unsigned int glyphs_length, hb_bool_t zero_context) { - if (unlikely (lookup_index >= hb_ot_face_data (face)->gsub_lookup_count)) return false; + if (unlikely (lookup_index >= hb_ot_face_data (face)->table.GSUB->lookup_count)) return false; OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); - const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->table->get_lookup (lookup_index); - return l.would_apply (&c, &hb_ot_face_data (face)->gsub_accels[lookup_index]); + return l.would_apply (&c, &hb_ot_face_data (face)->table.GSUB->accels[lookup_index]); } void @@ -919,8 +920,8 @@ struct GSUBProxy typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : - table (*hb_ot_face_data (face)->table.GSUB), - accels (hb_ot_face_data (face)->gsub_accels) {} + table (*hb_ot_face_data (face)->table.GSUB->table), + accels (hb_ot_face_data (face)->table.GSUB->accels) {} const OT::GSUB &table; const hb_ot_layout_lookup_accelerator_t *accels; @@ -933,8 +934,8 @@ struct GPOSProxy typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : - table (*hb_ot_face_data (face)->table.GPOS), - accels (hb_ot_face_data (face)->gpos_accels) {} + table (*hb_ot_face_data (face)->table.GPOS->table), + accels (hb_ot_face_data (face)->table.GPOS->accels) {} const OT::GPOS &table; const hb_ot_layout_lookup_accelerator_t *accels; diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 02c8c7b27..ea66d108c 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -37,6 +37,23 @@ #include "hb-set-digest.hh" +namespace OT +{ + struct GDEF; + struct GSUB; + struct GPOS; +} + +HB_INTERNAL const OT::GDEF& +_get_gdef (hb_face_t *face); + +HB_INTERNAL const OT::GSUB& +_get_gsub (hb_face_t *face); + +HB_INTERNAL const OT::GPOS& +_get_gpos (hb_face_t *face); + + /* Private API corresponding to hb-ot-layout.h: */ HB_INTERNAL hb_bool_t diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index e571bd8a3..63102f6b0 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -35,6 +35,7 @@ #include "hb-ot-shape-fallback.hh" #include "hb-ot-shape-normalize.hh" +#include "hb-ot-face.hh" #include "hb-ot-layout.hh" #include "hb-unicode.hh" #include "hb-set.hh" From 4096fbe487d90de04020e32e8487295ecd4d8836 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 01:25:54 -0700 Subject: [PATCH 35/47] [ot-face] Port GDEF to unified table accelerator model as well --- src/hb-ot-face.cc | 108 --------------------------- src/hb-ot-face.hh | 2 +- src/hb-ot-layout-gdef-table.hh | 129 +++++++++++++++++++++++++++++++++ src/hb-ot-layout.cc | 14 +++- src/hb-ot-layout.hh | 5 +- 5 files changed, 147 insertions(+), 111 deletions(-) diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index 52411d5ca..ffac3d062 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -27,109 +27,6 @@ #include "hb-ot-face.hh" -static bool -_hb_ot_blacklist_gdef (unsigned int gdef_len, - unsigned int gsub_len, - unsigned int gpos_len) -{ - /* The ugly business of blacklisting individual fonts' tables happen here! - * See this thread for why we finally had to bend in and do this: - * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html - * - * In certain versions of Times New Roman Italic and Bold Italic, - * ASCII double quotation mark U+0022 has wrong glyph class 3 (mark) - * in GDEF. Many versions of Tahoma have bad GDEF tables that - * incorrectly classify some spacing marks such as certain IPA - * symbols as glyph class 3. So do older versions of Microsoft - * Himalaya, and the version of Cantarell shipped by Ubuntu 16.04. - * - * Nuke the GDEF tables of to avoid unwanted width-zeroing. - * - * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 - * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 - * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 - */ -#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) - switch ENCODE(gdef_len, gsub_len, gpos_len) - { - /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ - case ENCODE (442, 2874, 42038): - /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */ - case ENCODE (430, 2874, 40662): - /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */ - case ENCODE (442, 2874, 39116): - /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */ - case ENCODE (430, 2874, 39374): - /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */ - case ENCODE (490, 3046, 41638): - /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */ - case ENCODE (478, 3046, 41902): - /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */ - case ENCODE (898, 12554, 46470): - /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */ - case ENCODE (910, 12566, 47732): - /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */ - case ENCODE (928, 23298, 59332): - /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ - case ENCODE (940, 23310, 60732): - /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (964, 23836, 60072): - /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (976, 23832, 61456): - /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ - case ENCODE (994, 24474, 60336): - /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ - case ENCODE (1006, 24470, 61740): - /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (1006, 24576, 61346): - /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (1018, 24572, 62828): - /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ - case ENCODE (1006, 24576, 61352): - /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ - case ENCODE (1018, 24572, 62834): - /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ - case ENCODE (832, 7324, 47162): - /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ - case ENCODE (844, 7302, 45474): - /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ - case ENCODE (180, 13054, 7254): - /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ - case ENCODE (192, 12638, 7254): - /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ - case ENCODE (192, 12690, 7254): - /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */ - /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */ - case ENCODE (188, 248, 3852): - /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ - /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ - case ENCODE (188, 264, 3426): - /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ - case ENCODE (1058, 47032, 11818): - /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ - case ENCODE (1046, 47030, 12600): - /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ - case ENCODE (1058, 71796, 16770): - /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ - case ENCODE (1046, 71790, 17862): - /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ - case ENCODE (1046, 71788, 17112): - /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ - case ENCODE (1058, 71794, 17514): - /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ - case ENCODE (1330, 109904, 57938): - /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ - case ENCODE (1330, 109904, 58972): - /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf - * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ - case ENCODE (1004, 59092, 14836): - return true; -#undef ENCODE - } - return false; -} - - void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) { this->face = face; @@ -157,11 +54,6 @@ _hb_ot_face_data_create (hb_face_t *face) data->table.init0 (face); - if (unlikely (_hb_ot_blacklist_gdef (data->table.GDEF.get_blob ()->length, - data->table.GSUB->blob->length, - data->table.GPOS->blob->length))) - data->table.GDEF.set_stored (hb_blob_get_empty ()); - return data; } diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index dd17fbc88..6e7ff2ce2 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -56,7 +56,6 @@ * This is as good as any place. */ #define HB_OT_LAYOUT_TABLES \ /* OpenType shaping. */ \ - HB_OT_LAYOUT_TABLE(OT, GDEF) \ HB_OT_LAYOUT_TABLE(OT, JSTF) \ HB_OT_LAYOUT_TABLE(OT, BASE) \ /* AAT shaping. */ \ @@ -71,6 +70,7 @@ /* OpenType math. */ \ HB_OT_LAYOUT_TABLE(OT, MATH) \ /* OpenType fundamentals. */ \ + HB_OT_LAYOUT_ACCELERATOR(OT, GDEF) \ HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \ HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \ HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \ diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 637f7f5c4..950b654f1 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -337,6 +337,110 @@ struct MarkGlyphSets * https://docs.microsoft.com/en-us/typography/opentype/spec/gdef */ +static bool +_hb_ot_blacklist_gdef (unsigned int gdef_len, + unsigned int gsub_len, + unsigned int gpos_len) +{ + /* The ugly business of blacklisting individual fonts' tables happen here! + * See this thread for why we finally had to bend in and do this: + * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html + * + * In certain versions of Times New Roman Italic and Bold Italic, + * ASCII double quotation mark U+0022 has wrong glyph class 3 (mark) + * in GDEF. Many versions of Tahoma have bad GDEF tables that + * incorrectly classify some spacing marks such as certain IPA + * symbols as glyph class 3. So do older versions of Microsoft + * Himalaya, and the version of Cantarell shipped by Ubuntu 16.04. + * + * Nuke the GDEF tables of to avoid unwanted width-zeroing. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 + * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 + * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 + */ +#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) + switch ENCODE(gdef_len, gsub_len, gpos_len) + { + /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ + case ENCODE (442, 2874, 42038): + /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */ + case ENCODE (430, 2874, 40662): + /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */ + case ENCODE (442, 2874, 39116): + /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */ + case ENCODE (430, 2874, 39374): + /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */ + case ENCODE (490, 3046, 41638): + /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */ + case ENCODE (478, 3046, 41902): + /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */ + case ENCODE (898, 12554, 46470): + /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */ + case ENCODE (910, 12566, 47732): + /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */ + case ENCODE (928, 23298, 59332): + /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ + case ENCODE (940, 23310, 60732): + /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (964, 23836, 60072): + /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (976, 23832, 61456): + /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ + case ENCODE (994, 24474, 60336): + /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ + case ENCODE (1006, 24470, 61740): + /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (1006, 24576, 61346): + /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (1018, 24572, 62828): + /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ + case ENCODE (1006, 24576, 61352): + /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ + case ENCODE (1018, 24572, 62834): + /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ + case ENCODE (832, 7324, 47162): + /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ + case ENCODE (844, 7302, 45474): + /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ + case ENCODE (180, 13054, 7254): + /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ + case ENCODE (192, 12638, 7254): + /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ + case ENCODE (192, 12690, 7254): + /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */ + /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */ + case ENCODE (188, 248, 3852): + /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ + /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ + case ENCODE (188, 264, 3426): + /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ + case ENCODE (1058, 47032, 11818): + /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ + case ENCODE (1046, 47030, 12600): + /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ + case ENCODE (1058, 71796, 16770): + /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ + case ENCODE (1046, 71790, 17862): + /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ + case ENCODE (1046, 71788, 17112): + /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ + case ENCODE (1058, 71794, 17514): + /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ + case ENCODE (1330, 109904, 57938): + /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ + case ENCODE (1330, 109904, 58972): + /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf + * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ + case ENCODE (1004, 59092, 14836): + return true; +#undef ENCODE + } + return false; +} + + + struct GDEF { static const hb_tag_t tableTag = HB_OT_TAG_GDEF; @@ -420,6 +524,31 @@ struct GDEF } } + struct accelerator_t + { + inline void init (hb_face_t *face) + { + this->blob = hb_sanitize_context_t().reference_table (face); + + if (unlikely (_hb_ot_blacklist_gdef (this->blob->length, + _get_gsub_blob (face)->length, + _get_gpos_blob (face)->length))) + { + hb_blob_destroy (this->blob); + this->blob = hb_blob_get_empty (); + } + + table = this->blob->as (); + } + + inline void fini (void) + { + hb_blob_destroy (this->blob); + } + + hb_blob_t *blob; + const GDEF *table; + }; protected: FixedVersion<>version; /* Version of the GDEF table--currently diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index ffbb38bbc..a24823267 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -60,7 +60,13 @@ inline const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); - return *hb_ot_face_data (face)->table.GDEF; + return *hb_ot_face_data (face)->table.GDEF->table; +} +hb_blob_t * +_get_gsub_blob (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); + return hb_ot_face_data (face)->table.GSUB->blob; } inline const OT::GSUB& _get_gsub (hb_face_t *face) @@ -68,6 +74,12 @@ _get_gsub (hb_face_t *face) if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); return *hb_ot_face_data (face)->table.GSUB->table; } +hb_blob_t * +_get_gpos_blob (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); + return hb_ot_face_data (face)->table.GPOS->blob; +} inline const OT::GPOS& _get_gpos (hb_face_t *face) { diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index ea66d108c..03ae9b732 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -46,10 +46,13 @@ namespace OT HB_INTERNAL const OT::GDEF& _get_gdef (hb_face_t *face); - +HB_INTERNAL hb_blob_t * +_get_gsub_blob (hb_face_t *face); HB_INTERNAL const OT::GSUB& _get_gsub (hb_face_t *face); +HB_INTERNAL hb_blob_t * +_get_gpos_blob (hb_face_t *face); HB_INTERNAL const OT::GPOS& _get_gpos (hb_face_t *face); From c44b0caf0d0cddb7228dcec0b9d25bb62f641abc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 01:29:30 -0700 Subject: [PATCH 36/47] Fixup --- src/hb-ot-layout-gpos-table.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index f55df2072..7d3c3badb 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1630,7 +1630,7 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) template /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const PosLookup &l = hb_ot_face_data (c->face)->table.GPOS->get_lookup (lookup_index); + const PosLookup &l = _get_gpos (c->face)->get_lookup (lookup_index); return l.dispatch (c); } From 453e0c60b1c87d2cd2527d6d2de673f65458a9fd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 01:30:52 -0700 Subject: [PATCH 37/47] Add template keyword I swear I have no idea why this is needed, but it is... --- src/hb-ot-layout-gsubgpos.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index e7d20fd06..3727dd9ea 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2387,7 +2387,7 @@ struct GSUBGPOS inline void init (hb_face_t *face) { this->blob = hb_sanitize_context_t().reference_table (face); - table = this->blob->as (); + table = this->blob->template as (); this->lookup_count = table->get_lookup_count (); From d8c57e85d9981b4c7a11fae4f31100359574cf13 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 09:03:31 -0700 Subject: [PATCH 38/47] [GDEF] Move code around --- src/hb-ot-layout-gdef-table.hh | 118 +---------------------------- src/hb-ot-layout.cc | 134 ++++++++++++++++++++++++++++++--- src/hb-ot-layout.hh | 14 +--- 3 files changed, 128 insertions(+), 138 deletions(-) diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 950b654f1..1f19c0284 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -337,109 +337,6 @@ struct MarkGlyphSets * https://docs.microsoft.com/en-us/typography/opentype/spec/gdef */ -static bool -_hb_ot_blacklist_gdef (unsigned int gdef_len, - unsigned int gsub_len, - unsigned int gpos_len) -{ - /* The ugly business of blacklisting individual fonts' tables happen here! - * See this thread for why we finally had to bend in and do this: - * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html - * - * In certain versions of Times New Roman Italic and Bold Italic, - * ASCII double quotation mark U+0022 has wrong glyph class 3 (mark) - * in GDEF. Many versions of Tahoma have bad GDEF tables that - * incorrectly classify some spacing marks such as certain IPA - * symbols as glyph class 3. So do older versions of Microsoft - * Himalaya, and the version of Cantarell shipped by Ubuntu 16.04. - * - * Nuke the GDEF tables of to avoid unwanted width-zeroing. - * - * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 - * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 - * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 - */ -#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) - switch ENCODE(gdef_len, gsub_len, gpos_len) - { - /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ - case ENCODE (442, 2874, 42038): - /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */ - case ENCODE (430, 2874, 40662): - /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */ - case ENCODE (442, 2874, 39116): - /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */ - case ENCODE (430, 2874, 39374): - /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */ - case ENCODE (490, 3046, 41638): - /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */ - case ENCODE (478, 3046, 41902): - /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */ - case ENCODE (898, 12554, 46470): - /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */ - case ENCODE (910, 12566, 47732): - /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */ - case ENCODE (928, 23298, 59332): - /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ - case ENCODE (940, 23310, 60732): - /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (964, 23836, 60072): - /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (976, 23832, 61456): - /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ - case ENCODE (994, 24474, 60336): - /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ - case ENCODE (1006, 24470, 61740): - /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (1006, 24576, 61346): - /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ - case ENCODE (1018, 24572, 62828): - /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ - case ENCODE (1006, 24576, 61352): - /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ - case ENCODE (1018, 24572, 62834): - /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ - case ENCODE (832, 7324, 47162): - /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ - case ENCODE (844, 7302, 45474): - /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ - case ENCODE (180, 13054, 7254): - /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ - case ENCODE (192, 12638, 7254): - /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ - case ENCODE (192, 12690, 7254): - /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */ - /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */ - case ENCODE (188, 248, 3852): - /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ - /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ - case ENCODE (188, 264, 3426): - /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ - case ENCODE (1058, 47032, 11818): - /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ - case ENCODE (1046, 47030, 12600): - /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ - case ENCODE (1058, 71796, 16770): - /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ - case ENCODE (1046, 71790, 17862): - /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ - case ENCODE (1046, 71788, 17112): - /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ - case ENCODE (1058, 71794, 17514): - /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ - case ENCODE (1330, 109904, 57938): - /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ - case ENCODE (1330, 109904, 58972): - /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf - * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ - case ENCODE (1004, 59092, 14836): - return true; -#undef ENCODE - } - return false; -} - - struct GDEF { @@ -526,20 +423,7 @@ struct GDEF struct accelerator_t { - inline void init (hb_face_t *face) - { - this->blob = hb_sanitize_context_t().reference_table (face); - - if (unlikely (_hb_ot_blacklist_gdef (this->blob->length, - _get_gsub_blob (face)->length, - _get_gpos_blob (face)->length))) - { - hb_blob_destroy (this->blob); - this->blob = hb_blob_get_empty (); - } - - table = this->blob->as (); - } + HB_INTERNAL inline void init (hb_face_t *face); inline void fini (void) { diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index a24823267..6e9b5f80a 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -56,41 +56,155 @@ // return *(data->base.get ()); // } -inline const OT::GDEF& -_get_gdef (hb_face_t *face) +inline const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); return *hb_ot_face_data (face)->table.GDEF->table; } -hb_blob_t * -_get_gsub_blob (hb_face_t *face) +static hb_blob_t * _get_gsub_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); return hb_ot_face_data (face)->table.GSUB->blob; } -inline const OT::GSUB& -_get_gsub (hb_face_t *face) +inline const OT::GSUB& _get_gsub (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); return *hb_ot_face_data (face)->table.GSUB->table; } -hb_blob_t * -_get_gpos_blob (hb_face_t *face) +static hb_blob_t * _get_gpos_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); return hb_ot_face_data (face)->table.GPOS->blob; } -inline const OT::GPOS& -_get_gpos (hb_face_t *face) +inline const OT::GPOS& _get_gpos (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); return *hb_ot_face_data (face)->table.GPOS->table; } + /* * GDEF */ +static bool +_hb_ot_blacklist_gdef (unsigned int gdef_len, + unsigned int gsub_len, + unsigned int gpos_len) +{ + /* The ugly business of blacklisting individual fonts' tables happen here! + * See this thread for why we finally had to bend in and do this: + * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html + * + * In certain versions of Times New Roman Italic and Bold Italic, + * ASCII double quotation mark U+0022 has wrong glyph class 3 (mark) + * in GDEF. Many versions of Tahoma have bad GDEF tables that + * incorrectly classify some spacing marks such as certain IPA + * symbols as glyph class 3. So do older versions of Microsoft + * Himalaya, and the version of Cantarell shipped by Ubuntu 16.04. + * + * Nuke the GDEF tables of to avoid unwanted width-zeroing. + * + * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 + * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 + * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 + */ +#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) + switch ENCODE(gdef_len, gsub_len, gpos_len) + { + /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ + case ENCODE (442, 2874, 42038): + /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */ + case ENCODE (430, 2874, 40662): + /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */ + case ENCODE (442, 2874, 39116): + /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */ + case ENCODE (430, 2874, 39374): + /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */ + case ENCODE (490, 3046, 41638): + /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */ + case ENCODE (478, 3046, 41902): + /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */ + case ENCODE (898, 12554, 46470): + /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */ + case ENCODE (910, 12566, 47732): + /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */ + case ENCODE (928, 23298, 59332): + /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ + case ENCODE (940, 23310, 60732): + /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (964, 23836, 60072): + /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (976, 23832, 61456): + /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ + case ENCODE (994, 24474, 60336): + /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ + case ENCODE (1006, 24470, 61740): + /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (1006, 24576, 61346): + /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + case ENCODE (1018, 24572, 62828): + /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ + case ENCODE (1006, 24576, 61352): + /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ + case ENCODE (1018, 24572, 62834): + /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ + case ENCODE (832, 7324, 47162): + /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ + case ENCODE (844, 7302, 45474): + /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ + case ENCODE (180, 13054, 7254): + /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ + case ENCODE (192, 12638, 7254): + /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ + case ENCODE (192, 12690, 7254): + /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */ + /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */ + case ENCODE (188, 248, 3852): + /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ + /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ + case ENCODE (188, 264, 3426): + /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ + case ENCODE (1058, 47032, 11818): + /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ + case ENCODE (1046, 47030, 12600): + /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ + case ENCODE (1058, 71796, 16770): + /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ + case ENCODE (1046, 71790, 17862): + /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ + case ENCODE (1046, 71788, 17112): + /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ + case ENCODE (1058, 71794, 17514): + /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */ + case ENCODE (1330, 109904, 57938): + /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ + case ENCODE (1330, 109904, 58972): + /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf + * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ + case ENCODE (1004, 59092, 14836): + return true; +#undef ENCODE + } + return false; +} + +inline void +OT::GDEF::accelerator_t::init (hb_face_t *face) +{ + this->blob = hb_sanitize_context_t().reference_table (face); + + if (unlikely (_hb_ot_blacklist_gdef (this->blob->length, + _get_gsub_blob (face)->length, + _get_gpos_blob (face)->length))) + { + hb_blob_destroy (this->blob); + this->blob = hb_blob_get_empty (); + } + + table = this->blob->as (); +} + hb_bool_t hb_ot_layout_has_glyph_classes (hb_face_t *face) { diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 03ae9b732..7abaaaa5c 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -44,17 +44,9 @@ namespace OT struct GPOS; } -HB_INTERNAL const OT::GDEF& -_get_gdef (hb_face_t *face); -HB_INTERNAL hb_blob_t * -_get_gsub_blob (hb_face_t *face); -HB_INTERNAL const OT::GSUB& -_get_gsub (hb_face_t *face); - -HB_INTERNAL hb_blob_t * -_get_gpos_blob (hb_face_t *face); -HB_INTERNAL const OT::GPOS& -_get_gpos (hb_face_t *face); +HB_INTERNAL const OT::GDEF& _get_gdef (hb_face_t *face); +HB_INTERNAL const OT::GSUB& _get_gsub (hb_face_t *face); +HB_INTERNAL const OT::GPOS& _get_gpos (hb_face_t *face); /* Private API corresponding to hb-ot-layout.h: */ From 399909468204b76769857508e74f802d648ca0a5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 09:12:25 -0700 Subject: [PATCH 39/47] [OT] Use relaxed ops for recursing into GSUB/GPOS lookups again --- src/hb-ot-layout-gpos-table.hh | 4 ++-- src/hb-ot-layout-gsub-table.hh | 4 ++-- src/hb-ot-layout.cc | 12 ++++++++++-- src/hb-ot-layout.hh | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 7d3c3badb..08a99b35c 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1630,13 +1630,13 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) template /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const PosLookup &l = _get_gpos (c->face)->get_lookup (lookup_index); + const PosLookup &l = _get_gpos_relaxed (c->face)->get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const PosLookup &l = _get_gpos (c->face).get_lookup (lookup_index); + const PosLookup &l = _get_gpos_relaxed (c->face).get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 991b5566b..8911a5eb4 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1351,13 +1351,13 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) template /*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const SubstLookup &l = _get_gsub (c->face).get_lookup (lookup_index); + const SubstLookup &l = _get_gsub_relaxed (c->face).get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const SubstLookup &l = _get_gsub (c->face).get_lookup (lookup_index); + const SubstLookup &l = _get_gsub_relaxed (c->face).get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 6e9b5f80a..4d2aeeee2 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -66,21 +66,29 @@ static hb_blob_t * _get_gsub_blob (hb_face_t *face) if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); return hb_ot_face_data (face)->table.GSUB->blob; } -inline const OT::GSUB& _get_gsub (hb_face_t *face) +static inline const OT::GSUB& _get_gsub (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); return *hb_ot_face_data (face)->table.GSUB->table; } +inline const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) +{ + return *hb_ot_face_data (face)->table.GSUB.get_relaxed ()->table; +} static hb_blob_t * _get_gpos_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); return hb_ot_face_data (face)->table.GPOS->blob; } -inline const OT::GPOS& _get_gpos (hb_face_t *face) +static inline const OT::GPOS& _get_gpos (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); return *hb_ot_face_data (face)->table.GPOS->table; } +inline const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) +{ + return *hb_ot_face_data (face)->table.GPOS.get_relaxed ()->table; +} /* diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 7abaaaa5c..84981391c 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -45,8 +45,8 @@ namespace OT } HB_INTERNAL const OT::GDEF& _get_gdef (hb_face_t *face); -HB_INTERNAL const OT::GSUB& _get_gsub (hb_face_t *face); -HB_INTERNAL const OT::GPOS& _get_gpos (hb_face_t *face); +HB_INTERNAL const OT::GSUB& _get_gsub_relaxed (hb_face_t *face); +HB_INTERNAL const OT::GPOS& _get_gpos_relaxed (hb_face_t *face); /* Private API corresponding to hb-ot-layout.h: */ From c624e18a24311c66737dde4ce515aa1eca892b94 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 09:19:20 -0700 Subject: [PATCH 40/47] [OT] Move code around --- src/hb-ot-layout-gsub-table.hh | 18 ------------------ src/hb-ot-layout.cc | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 8911a5eb4..11fe7cf4c 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1308,8 +1308,6 @@ struct GSUB : GSUBGPOS inline const SubstLookup& get_lookup (unsigned int i) const { return CastR (GSUBGPOS::get_lookup (i)); } - static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer); - inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1322,22 +1320,6 @@ struct GSUB : GSUBGPOS }; -void -GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) -{ - _hb_buffer_assert_gsubgpos_vars (buffer); - - const GDEF &gdef = _get_gdef (font->face); - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - { - _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint)); - _hb_glyph_info_clear_lig_props (&buffer->info[i]); - buffer->info[i].syllable() = 0; - } -} - - /* Out-of-class implementation for methods recursing */ /*static*/ inline bool ExtensionSubst::is_reverse (void) const diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 4d2aeeee2..276353285 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -213,6 +213,24 @@ OT::GDEF::accelerator_t::init (hb_face_t *face) table = this->blob->as (); } +static void +_hb_ot_layout_set_glyph_props (hb_font_t *font, + hb_buffer_t *buffer) +{ + _hb_buffer_assert_gsubgpos_vars (buffer); + + const OT::GDEF &gdef = _get_gdef (font->face); + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; i++) + { + _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint)); + _hb_glyph_info_clear_lig_props (&buffer->info[i]); + buffer->info[i].syllable() = 0; + } +} + +/* Public API */ + hb_bool_t hb_ot_layout_has_glyph_classes (hb_face_t *face) { @@ -902,9 +920,10 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, } void -hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer) +hb_ot_layout_substitute_start (hb_font_t *font, + hb_buffer_t *buffer) { - OT::GSUB::substitute_start (font, buffer); +_hb_ot_layout_set_glyph_props (font, buffer); } /** From a84309afc8817cd386e555af21dfcdc03388b329 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 09:33:01 -0700 Subject: [PATCH 41/47] [face] Use saved cmap in collect_unicodes() APIs --- src/hb-face.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/hb-face.cc b/src/hb-face.cc index 286b1f2ca..e4e0e05a4 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -31,7 +31,7 @@ #include "hb-face.hh" #include "hb-blob.hh" #include "hb-open-file.hh" -#include "hb-ot-cmap-table.hh" +#include "hb-ot-face.hh" /** @@ -519,6 +519,7 @@ hb_face_get_table_tags (const hb_face_t *face, * Character set. */ + /** * hb_face_collect_unicodes: * @face: font face. @@ -530,9 +531,8 @@ void hb_face_collect_unicodes (hb_face_t *face, hb_set_t *out) { - /* XXX Use saved accel. */ - hb_auto_t cmap (face); - cmap.collect_unicodes (out); + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + hb_ot_face_data (face)->table.cmap->collect_unicodes (out); } /** @@ -548,9 +548,8 @@ void hb_face_collect_variation_selectors (hb_face_t *face, hb_set_t *out) { - /* XXX Use saved accel. */ - hb_auto_t cmap (face); - cmap.collect_variation_selectors (out); + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + hb_ot_face_data (face)->table.cmap->collect_variation_selectors (out); } /** @@ -567,9 +566,8 @@ hb_face_collect_variation_unicodes (hb_face_t *face, hb_codepoint_t variation_selector, hb_set_t *out) { - /* XXX Use saved accel. */ - hb_auto_t cmap (face); - cmap.collect_variation_unicodes (variation_selector, out); + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + hb_ot_face_data (face)->table.cmap->collect_variation_unicodes (variation_selector, out); } From 3a0b3a29cc246d0b1e5989c9e8c1e6d544046dcc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 15:11:24 -0700 Subject: [PATCH 42/47] Free up hb-ot-face.hh from includes There might be a better way to do this, but I couldn't find... --- src/hb-face.cc | 1 + src/hb-ot-cmap-table.hh | 1 + src/hb-ot-color-cbdt-table.hh | 2 ++ src/hb-ot-face.cc | 10 ++++++++++ src/hb-ot-face.hh | 15 ++------------- src/hb-ot-font.cc | 7 +++++++ src/hb-ot-glyf-table.hh | 2 ++ src/hb-ot-hmtx-table.hh | 3 +++ src/hb-ot-kern-table.hh | 2 ++ src/hb-ot-layout-gdef-table.hh | 1 + src/hb-ot-layout-gpos-table.hh | 2 ++ src/hb-ot-layout-gsub-table.hh | 1 + src/hb-ot-post-table.hh | 2 ++ 13 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/hb-face.cc b/src/hb-face.cc index e4e0e05a4..ddf8e488d 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -32,6 +32,7 @@ #include "hb-blob.hh" #include "hb-open-file.hh" #include "hb-ot-face.hh" +#include "hb-ot-cmap-table.hh" /** diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index c357714e2..aca5de2e3 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1173,6 +1173,7 @@ struct cmap DEFINE_SIZE_ARRAY (4, encodingRecord); }; +struct cmap_accelerator_t : cmap::accelerator_t {}; } /* namespace OT */ diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index 8533b0365..8bedf2224 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -533,6 +533,8 @@ struct CBDT DEFINE_SIZE_ARRAY(4, dataZ); }; +struct CBDT_accelerator_t : CBDT::accelerator_t {}; + } /* namespace OT */ #endif /* HB_OT_COLOR_CBDT_TABLE_HH */ diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index ffac3d062..c6c4ff9e6 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -26,6 +26,16 @@ #include "hb-ot-face.hh" +#include "hb-ot-cmap-table.hh" +#include "hb-ot-glyf-table.hh" +#include "hb-ot-hmtx-table.hh" +#include "hb-ot-kern-table.hh" +#include "hb-ot-post-table.hh" +#include "hb-ot-color-cbdt-table.hh" +#include "hb-ot-layout-gdef-table.hh" +#include "hb-ot-layout-gsub-table.hh" +#include "hb-ot-layout-gpos-table.hh" + void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) { diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 6e7ff2ce2..765627dee 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -37,17 +37,6 @@ #define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) -#include "hb-ot-cmap-table.hh" -#include "hb-ot-glyf-table.hh" -#include "hb-ot-hmtx-table.hh" -#include "hb-ot-kern-table.hh" -#include "hb-ot-post-table.hh" -#include "hb-ot-color-cbdt-table.hh" -#include "hb-ot-layout-gdef-table.hh" -#include "hb-ot-layout-gsub-table.hh" -#include "hb-ot-layout-gpos-table.hh" - - /* * hb_ot_face_data_t */ @@ -84,7 +73,7 @@ /* Declare tables. */ #define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type##_accelerator_t) HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE @@ -113,7 +102,7 @@ struct hb_ot_face_data_t #define HB_OT_LAYOUT_TABLE(Namespace, Type) \ hb_table_lazy_loader_t Type; #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ - hb_face_lazy_loader_t Type; + hb_face_lazy_loader_t Type; HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index c96cba41d..e441aad4c 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -32,6 +32,13 @@ #include "hb-machinery.hh" #include "hb-ot-face.hh" +#include "hb-ot-cmap-table.hh" +#include "hb-ot-hmtx-table.hh" +#include "hb-ot-kern-table.hh" +#include "hb-ot-post-table.hh" +#include "hb-ot-glyf-table.hh" +#include "hb-ot-color-cbdt-table.hh" + typedef hb_ot_face_data_t::tables_t hb_ot_font_t; diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index a23269e56..65758861a 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -490,6 +490,8 @@ struct glyf DEFINE_SIZE_ARRAY (0, dataZ); }; +struct glyf_accelerator_t : glyf::accelerator_t {}; + } /* namespace OT */ diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 6849172b9..9bdca7eb9 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -332,6 +332,9 @@ struct vmtx : hmtxvmtx { static const hb_tag_t os2Tag = HB_TAG_NONE; }; +struct hmtx_accelerator_t : hmtx::accelerator_t {}; +struct vmtx_accelerator_t : vmtx::accelerator_t {}; + } /* namespace OT */ diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index ac6e9e459..40f94be29 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -390,6 +390,8 @@ struct kern DEFINE_SIZE_UNION (2, major); }; +struct kern_accelerator_t : kern::accelerator_t {}; + } /* namespace OT */ diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 1f19c0284..79308649f 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -467,6 +467,7 @@ struct GDEF DEFINE_SIZE_MIN (12); }; +struct GDEF_accelerator_t : GDEF::accelerator_t {}; } /* namespace OT */ diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 08a99b35c..16b547939 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1647,6 +1647,8 @@ template return ret; } +struct GPOS_accelerator_t : GPOS::accelerator_t {}; + #undef attach_chain #undef attach_type diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 11fe7cf4c..55696c5ac 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1350,6 +1350,7 @@ template return ret; } +struct GSUB_accelerator_t : GSUB::accelerator_t {}; } /* namespace OT */ diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 44918b1d6..0c3e596a3 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -295,6 +295,8 @@ struct post DEFINE_SIZE_STATIC (32); }; +struct post_accelerator_t : post::accelerator_t {}; + } /* namespace OT */ From a26806801005c28115ae9e48bdcf3bbbc1bcd767 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Aug 2018 15:18:46 -0700 Subject: [PATCH 43/47] [ot-face] Remove tables_t. The face_data_t is what tables_t was --- src/hb-aat-layout.cc | 4 ++-- src/hb-face.cc | 6 +++--- src/hb-ot-face.cc | 8 ++++---- src/hb-ot-face.hh | 36 ++++++++++++++++-------------------- src/hb-ot-font.cc | 25 +++++++++++-------------- src/hb-ot-layout.cc | 36 ++++++++++++++++++------------------ src/hb-ot-math.cc | 4 ++-- src/hb-ot-var.cc | 4 ++-- 8 files changed, 58 insertions(+), 65 deletions(-) diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index c481e6a88..a5e36a40a 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -49,9 +49,9 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr) *blob = hb_blob_get_empty (); return Null(AAT::morx); } - const AAT::morx& morx = *(hb_ot_face_data (face)->table.morx.get ()); + const AAT::morx& morx = *(hb_ot_face_data (face)->morx.get ()); if (blob) - *blob = hb_ot_face_data (face)->table.morx.get_blob (); + *blob = hb_ot_face_data (face)->morx.get_blob (); return morx; } diff --git a/src/hb-face.cc b/src/hb-face.cc index ddf8e488d..2fb5a0a36 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -533,7 +533,7 @@ hb_face_collect_unicodes (hb_face_t *face, hb_set_t *out) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - hb_ot_face_data (face)->table.cmap->collect_unicodes (out); + hb_ot_face_data (face)->cmap->collect_unicodes (out); } /** @@ -550,7 +550,7 @@ hb_face_collect_variation_selectors (hb_face_t *face, hb_set_t *out) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - hb_ot_face_data (face)->table.cmap->collect_variation_selectors (out); + hb_ot_face_data (face)->cmap->collect_variation_selectors (out); } /** @@ -568,7 +568,7 @@ hb_face_collect_variation_unicodes (hb_face_t *face, hb_set_t *out) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - hb_ot_face_data (face)->table.cmap->collect_variation_unicodes (variation_selector, out); + hb_ot_face_data (face)->cmap->collect_variation_unicodes (variation_selector, out); } diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index c6c4ff9e6..388a59720 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -37,7 +37,7 @@ #include "hb-ot-layout-gpos-table.hh" -void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) +void hb_ot_face_data_t::init0 (hb_face_t *face) { this->face = face; #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); @@ -46,7 +46,7 @@ void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE } -void hb_ot_face_data_t::tables_t::fini (void) +void hb_ot_face_data_t::fini (void) { #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) @@ -62,7 +62,7 @@ _hb_ot_face_data_create (hb_face_t *face) if (unlikely (!data)) return nullptr; - data->table.init0 (face); + data->init0 (face); return data; } @@ -70,7 +70,7 @@ _hb_ot_face_data_create (hb_face_t *face) void _hb_ot_face_data_destroy (hb_ot_face_data_t *data) { - data->table.fini (); + data->fini (); free (data); } diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 765627dee..5ac3538e4 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -80,33 +80,29 @@ HB_OT_LAYOUT_TABLES struct hb_ot_face_data_t { - /* All the president's tables. */ - struct tables_t - { - HB_INTERNAL void init0 (hb_face_t *face); - HB_INTERNAL void fini (void); + HB_INTERNAL void init0 (hb_face_t *face); + HB_INTERNAL void fini (void); #define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ - HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) - enum order_t - { - ORDER_ZERO, + HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) + enum order_t + { + ORDER_ZERO, #define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_ACCELERATOR -#undef HB_OT_LAYOUT_TABLE - }; - - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - hb_table_lazy_loader_t Type; -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ - hb_face_lazy_loader_t Type; HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE - } table; + }; + + hb_face_t *face; /* MUST be JUST before the lazy loaders. */ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ + hb_table_lazy_loader_t Type; +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ + hb_face_lazy_loader_t Type; + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR +#undef HB_OT_LAYOUT_TABLE }; diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index e441aad4c..a4c5584fb 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -40,9 +40,6 @@ #include "hb-ot-color-cbdt-table.hh" -typedef hb_ot_face_data_t::tables_t hb_ot_font_t; - - static hb_bool_t hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, void *font_data, @@ -51,7 +48,7 @@ hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->cmap.get_relaxed()->get_nominal_glyph (unicode, glyph); } @@ -63,7 +60,7 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph); } @@ -73,7 +70,7 @@ hb_ot_get_glyph_h_advance (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_x (ot_font->hmtx.get_relaxed ()->get_advance (glyph, font)); } @@ -83,7 +80,7 @@ hb_ot_get_glyph_v_advance (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_y (-(int) ot_font->vmtx.get_relaxed ()->get_advance (glyph, font)); } @@ -94,7 +91,7 @@ hb_ot_get_glyph_h_kerning (hb_font_t *font, hb_codepoint_t right_glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_x (ot_font->kern->get_h_kerning (left_glyph, right_glyph)); } @@ -105,7 +102,7 @@ hb_ot_get_glyph_extents (hb_font_t *font, hb_glyph_extents_t *extents, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; bool ret = ot_font->glyf->get_extents (glyph, extents); if (!ret) ret = ot_font->CBDT->get_extents (glyph, extents); @@ -124,7 +121,7 @@ hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED, char *name, unsigned int size, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->post->get_glyph_name (glyph, name, size); } @@ -135,7 +132,7 @@ hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->post->get_glyph_from_name (name, len, glyph); } @@ -145,7 +142,7 @@ hb_ot_get_font_h_extents (hb_font_t *font, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; metrics->ascender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->ascender); metrics->descender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->descender); metrics->line_gap = font->em_scale_y (ot_font->hmtx.get_relaxed ()->line_gap); @@ -159,7 +156,7 @@ hb_ot_get_font_v_extents (hb_font_t *font, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; metrics->ascender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->ascender); metrics->descender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->descender); metrics->line_gap = font->em_scale_x (ot_font->vmtx.get_relaxed ()->line_gap); @@ -226,7 +223,7 @@ void hb_ot_font_set_funcs (hb_font_t *font) { if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return; - hb_ot_font_t *ot_font = &hb_ot_face_data (font->face)->table; + hb_ot_face_data_t *ot_font = hb_ot_face_data (font->face); /* Load them lazies. We access them with get_relaxed() for performance. */ ot_font->cmap.get (); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 276353285..8b247704e 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -59,35 +59,35 @@ inline const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); - return *hb_ot_face_data (face)->table.GDEF->table; + return *hb_ot_face_data (face)->GDEF->table; } static hb_blob_t * _get_gsub_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); - return hb_ot_face_data (face)->table.GSUB->blob; + return hb_ot_face_data (face)->GSUB->blob; } static inline const OT::GSUB& _get_gsub (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); - return *hb_ot_face_data (face)->table.GSUB->table; + return *hb_ot_face_data (face)->GSUB->table; } inline const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) { - return *hb_ot_face_data (face)->table.GSUB.get_relaxed ()->table; + return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table; } static hb_blob_t * _get_gpos_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); - return hb_ot_face_data (face)->table.GPOS->blob; + return hb_ot_face_data (face)->GPOS->blob; } static inline const OT::GPOS& _get_gpos (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); - return *hb_ot_face_data (face)->table.GPOS->table; + return *hb_ot_face_data (face)->GPOS->table; } inline const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) { - return *hb_ot_face_data (face)->table.GPOS.get_relaxed ()->table; + return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table; } @@ -614,11 +614,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face, { case HB_OT_TAG_GSUB: { - return hb_ot_face_data (face)->table.GSUB->lookup_count; + return hb_ot_face_data (face)->GSUB->lookup_count; } case HB_OT_TAG_GPOS: { - return hb_ot_face_data (face)->table.GPOS->lookup_count; + return hb_ot_face_data (face)->GPOS->lookup_count; } } return 0; @@ -832,13 +832,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, { case HB_OT_TAG_GSUB: { - const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->table->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } case HB_OT_TAG_GPOS: { - const OT::PosLookup& l = hb_ot_face_data (face)->table.GPOS->table->get_lookup (lookup_index); + const OT::PosLookup& l = hb_ot_face_data (face)->GPOS->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } @@ -911,12 +911,12 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, unsigned int glyphs_length, hb_bool_t zero_context) { - if (unlikely (lookup_index >= hb_ot_face_data (face)->table.GSUB->lookup_count)) return false; + if (unlikely (lookup_index >= hb_ot_face_data (face)->GSUB->lookup_count)) return false; OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); - const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->table->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); - return l.would_apply (&c, &hb_ot_face_data (face)->table.GSUB->accels[lookup_index]); + return l.would_apply (&c, &hb_ot_face_data (face)->GSUB->accels[lookup_index]); } void @@ -1073,8 +1073,8 @@ struct GSUBProxy typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : - table (*hb_ot_face_data (face)->table.GSUB->table), - accels (hb_ot_face_data (face)->table.GSUB->accels) {} + table (*hb_ot_face_data (face)->GSUB->table), + accels (hb_ot_face_data (face)->GSUB->accels) {} const OT::GSUB &table; const hb_ot_layout_lookup_accelerator_t *accels; @@ -1087,8 +1087,8 @@ struct GPOSProxy typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : - table (*hb_ot_face_data (face)->table.GPOS->table), - accels (hb_ot_face_data (face)->table.GPOS->accels) {} + table (*hb_ot_face_data (face)->GPOS->table), + accels (hb_ot_face_data (face)->GPOS->accels) {} const OT::GPOS &table; const hb_ot_layout_lookup_accelerator_t *accels; diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 645c3d62e..c693f4807 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -33,8 +33,8 @@ static inline const OT::MATH& _get_math (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH); - hb_ot_face_data_t * layout = hb_ot_face_data (face); - return *(layout->table.MATH.get ()); + hb_ot_face_data_t * data = hb_ot_face_data (face); + return *(data->MATH.get ()); } /* diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index a2f2d3e51..472ee8452 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -41,14 +41,14 @@ _get_fvar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar); hb_ot_face_data_t *layout = hb_ot_face_data (face); - return *(layout->table.fvar.get ()); + return *(layout->fvar.get ()); } static inline const OT::avar& _get_avar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar); hb_ot_face_data_t *layout = hb_ot_face_data (face); - return *(layout->table.avar.get ()); + return *(layout->avar.get ()); } /** From 2dde6c803a9e50c5bff74095187b0cb2e12eebdd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Aug 2018 11:02:00 -0700 Subject: [PATCH 44/47] Explicitly pass reference in hb_auto_t constructor Fixes clang bots as well as fuzzer issue. --- src/hb-dsalgs.hh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index ec5708eb7..8c910748b 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -492,7 +492,14 @@ template struct hb_auto_t : Type { hb_auto_t (void) { Type::init (); } - template hb_auto_t (T1 t1) { Type::init (t1); } + /* Explicitly allow the following only for pointer and references, + * to avoid any accidental copies. + * + * Apparently if we template for all types, then gcc seems to + * capture a reference argument in the type, but clang doesn't, + * causing unwanted copies and bugs that come with it. */ + template hb_auto_t (T1 *t1) { Type::init (t1); } + template hb_auto_t (T1 &t1) { Type::init (t1); } ~hb_auto_t (void) { Type::fini (); } private: /* Hide */ void init (void) {} From c0a3f38f78362a183b30afd109dcebfca563d144 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Aug 2018 17:22:38 -0700 Subject: [PATCH 45/47] Fix distcheck --- src/Makefile.sources | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Makefile.sources b/src/Makefile.sources index 0d975383c..97efda227 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -209,9 +209,12 @@ HB_ICU_headers = hb-icu.h HB_SUBSET_sources = \ hb-static.cc \ hb-subset.cc \ + hb-subset.hh \ hb-subset-glyf.cc \ + hb-subset-glyf.hh \ hb-subset-input.cc \ hb-subset-plan.cc \ + hb-subset-plan.hh \ $(NULL) HB_SUBSET_headers = \ From 967741e4c468ebf0a40f91934ed1923506099806 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Aug 2018 18:18:02 -0700 Subject: [PATCH 46/47] Add explicit to hb_auto_t 1param constructors --- src/hb-dsalgs.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 8c910748b..7e06ff170 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -497,9 +497,10 @@ struct hb_auto_t : Type * * Apparently if we template for all types, then gcc seems to * capture a reference argument in the type, but clang doesn't, - * causing unwanted copies and bugs that come with it. */ - template hb_auto_t (T1 *t1) { Type::init (t1); } - template hb_auto_t (T1 &t1) { Type::init (t1); } + * causing unwanted copies and bugs that come with it. Ideally + * we should use C++11-style rvalue reference &&t1. */ + template explicit hb_auto_t (T1 *t1) { Type::init (t1); } + template explicit hb_auto_t (T1 &t1) { Type::init (t1); } ~hb_auto_t (void) { Type::fini (); } private: /* Hide */ void init (void) {} From fee0f41c6c1e50621d10b07802ca36a9b295b53d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Aug 2018 18:27:41 -0700 Subject: [PATCH 47/47] Don't declare extern symbols as inline clang -O3 was completely removing _get_gdef(), causing link failure when needed from another compilation unit. Surprisingly, "extern inline" didn't fix it. --- src/hb-ot-layout.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 8b247704e..345078917 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -56,7 +56,7 @@ // return *(data->base.get ()); // } -inline const OT::GDEF& _get_gdef (hb_face_t *face) +const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); return *hb_ot_face_data (face)->GDEF->table; @@ -71,7 +71,7 @@ static inline const OT::GSUB& _get_gsub (hb_face_t *face) if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); return *hb_ot_face_data (face)->GSUB->table; } -inline const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) +const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) { return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table; } @@ -85,7 +85,7 @@ static inline const OT::GPOS& _get_gpos (hb_face_t *face) if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); return *hb_ot_face_data (face)->GPOS->table; } -inline const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) +const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) { return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table; }