[aat] Wire up 'ankr' table to apply context
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 11 Oct 2018 04:52:07 +0000 (00:52 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 11 Oct 2018 04:52:07 +0000 (00:52 -0400)
src/hb-aat-layout-common.hh
src/hb-aat-layout.cc

index 37ab535..dada9c7 100644 (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 ());
index 3fd4f9f..47462ad 100644 (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);
 }