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

tx uforead deleting outlines fix #1370

Merged
merged 6 commits into from
Jun 9, 2021
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
11 changes: 0 additions & 11 deletions c/shared/source/uforead/uforead.c
Original file line number Diff line number Diff line change
Expand Up @@ -1741,17 +1741,6 @@ static int preParseGLIF(ufoCtx h, GLIF_Rec* glifRec, int tag) {
continue;
}
char_end = tk->offset;
} else if (tokenEqualStr(tk, "lib")) {
/* since any lib element follows the outline element, if we get here there is no outline element.
end we need to add the current glyph to the char list with no outline content. */
char_begin = 0;
char_end = 0;

if (state != 1) {
continue;
}
addCharFromGLIF(h, tag, glifRec->glyphName, char_begin, char_end, unicode);
break;
} else if (isUnknownAttribute(tk)) {
getToken(h, state);
/* discard its value.*/
Expand Down
Binary file added tests/tx_data/expected_output/bug1366.pfa
Binary file not shown.
127 changes: 127 additions & 0 deletions tests/tx_data/input/bug1366.ufo/fontinfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>postscriptFontName</key>
<string>SourceHanSansVF-Heavy</string>
<key>styleName</key>
<string>Heavy</string>
<key>familyName</key>
<string>Source Han Sans</string>
<key>versionMajor</key>
<integer>2</integer>
<key>versionMinor</key>
<integer>3</integer>
<key>trademark</key>
<string>Copyright 2014-2020 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. Source is a trademark of Adobe in the United States and/or other countries.</string>
<key>unitsPerEm</key>
<integer>1000</integer>
<key>postscriptFullName</key>
<string>Source Han Sans Heavy</string>
<key>postscriptWeightName</key>
<string>Heavy</string>
<key>postscriptUnderlinePosition</key>
<integer>-150</integer>
<key>FSType</key>
<integer>0</integer>
<key>postscriptFDArray</key>
<array>
<dict>
<key>FontName</key>
<string>SourceHanSans-Heavy-Generic</string>
<key>PaintType</key>
<integer>0</integer>
<key>FontMatrix</key>
<array>
<real>0.001</real>
<integer>0</integer>
<integer>0</integer>
<real>0.001</real>
<integer>0</integer>
<integer>0</integer>
</array>
<key>PrivateDict</key>
<dict>
<key>postscriptBlueValues</key>
<array>
<integer>-250</integer>
<integer>-250</integer>
<integer>1100</integer>
<integer>1100</integer>
</array>
<key>postscriptStdHW</key>
<array>
<integer>35</integer>
</array>
<key>postscriptStemSnapV</key>
<array>
<integer>28</integer>
<integer>46</integer>
</array>
<key>postscriptStdVW</key>
<array>
<integer>28</integer>
</array>
<key>postscriptBlueScale</key>
<real>0.039625</real>
<key>postscriptBlueShift</key>
<integer>7</integer>
<key>postscriptBlueFuzz</key>
<integer>1</integer>
<key>LanguageGroup</key>
<integer>1</integer>
<key>ExpansionFactor</key>
<real>0.06</real>
</dict>
</dict>
<dict>
<key>FontName</key>
<string>SourceHanSans-Heavy-Ideographs</string>
<key>PaintType</key>
<integer>0</integer>
<key>FontMatrix</key>
<array>
<real>0.001</real>
<integer>0</integer>
<integer>0</integer>
<real>0.001</real>
<integer>0</integer>
<integer>0</integer>
</array>
<key>PrivateDict</key>
<dict>
<key>postscriptBlueValues</key>
<array>
<integer>-250</integer>
<integer>-250</integer>
<integer>1100</integer>
<integer>1100</integer>
</array>
<key>postscriptStdHW</key>
<array>
<integer>35</integer>
</array>
<key>postscriptStemSnapV</key>
<array>
<integer>28</integer>
<integer>46</integer>
</array>
<key>postscriptStdVW</key>
<array>
<integer>28</integer>
</array>
<key>postscriptBlueScale</key>
<real>0.039625</real>
<key>postscriptBlueShift</key>
<integer>7</integer>
<key>postscriptBlueFuzz</key>
<integer>1</integer>
<key>LanguageGroup</key>
<integer>1</integer>
<key>ExpansionFactor</key>
<real>0.06</real>
</dict>
</dict>
</array>
</dict>
</plist>
43 changes: 43 additions & 0 deletions tests/tx_data/input/bug1366.ufo/glyphs/cid00000.glif
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name="cid00000" format="1" >
<advance width="1000"/>
<outline>
<contour>
<point x="100" y="-120" type="line"/>
<point x="900" y="-120" type="line"/>
<point x="900" y="880" type="line"/>
<point x="100" y="880" type="line"/>
</contour>
<contour>
<point x="500" y="421" type="line"/>
<point x="182" y="830" type="line"/>
<point x="818" y="830" type="line"/>
</contour>
<contour>
<point x="532" y="380" type="line"/>
<point x="850" y="789" type="line"/>
<point x="850" y="-29" type="line"/>
</contour>
<contour>
<point x="182" y="-70" type="line"/>
<point x="500" y="339" type="line"/>
<point x="818" y="-70" type="line"/>
</contour>
<contour>
<point x="150" y="789" type="line"/>
<point x="468" y="380" type="line"/>
<point x="150" y="-29" type="line"/>
</contour>
</outline>
<lib>
<dict>
<key>com.adobe.type.cid.CID</key>
<integer>0</integer>
<key>com.adobe.type.cid.iFD</key>
<integer>0</integer>
</dict>
<key>lib</key>
<dict>
</dict>
</lib>
</glyph>
124 changes: 124 additions & 0 deletions tests/tx_data/input/bug1366.ufo/glyphs/cid17899.glif
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name="cid17899" format="1" >
<advance width="1000"/>
<outline>
<contour>
<point x="135" y="855" type="line"/>
<point x="135" y="-95" type="line"/>
<point x="266" y="-95" type="line"/>
<point x="266" y="855" type="line"/>
</contour>
<contour>
<point x="58" y="654" type="line"/>
<point x="52" y="573" />
<point x="36" y="459" />
<point x="15" y="389" type="curve"/>
<point x="101" y="361" type="line"/>
<point x="123" y="440" />
<point x="139" y="561" />
<point x="141" y="644" type="curve"/>
</contour>
<contour>
<point x="242" y="657" type="line"/>
<point x="262" y="590" />
<point x="282" y="501" />
<point x="291" y="449" type="curve"/>
<point x="376" y="476" type="line"/>
<point x="366" y="526" />
<point x="343" y="613" />
<point x="322" y="678" type="curve"/>
</contour>
<contour>
<point x="499" y="562" type="line"/>
<point x="751" y="562" type="line"/>
<point x="751" y="527" type="line"/>
<point x="499" y="527" type="line"/>
</contour>
<contour>
<point x="499" y="703" type="line"/>
<point x="751" y="703" type="line"/>
<point x="751" y="668" type="line"/>
<point x="499" y="668" type="line"/>
</contour>
<contour>
<point x="360" y="817" type="line"/>
<point x="360" y="413" type="line"/>
<point x="897" y="413" type="line"/>
<point x="897" y="817" type="line"/>
</contour>
<contour>
<point x="437" y="314" type="line"/>
<point x="437" y="193" type="line"/>
<point x="631" y="193" type="line"/>
<point x="631" y="314" type="line"/>
</contour>
<contour>
<point x="371" y="-96" type="line"/>
<point x="397" y="-78" />
<point x="438" y="-60" />
<point x="647" y="4" type="curve"/>
<point x="639" y="34" />
<point x="630" y="88" />
<point x="627" y="125" type="curve"/>
<point x="406" y="65" type="line"/>
<point x="357" y="23" type="line"/>
</contour>
<contour>
<point x="662" y="392" type="line"/>
<point x="662" y="74" type="line"/>
<point x="662" y="-40" />
<point x="685" y="-78" />
<point x="789" y="-78" type="curve"/>
<point x="809" y="-78" />
<point x="837" y="-78" />
<point x="857" y="-78" type="curve"/>
<point x="937" y="-78" />
<point x="970" y="-39" />
<point x="982" y="91" type="curve"/>
<point x="946" y="99" />
<point x="891" y="120" />
<point x="864" y="141" type="curve"/>
<point x="861" y="54" />
<point x="857" y="38" />
<point x="843" y="38" type="curve"/>
<point x="837" y="38" />
<point x="821" y="38" />
<point x="816" y="38" type="curve"/>
<point x="801" y="38" />
<point x="800" y="41" />
<point x="800" y="75" type="curve"/>
<point x="800" y="392" type="line"/>
</contour>
<contour>
<point x="727" y="314" type="line"/>
<point x="727" y="193" type="line"/>
<point x="952" y="193" type="line"/>
<point x="952" y="314" type="line"/>
</contour>
<contour>
<point x="371" y="-96" type="curve"/>
<point x="371" y="-54" />
<point x="510" y="-9" />
<point x="510" y="-9" type="curve"/>
<point x="510" y="391" type="line"/>
<point x="367" y="391" type="line"/>
<point x="367" y="91" type="line"/>
<point x="367" y="55" />
<point x="351" y="44" />
<point x="330" y="37" type="curve"/>
<point x="349" y="6" />
<point x="366" y="-59" />
</contour>
</outline>
<lib>
<dict>
<key>com.adobe.type.cid.CID</key>
<integer>0</integer>
<key>com.adobe.type.cid.iFD</key>
<integer>0</integer>
</dict>
<key>lib</key>
<dict>
</dict>
</lib>
</glyph>
10 changes: 10 additions & 0 deletions tests/tx_data/input/bug1366.ufo/glyphs/contents.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>cid00000</key>
<string>cid00000.glif</string>
<key>cid17899</key>
<string>cid17899.glif</string>
</dict>
</plist>
19 changes: 19 additions & 0 deletions tests/tx_data/input/bug1366.ufo/lib.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>public.glyphOrder</key>
<array>
<string>cid00000</string>
<string>cid17899</string>
</array>
<key>com.adobe.type.cid.CIDFontName</key>
<string>SourceHanSansVF-Heavy</string>
<key>com.adobe.type.cid.Registry</key>
<string>Adobe</string>
<key>com.adobe.type.cid.Ordering</key>
<string>Identity</string>
<key>com.adobe.type.cid.Supplement</key>
<integer>0</integer>
</dict>
</plist>
10 changes: 10 additions & 0 deletions tests/tx_data/input/bug1366.ufo/metainfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>creator</key>
<string>com.adobe.type.tx</string>
<key>formatVersion</key>
<integer>2</integer>
</dict>
</plist>
10 changes: 10 additions & 0 deletions tests/tx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,3 +1158,13 @@ def test_cff2_windows_line_endings_bug1355():
'*S', '*b', '-f', font_path])
expected_path = get_expected_path('bug1355.cff2')
assert differ([expected_path, actual_path, '-m', 'bin'])


def test_lib_removes_outlines_bug1366():
input_path = get_input_path("bug1366.ufo")
expected_path = get_expected_path("bug1366.pfa")
output_path = get_temp_file_path()
subprocess.call([TOOL, '-t1', '-o', output_path, input_path])
expected_path = generate_ps_dump(expected_path)
output_path = generate_ps_dump(output_path)
assert differ([expected_path, output_path, '-s', PFA_SKIP[0]])