[ot] Minor
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 3 Aug 2018 23:22:16 +0000 (16:22 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 3 Aug 2018 23:22:16 +0000 (16:22 -0700)
src/hb-aat-layout.cc
src/hb-face-private.hh
src/hb-machinery-private.hh
src/hb-ot-layout-private.hh
src/hb-ot-layout.cc
src/hb-ot-math.cc
src/hb-ot-var.cc

index 3417033..36d4037 100644 (file)
@@ -52,9 +52,9 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
     return Null(AAT::morx);
   }
   hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
-  const AAT::morx& morx = *(layout->morx.get ());
+  const AAT::morx& morx = *(layout->table.morx.get ());
   if (blob)
-    *blob = layout->morx.get_blob ();
+    *blob = layout->table.morx.get_blob ();
   return morx;
 }
 
index fe3b8b2..73a6846 100644 (file)
@@ -55,16 +55,13 @@ struct hb_face_t {
 
   struct hb_shaper_data_t shaper_data; /* Various shaper data. */
 
-  /* Various non-shaping data. */
-  /* ... */
-
   /* Cache */
-  struct plan_node_t {
+  struct plan_node_t
+  {
     hb_shape_plan_t *shape_plan;
     plan_node_t *next;
   } *shape_plans;
 
-
   inline hb_blob_t *reference_table (hb_tag_t tag) const
   {
     hb_blob_t *blob;
index 40e4207..ec7a0da 100644 (file)
@@ -602,6 +602,7 @@ struct hb_base_lazy_loader_t
   inline const Subclass* thiz (void) const { return static_cast<const Subclass *> (this); }
   inline Subclass* thiz (void) { return static_cast<Subclass *> (this); }
 
+  inline void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */
   inline void init (void)
   {
     instance = nullptr;
index 64c6e22..8222a3f 100644 (file)
@@ -177,12 +177,15 @@ struct hb_ot_layout_t
   hb_ot_layout_lookup_accelerator_t *gsub_accels;
   hb_ot_layout_lookup_accelerator_t *gpos_accels;
 
-  /* TODO Move the following out of this struct. */
-  hb_face_t *face; /* MUST be JUST before the lazy loaders. */
-  hb_table_lazy_loader_t<1, struct OT::MATH> math;
-  hb_table_lazy_loader_t<2, struct OT::fvar> fvar;
-  hb_table_lazy_loader_t<3, struct OT::avar> avar;
-  hb_table_lazy_loader_t<4, struct AAT::morx> morx;
+  /* Various non-shaping tables. */
+  struct tables_t
+  {
+    hb_face_t *face; /* MUST be JUST before the lazy loaders. */
+    hb_table_lazy_loader_t<1, struct OT::MATH> math;
+    hb_table_lazy_loader_t<2, struct OT::fvar> fvar;
+    hb_table_lazy_loader_t<3, struct OT::avar> avar;
+    hb_table_lazy_loader_t<4, struct AAT::morx> morx;
+  } table;
 };
 
 
index c60b275..6af6495 100644 (file)
@@ -31,6 +31,7 @@
 #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-ot-layout-gdef-table.hh"
 #include "hb-ot-layout-gsub-table.hh"
@@ -44,7 +45,6 @@
 #include "hb-ot-color-sbix-table.hh"
 #include "hb-ot-color-svg-table.hh"
 #include "hb-ot-name-table.hh"
-#include "hb-map-private.hh"
 
 
 static bool
@@ -165,11 +165,11 @@ _hb_ot_layout_create (hb_face_t *face)
   layout->gpos_blob = hb_sanitize_context_t ().reference_table<OT::GPOS> (face);
   layout->gpos = layout->gpos_blob->as<OT::GPOS> ();
 
-  layout->face = face;
-  layout->math.init ();
-  layout->fvar.init ();
-  layout->avar.init ();
-  layout->morx.init ();
+  layout->table.face = face;
+  layout->table.math.init0 ();
+  layout->table.fvar.init0 ();
+  layout->table.avar.init0 ();
+  layout->table.morx.init0 ();
 
   if (_hb_ot_blacklist_gdef (layout->gdef_blob->length,
                             layout->gsub_blob->length,
@@ -214,10 +214,10 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
   hb_blob_destroy (layout->gsub_blob);
   hb_blob_destroy (layout->gpos_blob);
 
-  layout->math.fini ();
-  layout->fvar.fini ();
-  layout->avar.fini ();
-  layout->morx.fini ();
+  layout->table.math.fini ();
+  layout->table.fvar.fini ();
+  layout->table.avar.fini ();
+  layout->table.morx.fini ();
 
   free (layout);
 }
index 1667a7d..3e4ab75 100644 (file)
@@ -34,7 +34,7 @@ _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);
-  return *(layout->math.get ());
+  return *(layout->table.math.get ());
 }
 
 /*
index f0612a6..366860d 100644 (file)
@@ -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_layout_t * layout = hb_ot_layout_from_face (face);
-  return *(layout->fvar.get ());
+  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);
-  return *(layout->avar.get ());
+  return *(layout->table.avar.get ());
 }
 
 /**