Initialize set digests
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 17 Apr 2013 01:50:33 +0000 (21:50 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 17 Apr 2013 01:57:35 +0000 (21:57 -0400)
We were not initializing the digests properly and as a result they were
being initialized to zero, making digest1 to never do any useful work.

Speeds up Amiri shaping significantly.

src/hb-ot-layout.cc
src/hb-ot-shape-complex-arabic-fallback.hh

index 8161ce3..c80ca7d 100644 (file)
@@ -70,9 +70,15 @@ _hb_ot_layout_create (hb_face_t *face)
   }
 
   for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
+  {
+    layout->gsub_digests[i].init ();
     layout->gsub->get_lookup (i).add_coverage (&layout->gsub_digests[i]);
+  }
   for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
+  {
+    layout->gpos_digests[i].init ();
     layout->gpos->get_lookup (i).add_coverage (&layout->gpos_digests[i]);
+  }
 
   return layout;
 }
index 5e151f7..996e40e 100644 (file)
@@ -212,7 +212,9 @@ arabic_fallback_plan_create (const hb_ot_shape_plan_t *plan,
   if (unlikely (!fallback_plan))
     return const_cast<arabic_fallback_plan_t *> (&arabic_fallback_plan_nil);
 
-  for (unsigned int i = 0; i < ARABIC_NUM_FALLBACK_FEATURES; i++) {
+  for (unsigned int i = 0; i < ARABIC_NUM_FALLBACK_FEATURES; i++)
+  {
+    fallback_plan->digest_array[i].init ();
     fallback_plan->mask_array[i] = plan->map.get_1_mask (arabic_fallback_features[i]);
     if (fallback_plan->mask_array[i]) {
       fallback_plan->lookup_array[i] = arabic_fallback_synthesize_lookup (plan, font, i);