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

Fix otfstemhist bugs #1703

Merged
merged 2 commits into from
Sep 29, 2023
Merged

Fix otfstemhist bugs #1703

merged 2 commits into from
Sep 29, 2023

Conversation

skef
Copy link
Collaborator

@skef skef commented Sep 27, 2023

#1697 barfs w/o any arguments
#1699 cannot specify glyphs by GID
#1700 cannot specify glyphs via external glyph list
#1701 -h reports wrong tool name

Description

Fixes the listed bugs. Some notes:

  1. We fix the hyphen problem by looking for the token in the glyph list, if we find it we treat it like a simple name rather than a range.
  2. I left the convention where you can specify a glyph range with normal names rather than GIDs or CID names, because it seems harmless and potentially useful after the other fixes

Some of this could be improved further (like the glyph list file format) but given how long its been broken, maybe this level is sufficient.

Checklist:

  • I have followed the Contribution Guidelines
  • I have added test code and data to prove that my code functions correctly
  • I have verified that new and existing tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Closes #1697
Closes #1699
Closes #1700
Closes #1701

   #1697 barfs w/o any arguments
   #1699 cannot specify glyphs by GID
   #1700 cannot specify glyphs via external glyph list
   #1701 -h reports wrong tool name
@frankrolf
Copy link
Member

#1697 (barf), #1698 (dashes), #1699 (GID) and #1701 (help file content) confirmed fixed.

When testing for #1700, I did make a file in “one glyph per line” format at first (which seems more natural to me) – the result is

WARNING: glyph name <koKai> in range koKai-thai
khoKhai from glyph selection list option is not in font <xxx Traditional-Regular>.
Traceback (most recent call last):
  File "/Users/fg/.pyenv/versions/3.10.13/bin/otfstemhist", line 8, in <module>
    sys.exit(stemhist())
  File "/Users/fg/.pyenv/versions/3.10.13/lib/python3.10/site-packages/afdko/otfautohint/__main__.py", line 944, in stemhist
    hintFiles(options)
  File "/Users/fg/.pyenv/versions/3.10.13/lib/python3.10/site-packages/afdko/otfautohint/autohint.py", line 457, in hintFiles
    fw = fontWrapper(options, [fi])
  File "/Users/fg/.pyenv/versions/3.10.13/lib/python3.10/site-packages/afdko/otfautohint/autohint.py", line 232, in __init__
    raise FontParseError("Selected glyph list is empty for " +
afdko.otfautohint.FontParseError: Selected glyph list is empty for font <xxx Traditional-Regular>.
source_1 (master✗) $ otfstemhist --traceback --glyphs-file ~/Desktop/glyph_names.txt AdobeCleanThaiLooped-Medium.ufo

When converting those glyph names to a single, comma-separated line, everything works.

frankrolf
frankrolf previously approved these changes Sep 27, 2023
kaydeearts
kaydeearts previously approved these changes Sep 29, 2023
Copy link
Collaborator

@kaydeearts kaydeearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@skef skef dismissed stale reviews from kaydeearts and frankrolf via d1dd298 September 29, 2023 23:46
@skef skef merged commit ee450a8 into develop Sep 29, 2023
8 of 9 checks passed
@skef skef deleted the stemhistfixes branch September 29, 2023 23:59
skef added a commit that referenced this pull request Jul 8, 2024
* Fix otfstemhist bugs:
   #1697 barfs w/o any arguments
   #1699 cannot specify glyphs by GID
   #1700 cannot specify glyphs via external glyph list
   #1701 -h reports wrong tool name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants