[HarfBuzz] patch for apply_lookup (applying contextual lookups)

Jonathan Kew jfkthame at googlemail.com
Sat Sep 28 09:09:43 PDT 2013


Hi Behdad,

I've been experimenting a bit with Noto Devanagari, and come up with the 
attached change to apply_lookup(). This fixes the problem where we were 
advancing too far during processing the contextual lookups for the first 
syllable, and hence missing the application of the same lookup at the 
first glyph of the next syllable.

This greatly improves the results for the Noto Devanagari font (e.g. 
Hindi failures down from 2.57% to 0.408%), as well as for Gujarati 
(2.57% down to 1.08%) and Kannada (27.2% down to 0.095%!) which have 
similar issues. The other Noto fonts are unaffected by the change; I 
haven't tested against other font collections yet.

Anyhow, please have a look and see if this makes sense at all. I'm far 
from confident that I actually understand what's going among in all 
these subtables and recursive lookup calls.....

JK
-------------- next part --------------
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 316f506..8cd6236 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -1037,13 +1037,13 @@ static inline bool apply_lookup (hb_apply_context_t *c,
     c->buffer->next_glyph ();
     i++;
   }
-  while (i < count)
+  while (lookupCount && i < count)
   {
     if (!skippy_iter.next ()) return TRACE_RETURN (true);
     while (c->buffer->idx < skippy_iter.idx)
       c->buffer->next_glyph ();
 
-    if (lookupCount && i == lookupRecord->sequenceIndex)
+    if (i == lookupRecord->sequenceIndex)
     {
       unsigned int old_pos = c->buffer->idx;
 


More information about the HarfBuzz mailing list