Commits 3063def and 5b47971 introduced a separate fontDictOperators list for FontDict, only listing those TopDict key/value pairs that are actually used in the FontDict context. It provided a fallback that TTX files containing such "useless" key/value pairs would not be rejected.
However, the code still rejected binary fonts that contained such values, even though it didn't before, and yes, such fonts exist. Also: such fonts are not broken per spec, they just contain some fields that otherwise no one ever looks at, so it's a little harsh to reject them.
This patch removes most of the special FontDict code, and uses everything from TopDict, *except* the order attribute: it sets that to a list of the relevant keys for the FontDict. The effect of this is that "useless" key/value pairs are ignored, not just upon reading XML, but also upon decompilation and compilation of binary fonts. It improves on the previous XML reading behavior in that it no longer silently ignores key typos in the TTX input.
Ideally, we would *output* everything that is actually in the FontDict to TTX, and only ignore the values when compiling, but I didn't find a clean solution for that, so I decided to just fix the issue.
Fixes https://github.com/fonttools/fonttools/issues/739
for now, though proper fix is more complicated.
This was hit now because the subsetter was changed a while back
to retain script systems even if empty... I don't like that.
I had forgotten to bump the version for 3.2.0... Sorry :(
This is not a problem for the released packages, since versioneer correctly writes the tagged version.
It's only the hard-coded version string that's used as a fallback if git fails to compute the version which I forgot to update.
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]
ttx is now equivalent to:
$ fonttools ttx
pyftsubset can be called as:
$ fonttools subset
varLib can be called as:
$ fonttools.varLib
Also adds a executable at toplevel called fonttools, such that
with "./fonttools ..." one can run stuff without installing.
Python seems to automatically include ./Lib into its search path.
The table structure requires that all named instances have the same
record size. Slightly refactored the compilation code to make the
logic easier to understand/maintain.