3482 Commits

Author SHA1 Message Date
Cosimo Lupo
a8cafa3600
Update changelog 2017-01-12 11:15:57 +00:00
Cosimo Lupo
2a4b3d5814
[Snippets] add otf2ttf.py using cu2qu for CFF -> TrueType conversion
See discussion at https://github.com/fonttools/fonttools/issues/802

Derived from:
https://github.com/googlei18n/cu2qu/issues/47
2017-01-12 11:02:41 +00:00
Sascha Brawer
3ef8b0dbba [gvar] Add unit tests for gvar.fromXML() and gvar.toXML() 2017-01-11 15:35:56 +01:00
Sascha Brawer
963b63b536 [cvar] Mention implementation of cvar table in NEWS 2017-01-11 15:18:41 +01:00
Sascha Brawer
f5465d6d6e [gvar] Add unit tests for gvar.compile() and gvar.decompile() 2017-01-11 15:15:44 +01:00
Cosimo Lupo
64bdb589c4 Merge pull request #799 from anthrotype/man-page-install-dir
always install manpage; allow to override destination via env var
2017-01-11 13:21:24 +00:00
Cosimo Lupo
dcc95e10d9
Update changelog 2017-01-11 13:18:58 +00:00
Cosimo Lupo
530533ec60
setup.py: allow to override default "share/man" via environment variable
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
2017-01-11 13:18:57 +00:00
Cosimo Lupo
46fdd14bb1
[Doc] move man pages to Doc/man/man1 sub-folder
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`
2017-01-11 13:18:57 +00:00
Cosimo Lupo
fb6d3f6356
setup.py: always install ttx manpage (even when not used); remove platform-specific branch
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
2017-01-11 13:18:57 +00:00
Cosimo Lupo
49bcbb916b
consistently do sys.exit(unittest.main()) in all test modules
So that when run as scrips they report test failures with exit code

Follow up on b7bb391033ef3255c90134da3d7aef50d2d5326d
2017-01-11 13:05:35 +00:00
Cosimo Lupo
2e2125f173
[minor] remove redundant sys import 2017-01-11 12:24:04 +00:00
Cosimo Lupo
e5dbc85463
[mtiLib] add __main__.py to allow running package as module
This now works:

$ fonttools mtiLib

or which is the same:

$ python -m fontTools.mtiLib
2017-01-11 12:15:33 +00:00
Cosimo Lupo
b7bb391033
don't use sys.exit(...) inside main(), but only under if __name__ == "__main__"
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.
2017-01-11 12:10:58 +00:00
Cosimo Lupo
ae05b2a583
[logging] for runnable modules, spell out module name instead of using __name__
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
2017-01-11 11:58:17 +00:00
Behdad Esfahbod
0cc1721b8d [MVAR] Update for OT 1.8.1 rename 2017-01-10 11:01:06 -08:00
Behdad Esfahbod
84c584cfc9 [cmap] When compiling format 0, fill in non-existing entries
Fixup for 88026de5100e4b3cedf0424bcc033f76782eb99e

Fixes https://github.com/fonttools/fonttools/issues/800
2017-01-10 10:48:48 -08:00
Sascha Brawer
155ec67ae6 [cvar] Implement cvar table 2017-01-10 17:57:04 +01:00
Sascha Brawer
7dd5c6e358 [cvar] Add test case for round-tripping TupleVariationStore for cvar 2017-01-10 10:52:19 +01:00
Sascha Brawer
6a67c6ee0f [cvar] Fix crashing cvar compilation if deltas are None 2017-01-10 10:45:41 +01:00
Sascha Brawer
317c26418a [cvar] Compile tuple variations whose deltas affect constants 2017-01-10 10:10:21 +01:00
Sascha Brawer
552b72c3d6 [gvar] Cosmetic cleanup of unit tests 2017-01-10 10:10:21 +01:00
Behdad Esfahbod
3e5335d335 When promoting a lookup to Extension type, set LookupType
Fixes https://github.com/fonttools/fonttools/issues/798
2017-01-09 19:52:32 -08:00
Sascha Brawer
689008a4f5 [gvar/cvar] Rename decompileVariationTuples to decompileVariationTupleStore
For consistency with the terminology of the OpenType 1.8 specification,
and for symetry with the compileVariationTupleStore function.
2017-01-09 19:00:39 +01:00
Sascha Brawer
5d3eae404c [cvar] Compile TupleVariationStores in common library 2017-01-09 17:34:45 +01:00
Sascha Brawer
c3d68a684e [cvar] Move compileSharedTuples() to module TupleVariation 2017-01-09 17:01:43 +01:00
Sascha Brawer
87d854e881 [cvar] Move decompilation of shared tuples to TupleVariation.py 2017-01-09 14:25:16 +01:00
Sascha Brawer
24a02fedd7 [cvar] Refactor decompilation of tuple variation stores 2017-01-09 14:05:52 +01:00
Sascha Brawer
625460836a [cvar] Pass table tag to point decompilation routine 2017-01-09 13:23:51 +01:00
Sascha Brawer
de55ab2889 [cvar] Rename numPointsInGlyph to pointCount so it works for cvar
There are no glyphs in the `cvar` table.
2017-01-09 13:21:51 +01:00
Sascha Brawer
7c082600d3 [cvar] Move decompilation for single TupleVariation out of gvar
Rename local variables to match terminology of OpenType 1.8 specification
2017-01-09 12:14:12 +01:00
Cosimo Lupo
7ec4fd0605
[varLib] replace print() with logging
Fixes #795
2017-01-09 10:37:47 +00:00
Cosimo Lupo
c0a30f8372
Update changelog 2017-01-09 10:35:40 +00:00
Cosimo Lupo
4af078a629
[varLib] re-enable building HVAR for TTFs; remove --build-HVAR option
The option was meant to be temporary, and is no longer needed since
https://github.com/fonttools/fonttools/issues/705 is now fixed.
2017-01-09 10:34:34 +00:00
Cosimo Lupo
06f3690a6c
Update changelog 2017-01-09 10:25:16 +00:00
Behdad Esfahbod
dc1a3bdb1d [OS/2] Don't fail if font does not have cmap table 2017-01-09 01:09:21 -08:00
Behdad Esfahbod
aeafda539b Oops! 2017-01-09 00:38:46 -08:00
Behdad Esfahbod
e4d88b5a38 Extra protection
Fixes https://github.com/fonttools/fonttools/issues/797
Although for the XML->binary case, that bug was already fixed
on master because of the XML populate-default changes.
This adds extra protection!
2017-01-08 23:47:29 -08:00
Behdad Esfahbod
80535c224e Fix XML->binary when LookupOrder is NOT specified
Fix for 495c6831e19ff9992fb801d2930e79c7d13736ae; bringing the intended
behavior documented in that commit.
2017-01-08 23:45:03 -08:00
Sascha Brawer
7f9ab7fc7f [gvar] Remove unused function 2017-01-05 17:54:38 +01:00
Sascha Brawer
f5a679661d [gvar] Use ttLib accessors for importing module and module class 2017-01-05 17:40:39 +01:00
Sascha Brawer
980ee57b0e [gvar] Rename gvar.decompileSharedCoords() to decompileSharedTuples()
The new name is consistent with the terminology of the OpenType 1.8
specification, which calls the decoded structure the `SharedTuples`
array.
2017-01-05 14:18:52 +01:00
Sascha Brawer
039cb48927 [gvar] Move gvar.computeMinMaxCoord() to TupleVariation.inferRegion()
Document what this helper function does, using terminology from
the OpenType 1.8 specification.
2017-01-05 13:35:27 +01:00
Sascha Brawer
39c4ef621c [cvar] Change warning message for out-of-range points 2017-01-05 08:55:36 +01:00
Cosimo Lupo
26679a9d73
feaLib.builder: fix order of {from,to}file arguments of difflib.unified_diff 2017-01-04 22:01:40 +01:00
Sascha Brawer
6275668840 [cvar] Support XML input/output for TupleVariations on constant values
OpenType TupleVariations can be used in two places:

* In the `gvar` table, they modify glyph contour points by shifting
  them towards a point in 2D space.

* In the `cvar` table, they modify constant values.

Before this change, we only had code to handle the `gvar` version
which shifts points around by delta values.

After this change, the XML parsing and generation routines of
TupleVariations can handle deltas that modify constant values in the
CVT table, as used in `cvar`.

An upcoming change will add support for the binary encoding of
TupleVariations as needed for `cvar`.
2017-01-04 18:16:14 +01:00
Sascha Brawer
01f95fc190 [gvar] Rename header fields to match OpenType specification
The initial implementation had been written with Apple's TrueType
specification, before OpenType supported variations.
2017-01-04 16:24:32 +01:00
Sascha Brawer
271987a89f [gvar] Adjust comment about broken variation fonts on macOS 2017-01-04 14:31:52 +01:00
Sascha Brawer
3420bb116c [gvar] Move TupleVariation to its own source file
The TupleVariation structure is used both for `gvar` and `cvar`.
2017-01-04 14:07:38 +01:00
Sascha Brawer
04d10cceaa [gvar] Mention renaming of GlyphVariation to TupleVariation in NEWS 2017-01-04 14:07:38 +01:00