We should probably use cliTools.makeOutputFileName here for consistency with ttx,
but I know some prefer the approach taken by pyftsubset so I don't want force this.
Howver, I find it a bit annoying that when one is too lazy (like me) to specify
the --output-file=, the subsetter outputs a file ending with an invalid ".subset" extension, which Finder or Windows Explorer don't recongize as a font, and so one has to rename it anyway.
This makes the '.subset' string is inserted between the file name and its original extension (if any).
The code in main() assumes that the first of the args which are not consumed by Options.parse_opts(args) is the positional argument (ie. does not start with '--') for the input font file, and that is what the usage() says too.
However I find it myself writing --options=... first, and then at the end the positional arguments, as is the convention for many other Unix tools.
This patch makes this possible, while also keeping the current behavior.
Rounding of coordinates is now disabled by default.
The pen now accepts an optional 'roundTolerance' float, with values between
0 and 1 (default is 0).
Values >= 0.5 mean round all coordinates to integers.
Values between 0 and 0.5 mean round only when the absolute difference
between the original float and the rounded integer is within the tolerance
Fixes#769
* [feaLib.ast] fix checking multiple markClass definitions don't redefine same glyphs
As pointed out by @mhosken, we are looking in the wrong list for glyphs
that have already been defined in a previous markClass definition.
With this patch, the current markClass.fea test case fails becuase it defines 'acute'
twice for the same @TOP_MARKS class:
fontTools.feaLib.error.FeatureLibError: Lib/fontTools/feaLib/testdata/markClass.fea:6:5: Glyph acute already defined at Lib/fontTools/feaLib/testdata/markClass.fea:3:1
Also see conversation at:
3b79d51755 (r94622074)
* feaLib/testdat/markClass.fea: remove duplicate 'acute' in @TOP_MARKS
Now the test pass, after 45c77b7
* [feaLib.builder_test] test case for redefined glyph in multiple markClass definitions
This should be a bit more efficient as we don't need to create a temporary list
object before passing it to "".join() method of str; the latter accepts any
Iterable
Apparently on some BSD systems man pages go to /usr/man instead of /usr/share/man.
It's too complicated to keep track of all the nuances of Linux distros so package maintainers can simply override the default via a $FONTTOOLS_MANPATH env variable
Fixes#84
it's better to group man pages in a separate sub-folder in case we add alternative doc formats in the future, or if we add additional man pages.
This also allows to read man pages directly from the source tree, e.g. via `export MANPATH=Doc/man`, or `man -M Doc/man ttx`
It's not a good thing that we build different wheel packages (with/without data_files) according to the platform we build them with.
After all, these wheels are meant to be "universal".
Even when manpages can't be used on a target platform (e.g. Windows), their mere presence should not do any harm; they are simply copied to a 'share/man' folder relative to the python prefix. On Unix systems (Linux, Homebrew, etc.) this is usually `/usr` or `/usr/local`, so `man ttx` just works (TM).
Note that other popular python tools like IPython or Sympy also install manpages the same way we do here with ttx, and they do that unconditionally for all platforms.
As regards issue #796, whereby attempting to `sudo pip install fonttools` fails because the manpage file is copied to a SIP-protected location on OSX El Capitan and above:
Users who still wish to install fonttools globally with sudo (and are not scared after googling 'why sudo pip is bad'), can still use the '--install-data' option of setup.py install to modify the data_files base installation directory.
If you install with pip (recommended over `python setup.py install`), you can use --install-option to pass through installation options to setup.py (which is run by pip when installing from source).
For example, to install man pages to /usr/local/share/man/man1/*.1 you could pass "/usr/local" as the base directory for --install-data, like so:
sudo -H /usr/bin/python -m pip install --install-option="--install-data=/usr/local" fonttools
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