提交 74b4df2c 编写于 作者: B Behdad Esfahbod

[ot] Move GDEF into tables_t

上级 0271c7ab
...@@ -633,6 +633,12 @@ struct hb_base_lazy_loader_t ...@@ -633,6 +633,12 @@ struct hb_base_lazy_loader_t
return p; return p;
} }
inline void set_stored (Stored *instance_)
{
assert (instance == nullptr);
instance = instance_;
}
inline const Returned * get (void) const inline const Returned * get (void) const
{ {
return thiz ()->convert (get_stored ()); return thiz ()->convert (get_stored ());
......
...@@ -1335,7 +1335,7 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) ...@@ -1335,7 +1335,7 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
{ {
_hb_buffer_assert_gsubgpos_vars (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; unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
......
...@@ -480,7 +480,7 @@ struct hb_ot_apply_context_t : ...@@ -480,7 +480,7 @@ struct hb_ot_apply_context_t :
iter_input (), iter_context (), iter_input (), iter_context (),
font (font_), face (font->face), buffer (buffer_), font (font_), face (font->face), buffer (buffer_),
recurse_func (nullptr), 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 ()), var_store (gdef.get_var_store ()),
direction (buffer_->props.direction), direction (buffer_->props.direction),
lookup_mask (1), lookup_mask (1),
......
...@@ -146,9 +146,6 @@ namespace OT { ...@@ -146,9 +146,6 @@ namespace OT {
struct BASE; struct BASE;
struct COLR; struct COLR;
struct CPAL; struct CPAL;
struct GDEF;
struct GSUB;
struct GPOS;
} }
namespace AAT { namespace AAT {
...@@ -158,6 +155,7 @@ namespace AAT { ...@@ -158,6 +155,7 @@ namespace AAT {
} }
#define HB_OT_LAYOUT_TABLES \ #define HB_OT_LAYOUT_TABLES \
HB_OT_LAYOUT_TABLE(OT, GDEF) \
HB_OT_LAYOUT_TABLE(OT, GSUB) \ HB_OT_LAYOUT_TABLE(OT, GSUB) \
HB_OT_LAYOUT_TABLE(OT, GPOS) \ HB_OT_LAYOUT_TABLE(OT, GPOS) \
HB_OT_LAYOUT_TABLE(OT, MATH) \ HB_OT_LAYOUT_TABLE(OT, MATH) \
...@@ -172,9 +170,6 @@ HB_OT_LAYOUT_TABLES ...@@ -172,9 +170,6 @@ HB_OT_LAYOUT_TABLES
struct hb_ot_layout_t struct hb_ot_layout_t
{ {
hb_blob_t *gdef_blob;
const struct OT::GDEF *gdef;
unsigned int gsub_lookup_count; unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count; unsigned int gpos_lookup_count;
......
...@@ -170,18 +170,15 @@ _hb_ot_layout_create (hb_face_t *face) ...@@ -170,18 +170,15 @@ _hb_ot_layout_create (hb_face_t *face)
if (unlikely (!layout)) if (unlikely (!layout))
return nullptr; 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); layout->table.init0 (face);
const OT::GSUB &gsub = *layout->table.GSUB; const OT::GSUB &gsub = *layout->table.GSUB;
const OT::GPOS &gpos = *layout->table.GPOS; const OT::GPOS &gpos = *layout->table.GPOS;
if (_hb_ot_blacklist_gdef (layout->gdef_blob->length, if (unlikely (_hb_ot_blacklist_gdef (layout->table.GDEF.get_blob ()->length,
layout->table.GSUB.get_blob()->length, layout->table.GSUB.get_blob ()->length,
layout->table.GPOS.get_blob()->length)) layout->table.GPOS.get_blob ()->length)))
layout->gdef = &Null(OT::GDEF); layout->table.GDEF.set_stored (hb_blob_get_empty ());
unsigned int gsub_lookup_count = layout->gsub_lookup_count = gsub.get_lookup_count (); 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 gpos_lookup_count = layout->gpos_lookup_count = gpos.get_lookup_count ();
...@@ -217,8 +214,6 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout) ...@@ -217,8 +214,6 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
free (layout->gsub_accels); free (layout->gsub_accels);
free (layout->gpos_accels); free (layout->gpos_accels);
hb_blob_destroy (layout->gdef_blob);
layout->table.fini (); layout->table.fini ();
free (layout); free (layout);
...@@ -236,7 +231,7 @@ static inline const OT::GDEF& ...@@ -236,7 +231,7 @@ static inline const OT::GDEF&
_get_gdef (hb_face_t *face) _get_gdef (hb_face_t *face)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); 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& static inline const OT::GSUB&
_get_gsub (hb_face_t *face) _get_gsub (hb_face_t *face)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册