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

[checkoutlinesufo] Fails if component position coincides with base glyph start point #790

Open
frankrolf opened this issue Apr 22, 2019 · 5 comments · Fixed by #1146
Open
Labels

Comments

@frankrolf
Copy link
Member

In the attached UFO, there is a scedilla glyph, which is composed by s and cedillacmb components. The accent is attached to the s in a way that its decomposed outline coincides with the start point of s:
Screen Shot 2019-04-22 at 15 16 11

checkoutlinesufo -e results in the following traceback:

$ checkoutlinesufo -e test.ufo/

cedillacmb There is an overlap.
scedilla There is an overlap.Traceback (most recent call last):
  File "/usr/local/bin/checkoutlinesufo", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 1118, in main
    run(sys.argv[1:])
  File "/usr/local/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 1089, in run
    restore_contour_order(fixed_glyph, original_contours)
  File "/usr/local/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 950, in restore_contour_order
    contour.setStartPoint(pi)
  File "/usr/local/lib/python3.7/site-packages/defcon/objects/contour.py", line 223, in setStartPoint
    assert point.segmentType is not None, "index must represent an on curve point"
AssertionError: index must represent an on curve point

component_start_point.ufo.zip

frankrolf added a commit to adobe-fonts/source-serif that referenced this issue Jun 10, 2019
@frankrolf
Copy link
Member Author

Just encountered the same traceback again with this glyph(segment):

Traceback (most recent call last):
  File "/usr/local/bin/checkOutlinesUFO", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 1103, in main
    run(sys.argv[1:])
  File "/usr/local/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 1074, in run
    restore_contour_order(fixed_glyph, original_contours)
  File "/usr/local/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 932, in restore_contour_order
    contour.setStartPoint(pi)
  File "/usr/local/lib/python3.7/site-packages/defcon/objects/contour.py", line 223, in setStartPoint
    assert point.segmentType is not None, "index must represent an on curve point"
AssertionError: index must represent an on curve point
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="Scedilla" format="2">
  <advance width="534"/>
  <outline>
    <contour>
      <point x="256" y="-12" type="curve" smooth="yes"/>
      <point x="327" y="-12"/>
      <point x="386" y="8"/>
      <point x="429" y="42" type="curve"/>
      <point x="362" y="132" type="line"/>
      <point x="335" y="111"/>
      <point x="306" y="101"/>
      <point x="268" y="101" type="curve" smooth="yes"/>
      <point x="211" y="101"/>
      <point x="147" y="122"/>
      <point x="90" y="156" type="curve"/>
      <point x="39" y="55" type="line"/>
      <point x="94" y="9"/>
      <point x="169" y="-12"/>
    </contour>
    <contour>
      <point x="244" y="-76" type="line"/>
      <point x="258" y="0" type="line"/>
      <point x="192" y="0" type="line"/>
      <point x="178" y="-76" type="line"/>
    </contour>
  </outline>
</glyph>

@frankrolf
Copy link
Member Author

Again, same issue encountered. This is slightly frustrating when it occurs in the middle of a makeinstancesufo session (and also quite difficult to avoid). See #1145

<?xml version='1.0' encoding='UTF-8'?>
<glyph name="tcedilla" format="2">
  <advance width="320"/>
  <outline>
    <contour>
      <point x="61" y="453" type="line"/>
      <point x="199" y="453" type="line"/>
      <point x="201" y="453" type="line"/>
      <point x="354" y="450" type="line"/>
      <point x="358" y="475" type="line"/>
      <point x="202" y="475" type="line"/>
      <point x="202" y="476" type="line"/>
      <point x="65" y="469" type="line"/>
    </contour>
    <contour>
      <point x="140" y="-13" type="curve" smooth="yes"/>
      <point x="195" y="-13"/>
      <point x="239" y="32"/>
      <point x="281" y="92" type="curve"/>
      <point x="271" y="100" type="line"/>
      <point x="229" y="47"/>
      <point x="188" y="13"/>
      <point x="154" y="13" type="curve" smooth="yes"/>
      <point x="135" y="13"/>
      <point x="125" y="20"/>
      <point x="125" y="38" type="curve" smooth="yes"/>
      <point x="125" y="56"/>
      <point x="131" y="80"/>
      <point x="135" y="99" type="curve" smooth="yes"/>
      <point x="244" y="609" type="line"/>
      <point x="222" y="609" type="line"/>
      <point x="182" y="443" type="line"/>
      <point x="109" y="99" type="line" smooth="yes"/>
      <point x="102" y="68"/>
      <point x="98" y="54"/>
      <point x="98" y="28" type="curve" smooth="yes"/>
      <point x="98" y="4"/>
      <point x="116" y="-13"/>
    </contour>
    <contour>
      <point x="104" y="-84" type="line"/>
      <point x="163" y="-101"/>
      <point x="187" y="-115"/>
      <point x="187" y="-151" type="curve" smooth="yes"/>
      <point x="187" y="-180"/>
      <point x="157" y="-200"/>
      <point x="117" y="-200" type="curve" smooth="yes"/>
      <point x="92" y="-200"/>
      <point x="69" y="-195"/>
      <point x="50" y="-187" type="curve"/>
      <point x="44" y="-201" type="line"/>
      <point x="63" y="-212"/>
      <point x="87" y="-218"/>
      <point x="117" y="-218" type="curve" smooth="yes"/>
      <point x="174" y="-218"/>
      <point x="213" y="-192"/>
      <point x="213" y="-150" type="curve" smooth="yes"/>
      <point x="213" y="-110"/>
      <point x="179" y="-89"/>
      <point x="120" y="-70" type="curve"/>
      <point x="123" y="-81" type="line"/>
      <point x="163" y="0" type="line"/>
      <point x="147" y="0" type="line"/>
    </contour>
  </outline>
</glyph>

Screen Shot 2020-05-27 at 14 52 30
Screen Shot 2020-05-27 at 14 52 38

@frankrolf
Copy link
Member Author

Thank you!

@frankrolf
Copy link
Member Author

frankrolf commented Jun 10, 2020

There seems to be more going on than we originally expected:

➜  ExtraLight git:(opsz) ✗ checkoutlinesufo -e font.ufo
.notdef There is an overlap.
A Colinear line at (140, 30). Colinear line at (124, 30). Colinear line at (604, 30). Colinear line at (588, 30). There is an overlap.
A.sc Colinear line at (128, 30). Colinear line at (113, 30). Colinear line at (532, 30). Colinear line at (518, 30). There is an overlap.
A.sups Colinear line at (88, 439). Colinear line at (77, 439). Colinear line at (389, 439). Colinear line at (377, 439). There is an overlap.
AE Flat curve at (504, 0). Flat curve at (540, 300). Flat curve at (540, 676). Colinear line at (504, 300). Colinear line at (540, 300). Colinear line at (540, 376). Colinear line at (136, 30). Colinear line at (120, 30). Colinear line at (508, 646). Colinear line at (508, 30). There is an overlap.Traceback (most recent call last):
  File "/Users/fgriessh/.pyenv/versions/3.7.4/bin/checkoutlinesufo", line 8, in <module>
    sys.exit(main())
  File "/Users/fgriessh/.pyenv/versions/3.7.4/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 1133, in main
    run(sys.argv[1:])
  File "/Users/fgriessh/.pyenv/versions/3.7.4/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 1103, in run
    restore_contour_order(fixed_glyph, original_contours)
  File "/Users/fgriessh/.pyenv/versions/3.7.4/lib/python3.7/site-packages/afdko/checkoutlinesufo.py", line 950, in restore_contour_order
    assert not(ctr_starts[ci]), "Can't happen: duplicated start point!"  # noqa: E501
KeyError: 1

UFO file attached (AE is the only glyph, and culprit).
font_AE.ufo.zip

@frankrolf frankrolf reopened this Jun 10, 2020
@frankrolf
Copy link
Member Author

I simplified the glyph to get rid of any noise. The issue still happens in a glyph like this:
Screen Shot 2020-06-10 at 18 28 08

<?xml version='1.0' encoding='UTF-8'?>
<glyph name="AE" format="2">
  <advance width="388"/>
  <outline>
    <contour>
      <point x="92" y="0" type="line"/>
      <point x="128" y="0" type="line"/>
      <point x="128" y="666" type="line"/>
      <point x="92" y="666" type="line"/>
    </contour>
    <contour>
      <point x="112" y="28" type="line"/>
      <point x="308" y="28" type="line"/>
      <point x="308" y="58" type="line"/>
      <point x="112" y="58" type="line"/>
    </contour>
    <contour>
      <point x="292" y="0" type="line"/>
      <point x="328" y="0" type="line"/>
      <point x="328" y="676" type="line"/>
      <point x="61" y="676" type="line"/>
      <point x="61" y="646" type="line"/>
      <point x="292" y="646" type="line"/>
    </contour>
  </outline>
</glyph>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants