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] preserve intentional duplicate start points when PFA -> UFO #1452

Merged
merged 4 commits into from
Jan 4, 2022
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: 7 additions & 4 deletions c/shared/source/ufowrite/ufowrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,11 +1205,15 @@ static void writeContour(ufwCtx h) {
/* Fix up the start op. UFO fonts require a completely closed path, and no initial move-to.
If the last op coords are not the same as the move-to:
- change the initial move-to to a line-to.
else if the last op is a line-to:
- change the initial move-to op to a line-to, and remove the last op.
else if the last op is a curve-to:
- change the initial move-to type to a "initial curve-to" type - just writes the final curve point
- change the final curve-to type to a "final curve-to" type - just writes the first two points of the curve.
- change the final curve-to type to a "final curve-to" type - just writes the first two points of the curve.
else if the last op is a line-to:
- Change the initial move-to op to a line-to
- Note:
- Previously, the last pt would also be removed if it was a duplicate point
- However, this code was removed because it interferes with duplicate points needed by variable fonts.
- The last point is not removed anymore, even if its a duplicate.
*/
opRec = &h->path.opList.array[0];
opRec2 = &h->path.opList.array[h->path.opList.cnt - 1];
Expand All @@ -1223,7 +1227,6 @@ static void writeContour(ufwCtx h) {
opRec->opType = linetoType;
} else if (opRec2->opType == linetoType) {
opRec->opType = linetoType;
h->path.opList.cnt--;
} else if (opRec2->opType == curvetoType) {
opRec->opType = initialCurvetoType;
opRec2->opType = finalCurvetoType;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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>dupeStartPoint-Regular</string>
<key>styleName</key>
<string>Regular</string>
<key>familyName</key>
<string>dupeStartPoint</string>
<key>versionMajor</key>
<integer>1</integer>
<key>versionMinor</key>
<integer>0</integer>
<key>unitsPerEm</key>
<integer>1000</integer>
<key>postscriptBlueValues</key>
<array>
<integer>0</integer>
<integer>0</integer>
</array>
<key>postscriptBlueScale</key>
<real>0.04</real>
<key>postscriptBlueShift</key>
<integer>7</integer>
<key>postscriptBlueFuzz</key>
<integer>1</integer>
<key>ExpansionFactor</key>
<real>0.06</real>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name="A" format="1" >
<advance width="1000"/>
<outline>
<contour>
<point x="572" y="363" type="curve"/>
<point x="579" y="369" />
<point x="705" y="342" />
<point x="777" y="334" type="curve"/>
<point x="622" y="339" type="line"/>
<point x="601" y="342" />
<point x="570" y="355" />
<point x="572" y="363" type="curve"/>
<point x="574" y="365" />
<point x="572" y="360" />
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name=".notdef" format="1" >
<advance width="250"/>
<outline>
</outline>
</glyph>
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>A</key>
<string>A_.glif</string>
<key>.notdef</key>
<string>_notdef.glif</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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>A</string>
<string>.notdef</string>
</array>
</dict>
</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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>dupeStartPoint-Regular</string>
<key>styleName</key>
<string>Regular</string>
<key>familyName</key>
<string>dupeStartPoint</string>
<key>versionMajor</key>
<integer>1</integer>
<key>versionMinor</key>
<integer>0</integer>
<key>unitsPerEm</key>
<integer>1000</integer>
<key>postscriptBlueValues</key>
<array>
<integer>0</integer>
<integer>0</integer>
</array>
<key>postscriptBlueScale</key>
<real>0.04</real>
<key>postscriptBlueShift</key>
<integer>7</integer>
<key>postscriptBlueFuzz</key>
<integer>1</integer>
<key>ExpansionFactor</key>
<real>0.06</real>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name="A" format="1" >
<advance width="1000"/>
<outline>
<contour>
<point x="572" y="363" type="curve"/>
<point x="574" y="365" />
<point x="705" y="342" />
<point x="777" y="334" type="curve"/>
<point x="622" y="339" type="line"/>
<point x="605" y="347" />
<point x="572" y="360" />
<point x="572" y="363" type="curve"/>
<point x="574" y="365" />
<point x="572" y="360" />
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name=".notdef" format="1" >
<advance width="250"/>
<outline>
</outline>
</glyph>
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>A</key>
<string>A_.glif</string>
<key>.notdef</key>
<string>_notdef.glif</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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>A</string>
<string>.notdef</string>
</array>
</dict>
</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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>dupeStartPoint-Regular</string>
<key>styleName</key>
<string>Regular</string>
<key>familyName</key>
<string>dupeStartPoint</string>
<key>versionMajor</key>
<integer>1</integer>
<key>versionMinor</key>
<integer>0</integer>
<key>unitsPerEm</key>
<integer>1000</integer>
<key>postscriptBlueValues</key>
<array>
<integer>0</integer>
<integer>0</integer>
</array>
<key>postscriptBlueScale</key>
<real>0.04</real>
<key>postscriptBlueShift</key>
<integer>7</integer>
<key>postscriptBlueFuzz</key>
<integer>1</integer>
<key>ExpansionFactor</key>
<real>0.06</real>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name="A" format="1" >
<advance width="1000"/>
<outline>
<contour>
<point x="572" y="363" type="line"/>
<point x="777" y="334" type="line"/>
<point x="622" y="339" type="line"/>
<point x="572" y="363" type="line"/>
</contour>
</outline>
</glyph>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<glyph name=".notdef" format="1" >
<advance width="250"/>
<outline>
</outline>
</glyph>
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>A</key>
<string>A_.glif</string>
<key>.notdef</key>
<string>_notdef.glif</string>
</dict>
</plist>
11 changes: 11 additions & 0 deletions tests/tx_data/expected_output/dup-start-pts/line.ufo/lib.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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>A</string>
<string>.notdef</string>
</array>
</dict>
</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>
54 changes: 54 additions & 0 deletions tests/tx_data/input/dup-start-pts/curve-diff-sides.pfa

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

Loading