772 Commits

Author SHA1 Message Date
Behdad Esfahbod
dd6fb82d66 [varLib] Move common code into a parent merger 2017-01-25 20:43:00 -08:00
Behdad Esfahbod
fece08bc32 [varLib] Enable subclassing of mergers
Theoretically diamond shapes and mixins should work as well.
2017-01-25 20:39:21 -08:00
Behdad Esfahbod
a34a7c906e [varLib] Towards making subclassed mergers working 2017-01-25 20:30:44 -08:00
Behdad Esfahbod
5e1be9e5e7 [varLib] Move code around 2017-01-25 20:11:35 -08:00
Behdad Esfahbod
2532fac11f [varLib] Improve assert fail breadcrumbs 2017-01-25 19:00:08 -08:00
Behdad Esfahbod
1631c5c941 [varLib.interpolate_layout] Implement flattening of multiple PairPosFormat1 subtables
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.
2017-01-18 18:42:45 -08:00
Behdad Esfahbod
d38ecf02ec [varLib] Minor 2017-01-18 18:42:45 -08:00
Cosimo Lupo
78ad48eaf3
Move all *_test.py modules and test data to external Tests/ folder 2017-01-16 09:14:12 +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
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
Cosimo Lupo
7ec4fd0605
[varLib] replace print() with logging
Fixes #795
2017-01-09 10:37:47 +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
Sascha Brawer
1d28abdb65 [gvar] Rename GlyphVariation to TupleVariation
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).
2017-01-04 12:41:55 +01:00
Behdad Esfahbod
cada4607fb [varLib] Use "VF" (for variable-font" instead of "GX" in output name 2016-12-08 20:48:08 -08:00
justvanrossum
289fd62d8f added assert, as suggested by @behdad in #749 2016-12-02 14:24:46 +01:00
justvanrossum
e5d2d49900 two more doctests 2016-11-29 14:42:20 +01:00
justvanrossum
8fa2ee1d95 Do the capping before calculating the normalized value to avoid ZeroDivisionError when default == lower or default == upper. Added doctests to verify. Fixes #749 2016-11-29 14:38:46 +01:00
Behdad Esfahbod
7915a45ddf [varLib] Handle fonts without GPOS
Fixes https://github.com/fonttools/fonttools/issues/699
2016-11-08 15:44:39 -08:00
Rob McKaughan
1bebcec00d Do not emit null axes in fvar (default==min==max) 2016-11-04 14:53:43 -07:00
Cosimo Lupo
df967e70fc
varLib: rename --buildHVAR option to --build-HVAR; add 'build_HVAR=False' kwarg to 'build' function
better not having to pass an argparse.Namespace object to varLib.build
2016-11-03 10:59:00 +00:00
Rob McKaughan
bdbb8c5374 Add commandline switch to build HVAR 2016-11-02 20:54:50 -07:00
Behdad Esfahbod
b4ebe12b31 [varLib] Reenable HVAR for CFF2 fonts
https://github.com/fonttools/fonttools/issues/705
2016-10-31 16:15:24 -07:00
Behdad Esfahbod
ea958e72e4 [varLib] Implement effective-kern-pair from PairPosFormat2 2016-10-23 14:09:49 +02:00
Behdad Esfahbod
b563e6673c [varLib] Implement GPOS binary interpolation for PairPosFormat1 2016-10-22 22:47:18 +02:00
Behdad Esfahbod
72f5cb8579 Fixup 2016-10-13 15:59:25 -07:00
Behdad Esfahbod
37dbb77c67 Make varLib module callable 2016-10-13 15:43:19 -07:00
Behdad Esfahbod
b39772b256 [varLib] Fix interpolate_layout for non-similar SinglePos
Has to be ported to varfont merger as well.
2016-10-12 16:11:20 -07:00
Behdad Esfahbod
b9c38af1ff Disable HVAR generation until I fix it
https://github.com/fonttools/fonttools/issues/705
2016-10-12 13:30:52 -07:00
Behdad Esfahbod
12d4f277d7 [varLib.merger] Towards supporting merging individual attributes 2016-10-11 20:39:22 -07:00
James Godfrey-Kittle
1e8e17e753 [varLib] Define an interpolate_layout method 2016-10-06 17:33:07 -07:00
James Godfrey-Kittle
6f6106ef6c [varLib] Rename interpolate-layout to be loadable 2016-10-06 17:32:37 -07:00
Behdad Esfahbod
b5d7eb8fd4 [varLib] Show failure path when merging fails 2016-10-05 17:03:48 -07:00
Cosimo Lupo
53dce87b03 Merge pull request #688 from fonttools/fix-varlib-names
Fix varlib names
2016-10-05 19:23:10 +01:00
Behdad Esfahbod
87e07bc4c4 [varLib] Add kerning merger for interpolate-layout.py 2016-10-04 17:46:22 -07:00
Cosimo Lupo
79d755a837 [varLib] use both Macintosh and Windows names for fvar names; use addName method from _n_a_m_e.NameRecord; use unicode_literals
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.
2016-10-04 17:08:29 +01:00
Behdad Esfahbod
e8117f6443 [varLib] Merge same-structured kerning lookups
Code from Read Roberts.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
caa353d5dd [varStore] Generate variation for Anchors and store in GDEF
Finally!  Phew...
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
cfd7bfbb2c [varLib] Start creating variations for GPOS using Merger 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
60e8bab524 [varLib] Unbreak gvar generation
Was completely broken by 15dd7181b47b8c8225b6054c6bb257fab91eea1c as master location
tags were mismatched with fvar.  Too bad gvar was silently ignoring that.  Fix coming.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
e713f75930 [varLib] Add gvar only if base font has glyf table 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
0546a4296b [varLib] Fix typo 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
ecce5cf344 [varLib] Minor 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
9ea16fc0eb [verLib] Add a proper Merger class in varLib.merger 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
cdc6035fdf Add varLib.merger 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
1bb7605973 [varLib] Remove unused code 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
402d726692 [ot] Change Version to be an integer instead of float
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.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
ae93928275 [varLib] Rename fields in fvar, to accommodate for postscriptNameID 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
8e675db59b [varLib] Fix loading of designspace instances 2016-09-27 19:49:41 +02:00