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

non-letter anchor names raise feature syntax error #347

Open
madig opened this issue Aug 20, 2017 · 4 comments
Open

non-letter anchor names raise feature syntax error #347

madig opened this issue Aug 20, 2017 · 4 comments

Comments

@madig
Copy link
Collaborator

madig commented Aug 20, 2017

  1. wget https://github.com/madig/cantarell-fonts/raw/master/src/Cantarell.glyphs
  2. fontmake -g Cantarell.glyphs -o otf
INFO:fontmake.font_project:Building master UFOs and designspace from Glyphs source
INFO:glyphsLib:Parsing .glyphs file
INFO:glyphsLib:Casting parsed values
INFO:glyphsLib:Loading to UFOs
INFO:glyphsLib.util:Writing master_ufo/Cantarell-Regular.ufo
INFO:fontmake.font_project:Building OTFs
INFO:fontmake.font_project:Decomposing glyphs for Cantarell-Regular
INFO:fontmake.font_project:Removing overlaps for Cantarell-Regular
INFO:fontmake.font_project:Saving OTF for Cantarell-Regular
Traceback (most recent call last):
  File "/home/nikolaus/.local/bin/fontmake", line 11, in <module>
    sys.exit(main())
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/__main__.py", line 183, in main
    project.run_from_glyphs(glyphs_path, **args)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 378, in run_from_glyphs
    designspace_path, instance_data=instance_data, **kwargs)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 434, in run_from_designspace
    interpolate_layout_from=interpolate_layout_from, **kwargs)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 473, in run_from_ufos
    ufos, remove_overlaps, **kwargs)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 175, in build_otfs
    self.save_otfs(ufos, **kwargs)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 295, in save_otfs
    font = compileOTF(ufo, optimizeCFF=subroutinize, **compiler_options)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/ufo2ft/__init__.py", line 42, in compileOTF
    featureCompiler.compile()
  File "/home/nikolaus/.local/lib/python3.6/site-packages/ufo2ft/featureCompiler.py", line 40, in compile
    self.setupFile_featureTables()
  File "/home/nikolaus/.local/lib/python3.6/site-packages/ufo2ft/featureCompiler.py", line 145, in setupFile_featureTables
    filename=feapath)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/feaLib/builder.py", line 25, in addOpenTypeFeaturesFromString
    addOpenTypeFeatures(font, featurefile)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/feaLib/builder.py", line 16, in addOpenTypeFeatures
    builder.build()
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/feaLib/builder.py", line 78, in build
    self.parseTree = Parser(self.file, self.glyphMap).parse()
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/feaLib/parser.py", line 53, in parse
    statements.append(self.parse_markClass_())
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/feaLib/parser.py", line 500, in parse_markClass_
    self.expect_symbol_(";")
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/feaLib/parser.py", line 1330, in expect_symbol_
    self.cur_token_location_)
fontTools.feaLib.error.FeatureLibError: /tmp/master_ufo/Cantarell-Regular.ufo/features.fea:124:1: Expected ';'

The same file exports without errors from Glyphs. I used #anchors in constructing e.g. /n, is it related to that?

@anthrotype
Copy link
Member

Can you past here line 124 of your feature file?

Possibly related to adobe-type-tools/afdko#191

@madig
Copy link
Collaborator Author

madig commented Aug 20, 2017

The file is only 117 lines long. The last table is (with a lot of base glyph names omitted):

table GDEF {
  # automatic
  GlyphClassDef
    [A ... numero], # Base
    [f_f f_f_i f_f_l fi fl _O.OE _horncomb.O _stem.d _stem.b _shoulder.n _stem.n
 _stem.g _stem.q _stem.p _stem.h _a.ae _A.AE _stem.thorn _N.Eng _k _stem.kgreenl
andic], # Liga
    [dieresiscomb dotaccentcomb gravecomb acutecomb hungarumlautcomb caroncomb.a
lt circumflexcomb caroncomb brevecomb ringcomb tildecomb macroncomb hookabovecom
b dblgravecomb breveinvertedcomb commaturnedabovecomb horncomb dotbelowcomb dier
esisbelowcomb commaaccentcomb cedillacomb ogonekcomb brevebelowcomb macronbelowc
omb strokeshortcomb strokelongcomb slashshortcomb slashlongcomb], # Mark
    ;
} GDEF

@madig
Copy link
Collaborator Author

madig commented Nov 12, 2017

(Probably better tracked over at fonttools).

@madig madig closed this as completed Nov 12, 2017
@anthrotype anthrotype reopened this Nov 12, 2017
@anthrotype
Copy link
Member

anthrotype commented Nov 12, 2017

fonttools/fonttools#1100 (comment)

https://glyphsapp.com/blog/new-features-in-glyphs-2-3 -> "State of Component Alignment" says "If, however, you want to prevent Glyphs from generating the positioning code, you can now prefix the anchor name with a non-letter".

but that non-letter (e.g. "#") can make ufo2ft mark feature writer generate invalid FEA code leading to feaLib error.

@anthrotype anthrotype changed the title Build of custom font fails with feature file syntax error while it works in Glyphs non-letter anchor names raise feature syntax error Nov 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants