From 52fbd23d868a989d51b7df5be40be582890d13e5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 3 Aug 2018 16:22:16 -0700 Subject: [PATCH] [ot] Minor --- src/hb-aat-layout.cc | 4 ++-- src/hb-face-private.hh | 7 ++----- src/hb-machinery-private.hh | 1 + src/hb-ot-layout-private.hh | 15 +++++++++------ src/hb-ot-layout.cc | 20 ++++++++++---------- src/hb-ot-math.cc | 2 +- src/hb-ot-var.cc | 4 ++-- 7 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 3417033fa..36d4037ad 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -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; } diff --git a/src/hb-face-private.hh b/src/hb-face-private.hh index fe3b8b240..73a684616 100644 --- a/src/hb-face-private.hh +++ b/src/hb-face-private.hh @@ -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; diff --git a/src/hb-machinery-private.hh b/src/hb-machinery-private.hh index 40e42071f..ec7a0da1a 100644 --- a/src/hb-machinery-private.hh +++ b/src/hb-machinery-private.hh @@ -602,6 +602,7 @@ struct hb_base_lazy_loader_t inline const Subclass* thiz (void) const { return static_cast (this); } inline Subclass* thiz (void) { return static_cast (this); } + inline void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */ inline void init (void) { instance = nullptr; diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 64c6e22ff..8222a3fc3 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -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; }; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index c60b27504..6af649529 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -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 (face); layout->gpos = layout->gpos_blob->as (); - 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); } diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 1667a7da8..3e4ab7565 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -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 ()); } /* diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index f0612a611..366860d56 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_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 ()); } /**