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

Stemhist: Unhandled case for first and last points in outline #715

Closed
typoman opened this issue Jan 22, 2019 · 13 comments
Closed

Stemhist: Unhandled case for first and last points in outline #715

typoman opened this issue Jan 22, 2019 · 13 comments
Assignees
Labels

Comments

@typoman
Copy link

typoman commented Jan 22, 2019

I'm running stemhist on a UFO file which produces an output when it encounters a composite and it stops.

Checking space.
Checking A.
Checking Agrave.
Checking Aacute.
Checking Acircumflex.
Checking Atilde.
Unhandled case for first and last points in outline '<contour>
<point x="211" y="774" />
<point smooth="yes" type="curve" x="254" y="774" />
<point x="305" y="774" />
<point x="346" y="819" />
<point type="curve" x="354" y="890" />
<point type="line" x="294" y="890" />
<point x="289" y="864" />
<point x="273" y="845" />
<point smooth="yes" type="curve" x="254" y="845" />
<point x="225" y="845" />
<point x="189" y="888" />
<point smooth="yes" type="curve" x="147" y="888" />
<point x="95" y="888" />
<point x="54" y="843" />
<point type="curve" x="46" y="772" />
<point type="line" x="106" y="772" />
<point x="111" y="798" />
<point x="127" y="817" />
<point smooth="yes" type="curve" x="146" y="817" />
<point x="175" y="817" />
</contour>
'.

I can't make out what this means: Unhandled case for first and last points in outline and also there is no infomation anywhere to describe it. The wierd thing is that there is no such point structure if I search it through all the ufo glyph files. Could you direct me on what this means and how can it be fixed?

@frankrolf
Copy link
Member

@frankrolf
Copy link
Member

frankrolf commented Jan 23, 2019

Hi Bahman, thank you for sending over the UFO file.
The glyph triggering the output above is tilde.uc, the point x="211" y="774" exists within it.
The interesting part – 211 774 is actually an offcurve point, but saved in the XML as the first point of the tilde-contour.
While the UFO spec does not explicitly forbid this, I have not seen the starting point of a contour be anything else but an oncurve point. I am fairly certain this is a requirement for a PostScript contour too – hence autohint, stemHist etc. failing.

A workaround:
reassign the start point to be the first oncurve point.

@frankrolf frankrolf reopened this Jan 23, 2019
@frankrolf
Copy link
Member

A note for ufotools – perhaps it would be smart to detect such cases and automatically shift all points of the affected contour by 1.

@typoman
Copy link
Author

typoman commented Jan 23, 2019

Thank you Frank for finding the issue. Maybe @schriftgestalt should see this issue, the UFO was exported from the Glyphs app.

@schriftgestalt
Copy link
Contributor

I try to not mess with starting points. Otherwise people complain about unnecessary differences.

As long as it is in the spec I tend to keep it like that.

@frankrolf
Copy link
Member

I don’t think you fully read through the issue here Georg. Glyphs apparently is able to set start points on offcurve points, which literally is “messing with starting points”

@schriftgestalt
Copy link
Contributor

The start point happens to be like that. And Glyphs just kept it.

@frankrolf
Copy link
Member

The UFO file itself is point structure-agnostic, meaning it is OK to start with an off-curve point.
Action item for UFOtools:

  • detect nature of outline and warn rather than fail
  • possibly shift point structure and inform user

@khaledhosny
Copy link
Collaborator

Can some one try this with psstemhist from psautohint?

@frankrolf
Copy link
Member

psstemhist test\ BETA-Regular.ufo
ERROR: tet-hb: Check for duplicate subpath at 107 0.
ERROR: shin-hb: Check for duplicate subpath at 105 0.
ERROR: shinshindot-hb: Check for duplicate subpath at 105 0.
ERROR: shinsindot-hb: Check for duplicate subpath at 105 0.
ERROR: shindageshshindot-hb: Check for duplicate subpath at 105 0.
ERROR: shindageshsindot-hb: Check for duplicate subpath at 105 0.
ERROR: tetdagesh-hb: Check for duplicate subpath at 107 0.
ERROR: shindagesh-hb: Check for duplicate subpath at 105 0.

works

@miguelsousa miguelsousa self-assigned this Feb 13, 2019
@miguelsousa
Copy link
Member

@khaledhosny do you know if some sort of point reordering happens behind the scenes to get this to work in psstemhist?

@khaledhosny
Copy link
Collaborator

The code in question was replaced by a BezPen, and I vaguely remember FontTools pens taking care of re-ordering the points.

@miguelsousa
Copy link
Member

I'll have a look. Thanks

miguelsousa added a commit that referenced this issue Feb 15, 2019
miguelsousa added a commit that referenced this issue Feb 15, 2019
miguelsousa added a commit that referenced this issue Feb 15, 2019
miguelsousa added a commit that referenced this issue Feb 15, 2019
miguelsousa added a commit that referenced this issue Feb 15, 2019
miguelsousa added a commit that referenced this issue Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants