From 24dd4e56743c6ce5e01cb710ca9e01b3e527af58 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 23 Aug 2012 15:47:10 -0400 Subject: [PATCH] [Indic/GSUB] Ignore context when matching would_apply() The MS Indic specs say "...all classifications are determined ... using context-free substitutions." However, testing shows that MS's Malayalam shapers (both old and new), "match" even if there is no zero-context rule. We follow. Fixes below-base La (eg. Pa,H,La) with AnjaliNewLipi.ttf (old spec). Moreover, test suite Malayalam failures are down to 312 from 875! No change in other scripts. Current numbers: BENGALI: 353996 out of 354285 tests passed. 289 failed (0.0815727%) DEVANAGARI: 707339 out of 707394 tests passed. 55 failed (0.00777502%) GUJARATI: 366489 out of 366506 tests passed. 17 failed (0.0046384%) GURMUKHI: 60769 out of 60809 tests passed. 40 failed (0.0657797%) KANNADA: 951086 out of 951913 tests passed. 827 failed (0.0868777%) KHMER: 299106 out of 299124 tests passed. 18 failed (0.00601757%) LAO: 53611 out of 53644 tests passed. 33 failed (0.0615167%) MALAYALAM: 1047541 out of 1048416 tests passed. 875 failed (0.0834592%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271726 out of 271847 tests passed. 121 failed (0.0445103%) TAMIL: 1091837 out of 1091837 tests passed. 0 failed (0%) TELUGU: 970558 out of 970573 tests passed. 15 failed (0.00154548%) TIBETAN: 208469 out of 208469 tests passed. 0 failed (0%) --- src/hb-ot-layout-gsubgpos-private.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index ba2a7e0e1..5b0276f1f 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -1066,9 +1066,11 @@ static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c const LookupRecord lookupRecord[], ChainContextApplyLookupContext &lookup_context) { - return !backtrackCount - && !lookaheadCount - && would_match_input (c, + /* The MS Indic specs say "...all classifications are determined ... using context-free substitutions." + * However, testing shows that MS's Malayalam shapers (both old and new), "match" even if there is no + * zero-context rule. We follow. Hence the commented out line. */ + return /* !backtrackCount && !lookaheadCount && */ + would_match_input (c, inputCount, input, lookup_context.funcs.match, lookup_context.match_data[1]); }