Skip to content

Commit

Permalink
[makeotfexe] Add test case for bug 811
Browse files Browse the repository at this point in the history
afdko issue "Bug in building MarkToBase lookup type 4" #811.
  • Loading branch information
readroberts committed Jun 19, 2019
1 parent 5dde3bc commit 368464a
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
83 changes: 83 additions & 0 deletions tests/makeotfexe_data/expected_output/bug811.ttx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="3.43">

<GPOS>
<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="GPS4"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=1 -->
<Lookup index="0">
<LookupType value="4"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<MarkBasePos index="0" Format="1">
<MarkCoverage Format="1">
<Glyph value=".notdef"/>
<Glyph value="a"/>
</MarkCoverage>
<BaseCoverage Format="1">
<Glyph value=".notdef"/>
<Glyph value="a"/>
</BaseCoverage>
<!-- ClassCount=1 -->
<MarkArray>
<!-- MarkCount=2 -->
<MarkRecord index="0">
<Class value="0"/>
<MarkAnchor Format="1">
<XCoordinate value="300"/>
<YCoordinate value="500"/>
</MarkAnchor>
</MarkRecord>
<MarkRecord index="1">
<Class value="0"/>
<MarkAnchor Format="1">
<XCoordinate value="300"/>
<YCoordinate value="680"/>
</MarkAnchor>
</MarkRecord>
</MarkArray>
<BaseArray>
<!-- BaseCount=2 -->
<BaseRecord index="0">
<BaseAnchor index="0" Format="1">
<XCoordinate value="300"/>
<YCoordinate value="680"/>
</BaseAnchor>
</BaseRecord>
<BaseRecord index="1">
<BaseAnchor index="0" Format="1">
<XCoordinate value="300"/>
<YCoordinate value="500"/>
</BaseAnchor>
</BaseRecord>
</BaseArray>
</MarkBasePos>
</Lookup>
</LookupList>
</GPOS>

</ttFont>
19 changes: 19 additions & 0 deletions tests/makeotfexe_data/input/bug811/feat.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

table head {
FontRevision 1.011;
} head;

languagesystem DFLT dflt;

# Copeid loosely from SourceCodeProRegular
@mGC_above_300_500 = [.notdef];
@mGC_above_300_680 = [a];

markClass @mGC_above_300_500 <anchor 300 500> @MC_above;
markClass @mGC_above_300_680 <anchor 300 680> @MC_above;

feature GPS4 {

pos base .notdef <anchor 300 680> mark @MC_above;
pos base a <anchor 300 500> mark @MC_above;
} GPS4;
71 changes: 71 additions & 0 deletions tests/makeotfexe_data/input/bug811/font.pfa

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

13 changes: 13 additions & 0 deletions tests/makeotfexe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,16 @@ def test_parameter_offset_overflow_bug746():
with open(stderr_path, 'rb') as f:
output = f.read()
assert(b"[FATAL] <bug746> feature parameter offset too large") in output


def test_base_anchor_bug811():
input_filename = "bug811/font.pfa"
feat_filename = get_input_path('bug811/feat.fea')
actual_path = get_temp_file_path()
ttx_filename = "bug811.ttx"
runner(CMD + ['-o', 'f', '_{}'.format(get_input_path(input_filename)),
'ff', '_{}'.format(get_input_path(feat_filename)),
'o', '_{}'.format(actual_path)])
actual_ttx = generate_ttx_dump(actual_path, ['GPOS'])
expected_ttx = get_expected_path(ttx_filename)
assert differ([expected_ttx, actual_ttx, '-s', '<ttFont sfntVersion'])

0 comments on commit 368464a

Please sign in to comment.