When reduce() receives an empty sequence, it raises TypeError, unless it is given a third 'initializer' argument
ValueFormat values should default to 0, so we shall use that as initializer.
Also, the reduce() built-in is no longer available on Python 3.
It's still accessible for both py2 and py3 from functools.
Fixes https://github.com/googlei18n/fontmake/issues/241
Also fixes issues with merging of PairPos.
Trying on Noto Sans Thai still fails, now because of issues in class differences in
PairPosFormat2. :( Investigating.
This is part of fixing https://github.com/fonttools/fonttools/issues/719
though, the changes are currently in interpolate_layout, and need to be ported /
merged with varLib.__init__ variation-font-builder.
The convention is that sys.exit(...) is called only if a module is run as a script,
and that main() entry points use return statements to report exit codes: 0 (or None)
for successful execution, or any non-zero integer for errors.
E.g. see the console scripts generated when installing with pip.
If a module is run as script, as in `python module.py` or when using
`runpy.run_module()`, then __name__ == "__main__".
So when we instantiate modules' loggers with `logging.getLogger(__name__)`,
those loggers' name may become "__main__" when run as scripts, and hence
fall outside of the "fontTools" logging namespace.
fontTools.configureLogger() by default only configures the "fontTools"
library loggers, anything outside of it (e.g. logger called "__main__")
is not attached a handler.
So here I name loggers explicitly instead of relying on __name__, but
only for modules which can be run as "__main__".
Fixes#801
In the OpenType 1.8 specification, this is called TupleVariation
so let's be consistent with the spec. (The initial implementation
in fonttools pre-dates OpenType 1.8).
We must coerce name strings with `tounicode` because, on Python 2, the ElementTree library that we use to parse the designspace's XML will return ASCII-encoded `bytes` (PY2 `str`) whenever it can; and only returns `unicode` (PY3 `str`) when strings can't be encoded as ASCII... :(
However the `addName` method requires unicode strings (it wouldn't be able to encode them with multiple platform-specific encodings otherwise).
So we decode bytes as ASCII before passing them to addName.
Was completely broken by 15dd7181b47b8c8225b6054c6bb257fab91eea1c as master location
tags were mismatched with fvar. Too bad gvar was silently ignoring that. Fix coming.
API Change:
This will change XML output for GSUB/GPOS/GDEF/MATH/BASE/JSTF/...
Scripts that set the Version for those to 1.0 or other float values
also need fixing. A warning is emitted when code or XML needs fix.