[ot] Rename hb_ot_layout_t to hb_ot_face_data_t
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 16 Aug 2018 03:12:25 +0000 (20:12 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 23 Aug 2018 18:30:21 +0000 (11:30 -0700)
src/hb-aat-layout.cc
src/hb-ot-color.cc
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-private.hh
src/hb-ot-layout.cc
src/hb-ot-math.cc
src/hb-ot-shape.cc
src/hb-ot-var.cc

index 36d4037..fc706d6 100644 (file)
@@ -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<AAT::morx> (face);
-//   morx_blob->as<AAT::morx> ();
-
-//   if (0)
-//   {
-//     morx_blob->as<AAT::Lookup<OT::GlyphID> > ()->get_value (1, face->get_num_glyphs ());
-//   }
-// }
-
 void
 hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
 {
index 86171c6..44550d7 100644 (file)
@@ -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 ());
 }
 
 
index fe34a32..95bc588 100644 (file)
@@ -1628,15 +1628,13 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
 template <typename context_t>
 /*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);
index 1d5a02a..a2f78b8 100644 (file)
@@ -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 <typename context_t>
 /*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);
index 40a2fc4..9b1a19f 100644 (file)
@@ -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),
index 612bc7f..8f1e2c9 100644 (file)
@@ -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 ())
 
 
 /*
index 09ff0e6..09f0343 100644 (file)
@@ -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;
index 66ce207..ead6259 100644 (file)
@@ -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 ());
 }
 
index 71632b5..91ac28f 100644 (file)
@@ -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);
 }
 
 
index 6081ddf..5b890a3 100644 (file)
@@ -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 ());
 }