303 Commits

Author SHA1 Message Date
Behdad Esfahbod
633f44da39 [varLib.merger] Fix merging of PairPos Format2 with missing subtables 2018-01-08 10:49:25 +00:00
Behdad Esfahbod
e58499cc06 [varLib.merger] Minor 2018-01-08 10:31:50 +00:00
Behdad Esfahbod
b624e0c08e [varLib.merger] Handle missing PairPos format1/2 subtables in AligningMerger
Fixes https://github.com/fonttools/fonttools/issues/1125

The Format2 is still failing in my test case. Investigating.
2018-01-08 10:27:33 +00:00
Behdad Esfahbod
8af430997d [varLib] Start generating STAT table
Right now just reflects the axes, and even that with certain limitations:
- AxisOrdering is set to the order axes are defined,
- Name-table entries are not shared with fvar.

Towards https://github.com/LettError/designSpaceDocument/issues/8
2017-11-13 21:25:04 -08:00
Behdad Esfahbod
22f3b466b4 [varLib] Add TODO 2017-11-13 21:01:27 -08:00
Behdad Esfahbod
645b7a8355 [varLib] Pass fvar axis order ot VariationModel()
Update expected test results.
2017-10-25 15:43:47 -06:00
Behdad Esfahbod
3fbc4688eb [varLib.mutator] Drop GDEF is nothing left in it
Part of fixing https://github.com/fonttools/fonttools/pull/1079#issuecomment-338710803
2017-10-25 11:58:44 -04:00
Behdad Esfahbod
0b5a923ef8 [varLib.mutator] Fix mutating of ValueRecord objects
Part of fixing https://github.com/fonttools/fonttools/pull/1079#issuecomment-338710803
2017-10-25 11:58:32 -04:00
Behdad Esfahbod
69bbddea92 [varLib.mutator] Correctly unset Device entries that are None
Part of fixing https://github.com/fonttools/fonttools/pull/1079#issuecomment-338710803
2017-10-25 11:58:32 -04:00
Jens Kutilek
97a31eb34e Missed a change in return values 2017-10-22 17:56:12 -04:00
Cosimo Lupo
4bd57b9844 [mvar] rename MVAR_entries -> MVAR_ENTRIES
I like all-uppercase for global constants
2017-10-22 12:19:24 +01:00
Cosimo Lupo
28bb992c1f replace int(round(...)) with round(...)
We don't need to cast to int when using the round function from py23,
as this is a backport of python3's built-in round and thus it returns
an int when called with a single argument.
2017-10-22 12:03:52 +01:00
Behdad Esfahbod
5eb3cbe2b0 [varLib.mutator] Mutate GPOS
Cleans up GDEF varstore as well.

What's left:

- In none of the varLib.merger Mergers we handle the CaretValueFormat3. That should be done,
  even though no one uses this,

- GPOS/GSUB FeatureVariations are not applied.  Shouldn't be hard.

- 'rvrn' should be folded into 'ccmp' or some other default feature.
2017-10-20 20:13:14 -04:00
Behdad Esfahbod
e05ece2715 [varLib.varStore] Cache scalars in VarStoreInstancer 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
7494943c1b [varLib.varStore] Add VarStoreInstancer 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
8db7a65d39 [varLib.varStore] New module 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
117f8f0eb3 [varLib.mutator] Quantize normalized location to F2Dot14 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
1adacb34f0 [varLib.mutator] Apply avar 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
acd2f490af [mutator] Implement MVAR
Test expectation needs updating.  Leaving for someone else to confirm
the new value is correct and update the test.
2017-10-20 20:13:14 -04:00
Behdad Esfahbod
cca7a79018 [varLib] Adjust for supportScalar() default ot=True change
Fixup for 028ed0125244531215d4d774474d929acda14d49
2017-10-19 10:07:08 -07:00
justvanrossum
2f6ec32ff0 oops, forgot to adapt doctests; thanks @anthrotype\! 2017-10-18 10:29:19 +02:00
justvanrossum
028ed01252 set default value of the ot argument to True, as discussed in a1629fa52b 2017-10-18 10:04:42 +02:00
Behdad Esfahbod
9d4991e20c [varLib] Move MVAR data table to varLib.mvar 2017-10-17 11:09:50 -07:00
Behdad Esfahbod
f284b733a9 [varLib] Move IUP code into fontTools.varLib.iup 2017-10-15 18:16:01 -04:00
Cosimo Lupo
ca7c35900b [mutator] Add instantiateVariableFont public function
Towards addressing https://github.com/fonttools/fonttools/issues/1070

The new instantiateVariableFont function takes a variable TTFont and a
dictionary of axes locations and returns a static TTFont instance.

The current code modifies the varfont in-place. To adapt it for
generating multiple instances from the same varfont, for now I simply
resorted to making a copy (can be optionally disabled by setting
inplace=True).

Also, replaced print() with log.info().
2017-10-15 17:43:06 +02:00
Jens Kutilek
a25a401fd2 Merging TT hinting (#1069)
Merge cvts; copy fpgm, prep, glyf programs from base master if compatible.
2017-10-12 10:40:40 +02:00
Behdad Esfahbod
c91f0323db Rename CVTValues to arrayTools.Vector
This is generic, and useful in other cases.
2017-10-10 12:43:15 +02:00
Jens Kutilek
55cda3901c Only emit a cvar tuple if any delta is not zero. 2017-10-09 17:30:27 +02:00
Jens Kutilek
eaeb366810 Remove debug prints 2017-10-09 13:16:58 +02:00
Jens Kutilek
5b39aa7af2 Implement building cvar tables 2017-10-09 13:08:55 +02:00
Jens Kutilek
80414303d0 Add interpolation of cvt/cvar table 2017-10-05 13:32:06 +02:00
Cosimo Lupo
588f5246c0 [varLib] default to using "name" attribute if "labelname" is missing
Instead of raising AssertionError when users define custom axes
without explicit `<labelname xml:lang="en">ZZZZ</labelname>` element,
it's better to use the axis' name attribute, and treat it as "en"
language.

For example, if users generate the designspace from SuperPolator,
they can't edit the axis labelname attribute from the UI (or maybe
it's just me that couldn't figure out how to do it).
2017-09-15 16:49:16 -04:00
Cosimo Lupo
dfeacfba36 [varLib.models] minor
We need to use float (0.) rather than int (0) for the normalized axis
origin, otherwise some varLib roundtrip tests may fail.

E.g.

```diff
       <tuple>
-        <coord axis="wght" max="1.0" min="0.0" value="0.61"/>
+        <coord axis="wght" max="1.0" min="0" value="0.61"/>
```
2017-08-16 16:35:57 +01:00
Cosimo Lupo
04eacf13cd [varLib] include default maps for all avar axes, even without <map> elements
This is a follow-up to Jens' comment:

19c4b377b8 (commitcomment-23458151)

Now, if there's any axis that has 'interesting' segment maps (and thus
an avar table is added), we also ensure that for the rest of the axes
that aren't modified (either because no <map> elements are defined or
because an identity mapping is defined in the designspace), we always
have a non-empty segment maps array containing the three default maps:
{-1.0: -1.0, 0.0: 0.0, 1.0: 1.0}.

This is to work around CoreText and DirectWrite rendering issue with
empty avar segment maps arrays.
2017-08-16 16:30:11 +01:00
Behdad Esfahbod
f0c58ddf9b [varLib] Remove unused import 2017-08-09 21:43:44 -07:00
Behdad Esfahbod
a1629fa52b [varLib] Update supportScalar() to allow for OpenType-specific contraints
Part of https://github.com/fonttools/fonttools/issues/1020
2017-08-07 17:05:29 -07:00
justvanrossum
18fa7ccec0 supportScalar(): ignore an axis when its peak value is 0; fixes #1020 2017-08-07 13:16:24 +02:00
Erik van Blokland
4762865cac Makes it a bit easier to find out what is wrong with the values. 2017-08-05 20:37:37 +02:00
Behdad Esfahbod
b9151ffacb [varLib] Add assertions to make sure we merge similar ValueFormat2-zeroedness 2017-08-04 09:22:43 +01:00
Behdad Esfahbod
49f249b118 [varLib] Add faster tables first
Speeds up development speed :).
2017-08-04 09:07:38 +01:00
Behdad Esfahbod
f3031ce797 [varLib] Add comment 2017-08-04 08:55:34 +01:00
Behdad Esfahbod
010ea47de1 [varLib] Minor rename 2017-08-04 08:41:29 +01:00
Cosimo Lupo
b5ab6d3af3 [varLib] temporary workaround to make MVAR tests pass
https://travis-ci.org/fonttools/fonttools/jobs/260671300#L2519-L2519

Behdad will revert this later
2017-08-03 17:57:16 +01:00
Cosimo Lupo
74035147a0 [varLib] remove unused 'instances' argument in _add_avar 2017-08-03 14:57:02 +01:00
Behdad Esfahbod
3746f75d7f [varLib] Split _add_fvar_avar() into _add_fvar() and _add_avar() 2017-08-03 12:38:23 +01:00
Cosimo Lupo
19c4b377b8 [varLib] add predefined avar mappings to fix rendering in CoreText
Fixes https://github.com/googlei18n/fontmake/issues/295
2017-08-02 15:12:26 +01:00
Behdad Esfahbod
c55ef5257d [varLib] Flatten multiple tail PairPosFormat2 subtables before merging
Reuses the aligner.  Neat.
2017-08-01 19:06:40 +01:00
Behdad Esfahbod
eca0c441d1 [varLib] Factor out PairPosFormat2 matrix alignment code 2017-08-01 19:06:40 +01:00
Behdad Esfahbod
f2a1f3446b [varLib] Minor 2017-08-01 19:06:40 +01:00
Cosimo Lupo
ca1bb10aa8 [varLib] test avar mappings are 'interesting' after normalizing values
otherwise we could end up with unnecessary avar tables only containing
the standard maps.
2017-08-01 12:08:44 +01:00