348 Commits

Author SHA1 Message Date
Behdad Esfahbod
51fd216c62 [varLib] Towards encoding all name languages 2017-04-12 21:54:43 -07:00
Behdad Esfahbod
80c020d260 [varLib] Remove "custom" axis
This was added before when glyphsLib was always exporting the (unused)
custom axis.  It doesn't now, so remove.
2017-04-12 21:54:43 -07:00
Behdad Esfahbod
242faa798a [varLib] Remove unused build(..., axisMap) argument
Axis map should be specified in designspace file now.
2017-04-12 21:54:43 -07:00
Behdad Esfahbod
c922962056 [varLib] Minor 2017-04-12 21:54:43 -07:00
Behdad Esfahbod
8c62165008 [varLib] Build MVAR table
Does not implement gasp table variations, but the rest should work.
2017-04-11 11:10:54 -07:00
Behdad Esfahbod
43060a0d08 [varLib] Do not encode gvar deltas if all values smaller than tolerance
Tolerance is set to .5 by default.  Most designspaces never hit this since
for most, all deltas are integers anyway.  Moreover, all such detas will
round to zero anyway.
2017-04-05 15:43:14 +02:00
Behdad Esfahbod
b572ae6c5b [varLib] Do not encode gvar deltas that are all zeroes 2017-04-05 15:43:14 +02:00
Miguel Sousa
7bf853ed2e [varLib] Round advance width and LSB to integers 2017-03-04 12:54:20 -08:00
Miguel Sousa
3dc8e4fa95 minor change 2017-02-28 05:16:15 -08:00
Cosimo Lupo
c131bd93f6
[varLib] Fix AttributeError: odict.keys() has no index attribute 'index'
43efa63732 (commitcomment-21073943)
2017-02-27 19:17:04 +00:00
Cosimo Lupo
01d8145288
[varLib] fix undefined name 'masters'
Ouch!
2017-02-27 18:31:38 +00:00
Cosimo Lupo
558e5e172d
[varLib] raise VarLibError if 'sources' missing or empty; treat 'axes' and 'instances' as optional 2017-02-27 16:34:41 +00:00
Cosimo Lupo
ae58d3872c Merge pull request #864 from miguelsousa/pr857-followup
Followup to PR #857
2017-02-26 16:44:18 +00:00
Miguel Sousa
f061231049 [varLib] Make designspace.load() return a dictionary instead of a tuple 2017-02-26 07:49:44 -08:00
Miguel Sousa
43efa63732 [varLib] Build axes according to ’axes’ element in designspace file 2017-02-25 20:53:48 -08:00
Behdad Esfahbod
76e73f0ee4 [varLib] Remove TODO item 2017-02-25 10:59:31 -08:00
ReadRoberts
69ae7f0da5 Python2 .5-> Python3/2.7: "axes.has_key(iden)" -> "iden in axes" 2017-02-24 08:58:39 -08:00
ReadRoberts
33177bf65b If the design space file uses an <axes> element, use this to define the axis map, and preserve the axis order. 2017-02-22 21:22:34 -08:00
Behdad Esfahbod
55a5ace5d8 [varLib] Update invocation command 2017-02-22 14:46:23 -06:00
Sascha Brawer
c436365cef [varLib] Add missing import
After this change, the command line mentioned in the comment at the
beginning of the file works again.
2017-02-22 20:18:05 +01:00
Behdad Esfahbod
dd6fb82d66 [varLib] Move common code into a parent merger 2017-01-25 20:43:00 -08:00
Behdad Esfahbod
5e1be9e5e7 [varLib] Move code around 2017-01-25 20:11:35 -08: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
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
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
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
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
24346aaa88 [varLib] Store name entries with Windows English encoding instead of MacRoman 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
4e5145ac41 [varLib] Move code around 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
d916e18595 [varLib] Refactor main() code into build() 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
06b1840866 [varLib] Move code around 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
4fc2a3e5e1 [varLib] Move code around 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
c5ad2cb267 [varLib] Explicitly round values
It's annoying that python2's struct module doesn't err if float
is passed to it for an integer, whereas python3 does.
2016-09-27 19:49:41 +02:00