FEA parser and glyph names containing hyphens
See original GitHub issueConsider this feature file,
@A_CLASS = [ pre-post ];
I get a traceback when trying to parse it with this snippet,
from fontTools.feaLib.parser import Parser
with open('file.fea') as fea_file:
parser = Parser(fea_file)
doc = parser.parse()
print(doc.asFea())
Traceback (most recent call last):
File "fea_parse.py", line 7, in <module>
doc = parser.parse()
File "fontTools/feaLib/parser.py", line 61, in parse
statements.append(self.parse_glyphclass_definition_())
File "fontTools/feaLib/parser.py", line 221, in parse_glyphclass_definition_
glyphs = self.parse_glyphclass_(accept_glyphname=False)
File "fontTools/feaLib/parser.py", line 294, in parse_glyphclass_
start, limit = self.split_glyph_range_(glyph, location)
File "fontTools/feaLib/parser.py", line 259, in split_glyph_range_
"into a range of known glyphs" % name, location)
fontTools.feaLib.error.FeatureLibError: file.fea:2:14: "pre-post" is not a glyph in the font, and it can not be split into a range of known glyphs
However, all is fine if I initialize the parser with the glyphNames
argument,
parser = Parser(fea_file, glyphNames=['pre-post'])
Is this by design, or does the parser not fully support glyph names that contain hyphens?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
feaLib: Read/write OpenType feature files - fontTools
fontTools' feaLib allows for the creation and parsing of Adobe Font Development Kit for ... help to disambiguate ranges from glyph names containing...
Read more >End-of-line hyphenation of chemical names (IUPAC ...
A chemical name containing hyphens should preferably be divided at a hyphen that is part of the name. However, not every hyphen in...
Read more >Hyphens in glyph names are illegal
I'd like to use cross-app-compatible friendly glyph names, unfortunately hyphens can't be used…
Read more >Editing Fonts > Editing Fonts > Glyph Names - High-Logic
If a glyph name is used in an OpenType script, it could cause issues with the parser if it contains specific characters. One...
Read more >OpenType Feature File Specification | afdko - GitHub Pages
An OpenType feature file is a text file that contains the typographic layout ... Distinguishes glyph names from an identical keyword - hyphen...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it’s a logical consequence of changing the language to allow hyphens so late in the game. The hyphen had a meaning before (a range) and now there’s an ambiguity that can only be resolved in a bw compatible way with knowledge of the glyph set.
Personally, I wouldn’t have strong opinions, but (as with similar requests) I don’t think we should make incompatible changes without very good reasons. So, my process recommendation would be:
Otherwise, you’ll fragment the file format, which would hurt everyone.