[ot] Move GDEF into tables_t

This commit is contained in:
Behdad Esfahbod 2018-08-03 16:57:40 -07:00
parent 0271c7ab3b
commit 74b4df2cde
5 changed files with 14 additions and 18 deletions

View File

@ -633,6 +633,12 @@ struct hb_base_lazy_loader_t
return p;
}
inline void set_stored (Stored *instance_)
{
assert (instance == nullptr);
instance = instance_;
}
inline const Returned * get (void) const
{
return thiz ()->convert (get_stored ());

View 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)->gdef;
const GDEF &gdef = *hb_ot_layout_from_face (font->face)->table.GDEF;
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
{

View 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)->gdef),
gdef (*hb_ot_layout_from_face (face)->table.GDEF),
var_store (gdef.get_var_store ()),
direction (buffer_->props.direction),
lookup_mask (1),

View File

@ -146,9 +146,6 @@ namespace OT {
struct BASE;
struct COLR;
struct CPAL;
struct GDEF;
struct GSUB;
struct GPOS;
}
namespace AAT {
@ -158,6 +155,7 @@ namespace AAT {
}
#define HB_OT_LAYOUT_TABLES \
HB_OT_LAYOUT_TABLE(OT, GDEF) \
HB_OT_LAYOUT_TABLE(OT, GSUB) \
HB_OT_LAYOUT_TABLE(OT, GPOS) \
HB_OT_LAYOUT_TABLE(OT, MATH) \
@ -172,9 +170,6 @@ HB_OT_LAYOUT_TABLES
struct hb_ot_layout_t
{
hb_blob_t *gdef_blob;
const struct OT::GDEF *gdef;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;

View File

@ -170,18 +170,15 @@ _hb_ot_layout_create (hb_face_t *face)
if (unlikely (!layout))
return nullptr;
layout->gdef_blob = hb_sanitize_context_t ().reference_table<OT::GDEF> (face);
layout->gdef = layout->gdef_blob->as<OT::GDEF> ();
layout->table.init0 (face);
const OT::GSUB &gsub = *layout->table.GSUB;
const OT::GPOS &gpos = *layout->table.GPOS;
if (_hb_ot_blacklist_gdef (layout->gdef_blob->length,
layout->table.GSUB.get_blob()->length,
layout->table.GPOS.get_blob()->length))
layout->gdef = &Null(OT::GDEF);
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 ());
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 ();
@ -217,8 +214,6 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
free (layout->gsub_accels);
free (layout->gpos_accels);
hb_blob_destroy (layout->gdef_blob);
layout->table.fini ();
free (layout);
@ -236,7 +231,7 @@ 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)->gdef;
return *hb_ot_layout_from_face (face)->table.GDEF;
}
static inline const OT::GSUB&
_get_gsub (hb_face_t *face)