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

Fix mark to base bug #815

Merged
merged 2 commits into from
Jun 20, 2019
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 @@ -12,7 +12,7 @@ This software is licensed as OpenSource, under the Apache License, Version 2.0.
extern "C" {
#endif

#define HOT_VERSION 0x01006D /* Library version (1.0.109) */
#define HOT_VERSION 0x01006E /* Library version (1.0.110) */
/* 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
5 changes: 2 additions & 3 deletions c/makeotf/makeotf_lib/source/hotconv/GPOS.c
Original file line number Diff line number Diff line change
Expand Up @@ -3929,7 +3929,7 @@ static void fillMarkToBase(hotCtx g, GPOSCtx h) {
for (j = 0; j < fmt->ClassCount; j++) {
if (baseAnchorArray[j] == 0xFFFFFFFFL) {
char msg[1024];
baseAnchorArray[j] = 0;
baseAnchorArray[j] = 0xFFFFFFFFL;
featGlyphDump(g, baseRec->gid, '\0', 0);
if (h->new.fileName != NULL) {
sprintf(msg, " [%s line %ld]", h->new.fileName, baseRec->lineNum);
Expand Down Expand Up @@ -4014,8 +4014,7 @@ static void writeMarkToBase(hotCtx g, GPOSCtx h, Subtable *sub) {
for (i = 0; i < fmt->BaseArray_.BaseCount; i++) {
BaseRecord *baseRec = &fmt->BaseArray_.BaseRecord[i];
for (j = 0; j < markClassCnt; j++) {
LOffset *baseAnchorArray = baseRec->BaseAnchorArray;
if (baseRec->BaseAnchorArray[j] == 0)
if (baseRec->BaseAnchorArray[j] == 0xFFFFFFFFL)
OUT2((Offset)0);
else
OUT2((Offset)(baseRec->BaseAnchorArray[j] + anchorListOffset));
Expand Down
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>
18 changes: 18 additions & 0 deletions tests/makeotfexe_data/input/bug811/feat.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

table head {
FontRevision 1.011;
} head;

languagesystem DFLT dflt;

# Copied loosely from SourceCodePro-Regular
@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 = 'bug811/feat.fea'
ttx_filename = 'bug811.ttx'
actual_path = get_temp_file_path()
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'])