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

More otfautohint rounding fixes #1772

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion python/afdko/otfautohint/hinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,10 @@ def addStemValue(self, lloc, uloc, val, spc, lseg, useg):
if not useg:
return

if self.options.roundCoords:
lloc = round(lloc)
uloc = round(uloc)

sv = stemValue(lloc, uloc, val, spc, lseg, useg, ghst)
self.insertStemValue(sv)

Expand Down Expand Up @@ -1721,7 +1725,9 @@ def addBBox(self, doSubpaths=False):
utype, 0, self.isV(), self.isV(), "u bbox")
self.hs.getPEState(pbs.extpes[1][peidx],
True).m_segs.append(useg)
hv = stemValue(mn_pt.o, mx_pt.o, 100, 0, lseg, useg, False)
lloc = round(mn_pt.o) if self.options.roundCoords else mn_pt.o
uloc = round(mx_pt.o) if self.options.roundCoords else mx_pt.o
hv = stemValue(lloc, uloc, 100, 0, lseg, useg, False)
self.insertStemValue(hv, "bboxadd")
self.hs.mainValues.append(hv)
self.hs.mainValues.sort(key=lambda sv: sv.compVal(self.SpcBonus),
Expand Down
2 changes: 2 additions & 0 deletions python/afdko/otfautohint/hintstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ def addToLoc(self, loc, score, strong=False, bb=False, seg=None):
if sid in self.usedSegs:
return
self.usedSegs.add(sid)
if self.dhinter.options.roundCoords:
loc = round(loc)
if loc in self.candDict:
sLC = self.candDict[loc]
else:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lxml==4.9.3
booleanOperations==0.9.0
defcon[lxml,pens]==0.10.3
fontMath==0.9.3
fontTools[unicode,woff,lxml,ufo]==4.43.0
fontTools[unicode,woff,lxml,ufo]==4.55.0
tqdm==4.66.1
ufonormalizer==0.6.1
ufoProcessor==1.13.1
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
<point x="153.6" y="-84"/>
<point x="142.4" y="-63.2"/>
<point x="142.4" y="-11.2" type="curve"/>
<point x="142.4" y="37.6"/>
<point x="142.4" y="37.6" name="hintRef0001"/>
<point x="147.2" y="79.2"/>
<point x="147.2" y="133.6" type="curve"/>
<point x="147.2" y="184.8" name="hintRef0001"/>
<point x="147.2" y="184.8" name="hintRef0002"/>
<point x="133.6" y="211.2"/>
<point x="99.2" y="220.8" type="curve"/>
<point x="99.2" y="224" type="line"/>
<point x="133.6" y="233.6"/>
<point x="147.2" y="259.2"/>
<point x="147.2" y="311.2" type="curve"/>
<point x="147.2" y="365.6" name="hintRef0002"/>
<point x="147.2" y="365.6"/>
<point x="142.4" y="407.2"/>
<point x="142.4" y="456" type="curve"/>
<point x="142.4" y="508"/>
<point x="142.4" y="508" name="hintRef0003"/>
<point x="153.6" y="528.8"/>
<point x="196.8" y="528.8" type="curve"/>
<point x="218.4" y="528.8" type="line"/>
Expand All @@ -33,17 +33,17 @@
<point x="119.2" y="566.4"/>
<point x="88.8" y="542.4"/>
<point x="88.8" y="460" type="curve"/>
<point x="88.8" y="401.6"/>
<point x="88.8" y="401.6" name="hintRef0004"/>
<point x="96" y="359.2"/>
<point x="96" y="304.8" type="curve"/>
<point x="96" y="274.4" name="hintRef0003"/>
<point x="96" y="274.4"/>
<point x="81.6" y="244"/>
<point x="27.2" y="243.2" type="curve"/>
<point x="27.2" y="201.6" type="line"/>
<point x="81.6" y="200.8"/>
<point x="27.2" y="201.6" type="line" name="hintRef0005"/>
<point x="81.6" y="200.8" name="hintRef0006"/>
<point x="96" y="170.4"/>
<point x="96" y="139.2" type="curve"/>
<point x="96" y="85.6" name="hintRef0004"/>
<point x="96" y="85.6"/>
<point x="88.8" y="43.2"/>
<point x="88.8" y="-15.2" type="curve"/>
<point x="88.8" y="-97.6"/>
Expand Down Expand Up @@ -75,7 +75,7 @@
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 27.2 72</string>
<string>vstem 96 51.2</string>
</array>
</dict>
<dict>
Expand All @@ -86,7 +86,7 @@
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 88.8 53.6</string>
<string>vstem 96 51.2</string>
</array>
</dict>
<dict>
Expand All @@ -97,7 +97,7 @@
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 27.2 72</string>
<string>vstem 88.8 53.6</string>
</array>
</dict>
<dict>
Expand All @@ -108,7 +108,29 @@
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 88.8 53.6</string>
<string>vstem 96 51.2</string>
</array>
</dict>
<dict>
<key>pointTag</key>
<string>hintRef0005</string>
<key>stems</key>
<array>
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 27.2 72</string>
</array>
</dict>
<dict>
<key>pointTag</key>
<string>hintRef0006</string>
<key>stems</key>
<array>
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 96 51.2</string>
</array>
</dict>
</array>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<point x="161.6" y="244" name="hintRef0003"/>
<point x="146.4" y="274.4"/>
<point x="146.4" y="304.8" type="curve"/>
<point x="146.4" y="359.2"/>
<point x="146.4" y="359.2" name="hintRef0004"/>
<point x="153.6" y="401.6"/>
<point x="153.6" y="460" type="curve"/>
<point x="153.6" y="542.4"/>
Expand All @@ -34,14 +34,14 @@
<point x="100" y="407.2"/>
<point x="96" y="365.6"/>
<point x="96" y="311.2" type="curve"/>
<point x="96" y="259.2" name="hintRef0004"/>
<point x="96" y="259.2" name="hintRef0005"/>
<point x="108.8" y="233.6"/>
<point x="143.2" y="224" type="curve"/>
<point x="143.2" y="220.8" type="line"/>
<point x="108.8" y="211.2"/>
<point x="96" y="184.8"/>
<point x="96" y="133.6" type="curve"/>
<point x="96" y="79.2" name="hintRef0005"/>
<point x="96" y="79.2" name="hintRef0006"/>
<point x="100" y="37.6"/>
<point x="100" y="-11.2" type="curve"/>
<point x="100" y="-63.2"/>
Expand Down Expand Up @@ -108,13 +108,24 @@
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 96 50.4</string>
<string>vstem 100 53.6</string>
</array>
</dict>
<dict>
<key>pointTag</key>
<string>hintRef0005</string>
<key>stems</key>
<array>
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
<string>hstem 528.8 37.6</string>
<string>vstem 96 50.4</string>
</array>
</dict>
<dict>
<key>pointTag</key>
<string>hintRef0006</string>
<key>stems</key>
<array>
<string>hstem -121.6 37.6</string>
<string>hstem 201.6 41.6</string>
Expand Down
Binary file modified tests/otfautohint_data/input/dummy/font.ps
Binary file not shown.
Loading