diff --git a/c/makeotf/makeotf_lib/api/hotconv.h b/c/makeotf/makeotf_lib/api/hotconv.h
index 829e5d696..3b69498fe 100644
--- a/c/makeotf/makeotf_lib/api/hotconv.h
+++ b/c/makeotf/makeotf_lib/api/hotconv.h
@@ -11,7 +11,7 @@ This software is licensed as OpenSource, under the Apache License, Version 2.0.
extern "C" {
#endif
-#define HOT_VERSION 0x01006C /* Library version (1.0.108) */
+#define HOT_VERSION 0x01006D /* Library version (1.0.109) */
/* Major, minor, build = (HOT_VERSION >> 16) & 0xff, (HOT_VERSION >> 8) & 0xff, HOT_VERSION & 0xff) */
/*Warning: this string is now part of heuristic used by CoolType to identify the
first round of CoolType fonts which had the backtrack sequence of a chaining
diff --git a/c/makeotf/makeotf_lib/source/hotconv/GSUB.c b/c/makeotf/makeotf_lib/source/hotconv/GSUB.c
index f9595b9ff..41c4f0a22 100644
--- a/c/makeotf/makeotf_lib/source/hotconv/GSUB.c
+++ b/c/makeotf/makeotf_lib/source/hotconv/GSUB.c
@@ -2228,8 +2228,7 @@ static Label addAnonRule(hotCtx g, GSUBCtx h, GNode *pMarked, unsigned nMarked,
int i = h->anonSubtable.cnt;
si = dnaINDEX(h->anonSubtable, i - 1);
- /* Don't need to match lkpFlag */
- if (si->lkpType == lkpType && addToAnonSubtbl(g, h, si, targCp, replCp)) {
+ if ((si->lkpType == lkpType) && (si->lkpFlag == lkpFlag) && (si->markSetIndex == markSetIndex) && addToAnonSubtbl(g, h, si, targCp, replCp)) {
return si->label;
}
}
diff --git a/tests/makeotf_data/expected_output/bug196.ttx b/tests/makeotf_data/expected_output/bug196.ttx
new file mode 100644
index 000000000..6c483abff
--- /dev/null
+++ b/tests/makeotf_data/expected_output/bug196.ttx
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/makeotf_data/input/bug196/bug196.fea b/tests/makeotf_data/input/bug196/bug196.fea
new file mode 100644
index 000000000..5e5da152b
--- /dev/null
+++ b/tests/makeotf_data/input/bug196/bug196.fea
@@ -0,0 +1,28 @@
+languagesystem DFLT dflt;
+
+@base_glyphs = [a b c];
+
+@above_base = [caron caron.alt];
+@below_base = [commabelowcmb brevebelowcmb];
+
+feature test {
+
+ lookup one {
+ lookupflag UseMarkFilteringSet @above_base;
+
+ sub a' @base_glyphs b by c;
+ } one;
+
+ lookup two {
+ lookupflag UseMarkFilteringSet @below_base;
+
+ sub b' @base_glyphs c by b;
+ } two;
+
+ lookup three {
+ lookupflag UseMarkFilteringSet @below_base;
+
+ sub a @base_glyphs c' by a;
+ } three;
+
+} test;
diff --git a/tests/makeotf_data/input/bug196/bug196.pfa b/tests/makeotf_data/input/bug196/bug196.pfa
new file mode 100644
index 000000000..84a24f5d4
--- /dev/null
+++ b/tests/makeotf_data/input/bug196/bug196.pfa
@@ -0,0 +1,94 @@
+%!FontType1-1.1: SourceSerifPro-Regular 1.0
+%ADOt1write: (1.0.34)
+%%BeginResource: font SourceSerifPro-Regular
+12 dict dup begin
+/FontType 1 def
+/FontName /SourceSerifPro-Regular def
+/FontInfo 7 dict dup begin
+/version (1.0) def
+/Notice (Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.) def
+/Copyright (Copyright 2014 Adobe Systems Incorporated. All Rights Reserved.) def
+/FamilyName (Source Serif Pro) def
+end def
+/PaintType 0 def
+/FontMatrix [0.001 0 0 0.001 0 0] def
+/Encoding 256 array
+0 1 255 {1 index exch /.notdef put} for
+def
+/FontBBox {-151 -251 560 740} def
+end
+currentfile eexec BAB431EA06BB0A1031E1AA11919E714AC69FC6474167B6
+17C8FF56014245E5C1290C81D5312994CDC47B07C655DDD53C35D530C44F953F
+804152D5ED7591016D3D1968FC4A9F629E0ADB83B91691E8A0AB81C098760580
+FFC73B03E534FD00C1C69885C6151AADEBF9BBF7284F088A81EB0A35C6F197CE
+C173C8CE58E9B3FBEBF7D49545999FA57A7A5A1B26B5A043EFA3B327BCA94F18
+86E0147BE33716D304B24CEB7E89D8626444FA1EE116EEBDBB6E33ADDEEFE14E
+2DC12D84FE2170D0C1780958ED3BA07FA26741A6FE7B905C5C7EEBF87FCB87C1
+152EDB0A053EABFA5158B67F1A5FCAB305A3629E5742EFE1F03AC8B914674ACF
+3561EFE1F3F63FF9DBDD6BB3656F8CAC8FBFED6BD0268D01803B872E3A013E37
+5E2A88A23DC6AC16C2DD6BA37DCBFCFB2BE8BC3C0D50AC62B7BDA8EC036FA5B7
+B6FDC19EE2F7A8DFDAAAB8848D2767B945658D7A76FC1DC150D2C7C4D439E4C6
+5AE8D4C78D4753139A826042642E768DC6BA0A299C7AE0A73D34103BBAFC28DF
+F5EFF54B907D95B1DF08E675550F13A4B6604FFC17CA288FD1CC7096D726C6B2
+C054C7751CFC7AC8BF1ED6A32D66511AEED2FA6C37F117589FACCB71230099ED
+F18616A45F1BFC054DCBF2EC0EA1161B068E764A4E1DE82AEA5A3E8E8BC2FF43
+2AB25FA09826009C4E4715E197E2EE9ED128ED2BB342DE97667709F7B28D45C6
+38B1E5186AC11D136CC3448E9AA6D4C4770E08E841776F6509E0ED7BE47AE414
+63D9C6E8E7F01358B19E81946781DC46AD622636645323AC9E8F54DE259C72AD
+22897189FE0F94DACB63A12DCC91B36ABC6DF0B40893506F3140928B9655EB7D
+EF30A3DB087744731F1B354F905087C09442F619A708632B420698677F88B48A
+8E2F10E9A1BFD691701F3F9A7F4CA7AE962B35932B420A169FFC7D68D73BA28A
+2E4EDA6F7AF4043AC8A0504DA03A807E596A33D931C86DBD515DF7785F37DDD4
+474042CC4F4162256A72D27DCD5652CA25875780DC8D08C77D206AC4B2283BDC
+ACE78B97B16C36FAAC198AC144BBB28667AD4735F92BF68422AB02503228222A
+FE28DF3EA257CAC35C50DA04BDFF02BCC2A768ED0E596CD52A5BE194D1DEDDC5
+E2C98671187FC42A5266E0FE0F5E54CED9DC3033002EA38F173D29C447057E67
+995899943096075A9679EB9DD294E7F21BF963B1740125A70AA528B388FB3667
+F42E599A3A9E8E61BAD3C6129164A41D2615F54A29BD337F70D5D849EF6D48F5
+406E315563E6F052F1FC3975E8599A64555F7F0D7B07763C0D538CD2087D292F
+8189C26881659D0B3C97DC45B784ED264ECAD84EFB71F5C1E6DCA0AE8143E8DA
+8D1385083EC577AEED38DEED14907E8A6D4951F4AF6C2E8CE2F7421B7356E531
+22B8E4E6E299D65AAF9941CD3074630367502DA8E3635ADBF9688BF0FDCCA001
+8F87FF0EBC453CFDB6F0D883844D3428EE5AD8C1ED33E222426F87D68324D4D2
+F2923969E52E137C6FAF9FFF4817BD9BFA73101B94B1D50CB020739352922933
+312FC9A4C6A8E1E5FF74EF03E8D7538B1089BC46BFD6092CD0375C0F885C5455
+38C2BCD2994F5903F7397382313428CF738760E319C558A27ECAC4B952350F97
+021ACFD1B359DED413C4177830C39390B2BC6F13020BF29C1ECE3897129629E7
+FD49DACF4A6C45F23A632DA72023CCE9D06D2CB5C8E90B7AC8A866203FC2E3CE
+764904B081C5C2D3C948CC1A5BC12EDFE8EA620996EE9F795585D210B0ED48E8
+8F33BEF8621DC3C1C5659D34CA4D3DE4684E3B8C8218EE57A558929E7DE2325D
+58852047667BE0B5E6F89328F6F0717C98A4F90C45570ED87691FD8D68B5ADF7
+8443BB9D7BC0D4BBD1E125C5453B24C71C5D0A64A98E29FC9DA719C70FB477FE
+73140F7F18B6C63D21C5F1AB57C9445BCCD313674DB7564FB04471973F4A77DE
+223B6FFFF27FADA93735EEDB54F6F3084ED8D579BA40DDE70BDD3445279D7E3F
+575C76E91598A8E0E1C0C903ED5831F9656CA74EF15CFA73B59EF9CE637E3B2F
+65E3FF21125CF20F958CEBAC6CD5B1B70367057DBD9118DB1A7E61C1727C8162
+864321898AFB6A3FCA262D4AEB7B05A8297E4A7C7D99754C0C26F6E4C00E1F80
+17F4AE34E54650C0FBBCF0EDE8BC440C331C57526870A22C3DCBE8E098257167
+44E3FF18AA99A148E64C19295FFE372D7896BE0CB3846731A89D780B31274D9A
+6DED19D8A892790D24DE5DC0F61B42A09FFE05F6644AA39F18322B0CA967AA13
+581A462B2165BE2B79633A4A7AAA99271A28A34F32DD5396F29DCCBEDE93103A
+0697C980C5E6250AC688F414AFBEDA0D019EA5E138DC77048538063615CA84B3
+DA0093F4C1B7C8617F01A50DE2098D48EFDE640372E8E3FE75F98622E53F5AF9
+CB050C0323BF13CFDA1003BC0056861BE8EEEBE1417C55A9123A24B9772F6745
+FA3B903281757887130A7E82CFED2505321B49251107FAEBEB08E8C5FA5D084A
+CA0AE615E77AD04FB6A7DF729C13641F75E955E922345E79EF8A6C4202C0DF9F
+23E533F76D13C671B41DCB308A3FAF7777592B2371FA27E6AE730D7C42C31D6A
+13B638E1CC7FDD99C7F9E7E66E3E4E7E963CCFB3749186DFE34501EEF5CC368C
+CC31D64DBFD065F3E5C1411EC8F82B575D64CE01A3249C19E372DDE80B05739E
+2BEE99753927A56EA989A1896E093F2C46940F4CFD875C0A1A908740EE3610D6
+3C5623C50EA8DDA31F07BCE7F129EDF3223DB143CD8EB9B21B397C8F205FA4EF
+3892D58B126A5E50F40964639EF047A2840957E36A3E26B98C383EC92DFF6C24
+7E9821B72A56C53919F3BFC4B923DFCC98079FA22B92E5E30BA5D0AC6DA42F5B
+BE940F817E9BCD22E04C4C449AF2927C2CE4
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+cleartomark
+%%EndResource
+%%EOF
diff --git a/tests/makeotf_test.py b/tests/makeotf_test.py
index 440af20b1..e16ab4c8f 100755
--- a/tests/makeotf_test.py
+++ b/tests/makeotf_test.py
@@ -462,3 +462,17 @@ def test_bug497(opts):
'