Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[makeotfexe] generates incorrect secondary lookups with useMarkFilteringSet flag #538

Merged
merged 2 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion c/makeotf/makeotf_lib/api/hotconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions c/makeotf/makeotf_lib/source/hotconv/GSUB.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
137 changes: 137 additions & 0 deletions tests/makeotf_data/expected_output/bug196.ttx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="3.29">

<GSUB>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=1 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=1 -->
<FeatureRecord index="0">
<FeatureTag value="test"/>
<Feature>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="2"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=5 -->
<Lookup index="0">
<LookupType value="6"/>
<LookupFlag value="16"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=1 -->
<InputCoverage index="0" Format="1">
<Glyph value="a"/>
</InputCoverage>
<!-- LookAheadGlyphCount=2 -->
<LookAheadCoverage index="0" Format="2">
<Glyph value="a"/>
<Glyph value="b"/>
<Glyph value="c"/>
</LookAheadCoverage>
<LookAheadCoverage index="1" Format="1">
<Glyph value="b"/>
</LookAheadCoverage>
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="3"/>
</SubstLookupRecord>
</ChainContextSubst>
<MarkFilteringSet value="0"/>
</Lookup>
<Lookup index="1">
<LookupType value="6"/>
<LookupFlag value="16"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=1 -->
<InputCoverage index="0" Format="1">
<Glyph value="b"/>
</InputCoverage>
<!-- LookAheadGlyphCount=2 -->
<LookAheadCoverage index="0" Format="2">
<Glyph value="a"/>
<Glyph value="b"/>
<Glyph value="c"/>
</LookAheadCoverage>
<LookAheadCoverage index="1" Format="1">
<Glyph value="c"/>
</LookAheadCoverage>
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="4"/>
</SubstLookupRecord>
</ChainContextSubst>
<MarkFilteringSet value="1"/>
</Lookup>
<Lookup index="2">
<LookupType value="6"/>
<LookupFlag value="16"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=2 -->
<BacktrackCoverage index="0" Format="2">
<Glyph value="a"/>
<Glyph value="b"/>
<Glyph value="c"/>
</BacktrackCoverage>
<BacktrackCoverage index="1" Format="1">
<Glyph value="a"/>
</BacktrackCoverage>
<!-- InputGlyphCount=1 -->
<InputCoverage index="0" Format="1">
<Glyph value="c"/>
</InputCoverage>
<!-- LookAheadGlyphCount=0 -->
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="4"/>
</SubstLookupRecord>
</ChainContextSubst>
<MarkFilteringSet value="1"/>
</Lookup>
<Lookup index="3">
<LookupType value="1"/>
<LookupFlag value="16"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0" Format="1">
<Substitution in="a" out="c"/>
</SingleSubst>
<MarkFilteringSet value="0"/>
</Lookup>
<Lookup index="4">
<LookupType value="1"/>
<LookupFlag value="16"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0" Format="2">
<Substitution in="b" out="b"/>
<Substitution in="c" out="a"/>
</SingleSubst>
<MarkFilteringSet value="1"/>
</Lookup>
</LookupList>
</GSUB>

</ttFont>
28 changes: 28 additions & 0 deletions tests/makeotf_data/input/bug196/bug196.fea
Original file line number Diff line number Diff line change
@@ -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;
94 changes: 94 additions & 0 deletions tests/makeotf_data/input/bug196/bug196.pfa

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions tests/makeotf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,17 @@ def test_bug497(opts):
' <created value=' + SPLIT_MARKER +
' <modified value=',
'-r', '^\s+Version.*;hotconv.*;makeotfexe'])


def test_useMarkFilteringSet_flag_bug196():
input_filename = "bug196/bug196.pfa"
input_featurename = "bug196/bug196.fea"
actual_path = _get_temp_file_path()
ttx_filename = "bug196.ttx"
runner(CMD + ['-n', '-o',
'f', '_{}'.format(_get_input_path(input_filename)),
'ff', '_{}'.format(_get_input_path(input_featurename)),
'o', '_{}'.format(actual_path)])
actual_ttx = _generate_ttx_dump(actual_path, ['GSUB'])
expected_ttx = _get_expected_path(ttx_filename)
assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])