[ot-face] Simplify more table access

This commit is contained in:
Behdad Esfahbod 2018-11-05 23:08:33 -05:00
parent a35c92cbe7
commit 0fe7a745c9
4 changed files with 21 additions and 26 deletions

View File

@ -552,7 +552,7 @@ hb_face_collect_unicodes (hb_face_t *face,
hb_set_t *out) hb_set_t *out)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
hb_ot_face_data (face)->cmap->collect_unicodes (out); face->table.cmap->collect_unicodes (out);
} }
/** /**
@ -569,7 +569,7 @@ hb_face_collect_variation_selectors (hb_face_t *face,
hb_set_t *out) hb_set_t *out)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
hb_ot_face_data (face)->cmap->collect_variation_selectors (out); face->table.cmap->collect_variation_selectors (out);
} }
/** /**
@ -587,7 +587,7 @@ hb_face_collect_variation_unicodes (hb_face_t *face,
hb_set_t *out) hb_set_t *out)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
hb_ot_face_data (face)->cmap->collect_variation_unicodes (variation_selector, out); face->table.cmap->collect_variation_unicodes (variation_selector, out);
} }

View File

@ -34,9 +34,6 @@
#include "hb-machinery.hh" #include "hb-machinery.hh"
#define hb_ot_face_data(face) (&face->table)
/* /*
* hb_ot_face_t * hb_ot_face_t
*/ */

View File

@ -299,10 +299,8 @@ void
hb_ot_font_set_funcs (hb_font_t *font) hb_ot_font_set_funcs (hb_font_t *font)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return; if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return;
hb_ot_face_t *ot_face = hb_ot_face_data (font->face);
hb_font_set_funcs (font, hb_font_set_funcs (font,
_hb_ot_get_font_funcs (), _hb_ot_get_font_funcs (),
ot_face, &font->face->table,
nullptr); nullptr);
} }

View File

@ -56,35 +56,35 @@
const OT::GDEF& _get_gdef (hb_face_t *face) const OT::GDEF& _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_face_data (face)->GDEF->table; return *face->table.GDEF->table;
} }
static hb_blob_t * _get_gsub_blob (hb_face_t *face) static hb_blob_t * _get_gsub_blob (hb_face_t *face)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty ();
return hb_ot_face_data (face)->GSUB->blob; return face->table.GSUB->blob;
} }
static inline const OT::GSUB& _get_gsub (hb_face_t *face) static inline const OT::GSUB& _get_gsub (hb_face_t *face)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB);
return *hb_ot_face_data (face)->GSUB->table; return *face->table.GSUB->table;
} }
const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) const OT::GSUB& _get_gsub_relaxed (hb_face_t *face)
{ {
return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table; return *face->table.GSUB.get_relaxed ()->table;
} }
static hb_blob_t * _get_gpos_blob (hb_face_t *face) static hb_blob_t * _get_gpos_blob (hb_face_t *face)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty ();
return hb_ot_face_data (face)->GPOS->blob; return face->table.GPOS->blob;
} }
static inline const OT::GPOS& _get_gpos (hb_face_t *face) static inline const OT::GPOS& _get_gpos (hb_face_t *face)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS);
return *hb_ot_face_data (face)->GPOS->table; return *face->table.GPOS->table;
} }
const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) const OT::GPOS& _get_gpos_relaxed (hb_face_t *face)
{ {
return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table; return *face->table.GPOS.get_relaxed ()->table;
} }
@ -877,13 +877,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
{ {
case HB_OT_TAG_GSUB: case HB_OT_TAG_GSUB:
{ {
const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index);
l.collect_glyphs (&c); l.collect_glyphs (&c);
return; return;
} }
case HB_OT_TAG_GPOS: case HB_OT_TAG_GPOS:
{ {
const OT::PosLookup& l = hb_ot_face_data (face)->GPOS->table->get_lookup (lookup_index); const OT::PosLookup& l = face->table.GPOS->table->get_lookup (lookup_index);
l.collect_glyphs (&c); l.collect_glyphs (&c);
return; return;
} }
@ -956,12 +956,12 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face,
unsigned int glyphs_length, unsigned int glyphs_length,
hb_bool_t zero_context) hb_bool_t zero_context)
{ {
if (unlikely (lookup_index >= hb_ot_face_data (face)->GSUB->lookup_count)) return false; if (unlikely (lookup_index >= face->table.GSUB->lookup_count)) return false;
OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context);
const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index);
return l.would_apply (&c, &hb_ot_face_data (face)->GSUB->accels[lookup_index]); return l.would_apply (&c, &face->table.GSUB->accels[lookup_index]);
} }
void void
@ -1240,8 +1240,8 @@ struct GSUBProxy
typedef OT::SubstLookup Lookup; typedef OT::SubstLookup Lookup;
GSUBProxy (hb_face_t *face) : GSUBProxy (hb_face_t *face) :
table (*hb_ot_face_data (face)->GSUB->table), table (*face->table.GSUB->table),
accels (hb_ot_face_data (face)->GSUB->accels) {} accels (face->table.GSUB->accels) {}
const OT::GSUB &table; const OT::GSUB &table;
const OT::hb_ot_layout_lookup_accelerator_t *accels; const OT::hb_ot_layout_lookup_accelerator_t *accels;
@ -1254,8 +1254,8 @@ struct GPOSProxy
typedef OT::PosLookup Lookup; typedef OT::PosLookup Lookup;
GPOSProxy (hb_face_t *face) : GPOSProxy (hb_face_t *face) :
table (*hb_ot_face_data (face)->GPOS->table), table (*face->table.GPOS->table),
accels (hb_ot_face_data (face)->GPOS->accels) {} accels (face->table.GPOS->accels) {}
const OT::GPOS &table; const OT::GPOS &table;
const OT::hb_ot_layout_lookup_accelerator_t *accels; const OT::hb_ot_layout_lookup_accelerator_t *accels;
@ -1414,7 +1414,7 @@ hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
static const OT::BASE& _get_base (hb_face_t *face) static const OT::BASE& _get_base (hb_face_t *face)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE); if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE);
return *hb_ot_face_data (face)->BASE; return *face->table.BASE;
} }
hb_bool_t hb_bool_t