[aat] Wire up 'ankr' table to apply context

This commit is contained in:
Behdad Esfahbod 2018-10-11 00:52:07 -04:00
parent 28f0367aab
commit 7bb4da7d95
2 changed files with 12 additions and 3 deletions

View File

@ -514,6 +514,7 @@ struct StateTableDriver
};
struct ankr;
struct hb_aat_apply_context_t :
hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
@ -529,6 +530,7 @@ struct hb_aat_apply_context_t :
hb_face_t *face;
hb_buffer_t *buffer;
hb_sanitize_context_t sanitizer;
const ankr &ankr_table;
/* Unused. For debug tracing only. */
unsigned int lookup_index;
@ -537,9 +539,10 @@ struct hb_aat_apply_context_t :
inline hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_,
hb_font_t *font_,
hb_buffer_t *buffer_,
hb_blob_t *table) :
hb_blob_t *table,
const ankr &ankr_table_ = Null(ankr)) :
plan (plan_), font (font_), face (font->face), buffer (buffer_),
sanitizer (), lookup_index (0), debug_depth (0)
sanitizer (), ankr_table (ankr_table_), lookup_index (0), debug_depth (0)
{
sanitizer.init (table);
sanitizer.set_num_glyphs (face->get_num_glyphs ());

View File

@ -68,6 +68,12 @@ _get_kerx (hb_face_t *face, hb_blob_t **blob = nullptr)
*blob = hb_ot_face_data (face)->kerx.get_blob ();
return kerx;
}
static inline const AAT::ankr&
_get_ankr (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(AAT::ankr);
return *(hb_ot_face_data (face)->ankr.get ());
}
hb_bool_t
@ -103,6 +109,6 @@ hb_aat_layout_position (hb_ot_shape_plan_t *plan,
hb_blob_t *blob;
const AAT::kerx& kerx = _get_kerx (font->face, &blob);
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
AAT::hb_aat_apply_context_t c (plan, font, buffer, blob, _get_ankr (font->face));
kerx.apply (&c);
}