Fixes https://github.com/fonttools/fonttools/issues/457
Backslash-prefixed glyph name can be used in a Feature file to distinguish them from identically-named keywords.
From section "2.f.i. Glyph name" of Adobe's Feature File Specification:
> An initial backslash serves to differentiate a glyph name from an identical keyword in the feature file language. For example, a glyph named "table" must be specified in the feature file as: \table
Thus, when we parse a glyph name that begins with a backslash, we need to ignore the first character.
Note that makeotf rejects feature files with glyph names that start with or contain backslashes, even when escaped with another backslash.
feature liga {
sub \\glyphWithBackslash by A;
} liga;
This yields:
makeotfexe [FATAL] <Backslash-Regular> invalid token (text was "\") [features 2]
http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html#10
For example, @mhosken is interested in experimenting with inlining
custom syntax (such as Python snippets) into feature files. After this
change, such experiments can be done on top of feaLib because the
Abstract Syntax Tree now contains the tag and content of `anonymous`
blocks.
* feaLib: limit language statements to 1 feature block
language exclude_dflt statements should only apply to lookups
defined in their feature block and not to lookups defined
in previous blocks sharing the same feature tag
* feaLib: add BuilderTest::test_FeatureFile_multiple_feature_blocks
Before, if someone tried to set the language before setting the script
a None/language language system would be created (with actual tag
"None" stored in the feature table). This defaults to tag DFLT and
fails when a non-dflt language is set for DFLT, since that's illegal.
This is to fix what I think was a misunderstanding of the exclude_dflt
keyword (and the implicit include_dflt option active by default).
Rather than including the following lookups in the default language
systems, I think it is used to include the lookups specific to default
language systems in the system defined by the current language
statement. Thus instead of registering a lookup in all default
systems when include_dflt is true, we should exclude the lookups
registered with default systems from the current system when
include_dflt is false.
Since py23 modifies some essential builtins, it's safe to import
everything all the time. At least, that's how it was designed.
It's a bug if importing * breaks some code.
'featurefile' can be either a path (string) or a file object, like in TTFont or XMLReader and XMLWriter constructors.
If a file object does not have a 'name' attribute, a default "<features>" name is
used and the current working directory is assumed as the root for relative includes.