[ot] Minor

This commit is contained in:
Behdad Esfahbod 2018-08-03 16:22:16 -07:00
parent 6a0a298aab
commit 52fbd23d86
7 changed files with 27 additions and 26 deletions

View 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;
}

View 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;

View 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;

View 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;
};

View 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);
}

View 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 ());
}
/*

View 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 ());
}
/**