5188 Commits

Author SHA1 Message Date
Chris Simpkins
3e7b33c22f fix invalid path in ttx test 2018-05-14 17:15:28 -04:00
Chris Simpkins
1404624f3c ttx tests: add tests for Options, ttCompile, ttList, main 2018-05-14 16:39:23 -04:00
Chris Simpkins
cf5b31e9c6 add zopfli to tox testing dependencies 2018-05-14 07:51:20 -04:00
Cosimo Lupo
ceb41ec484 WIP: implement conditionSets in designspaceLib.RuleDescriptor (#1255)
* [designspaceLib] WIP: add conditionSets to RuleDescriptor...

the BaseDocReader still needs to be updated to be able to read both
legacy condition-without-conditionset and new-style conditionset
elements.

* test_rules: replace rule.conditions with conditionSets

* Tests: update test.designspace to use conditionset; replace 'with' with 'byname' in sub element

I don't like too much that now 'byname' precedes alphabetically 'name'.
We need to see if ElementTree allows to sort attribute arbitrarily

* Change versionnumber to 4.0 - would that be enough, or should there be seperate major / minor fields?
If we bump the version up to numeral 4, I'd like the check for the with / byname attributes. We can read the old `byname` and only write the new `with`.
Remove support for `initial` in axis attributes.

* WIP - formatversion, with attribute,

* WIP
anything that is not version 4.0 is version 3.0
added some local paths to the test so I can see what it's generating. I can take this out later.

* WIP
read the conditionsets properly. This makes the tests fail no longer.

* WIP
disambiguate axis tags from axis names. Test axes are now called "axisName_x", tags are called "TAGX"

* WIP forgot to push

* WIP
Raise `DesignSpaceDocumentError` when no maximum or minimum are given in a condition.
Add test for such an incomplete rule.
Remove path cruft.

* WIP improved test of raised error.

* WIP because no bot.

* WIP more spaces around percents.

* WIP - don't skip empty subs, just load whatever is there.

* WIP do not permit empty axes in a location when evaluating a rule. Fix some tests.

* WIP missed a str(tempdir), some rule tests.

* WIP proposal for changes to the designspace spec to the `rule` and `sub` elements.

* WIP edits.

* WIP. Typo.
2018-05-14 11:29:48 +02:00
ReadRoberts
4da8f43eeb
[varLib] Fix bug in varLib.build() for CFF2.
The logic should attempt to build a cvar table only if there is a glyf table. This stack dumps when the font is a CFF2 font.
2018-05-10 10:12:28 +01:00
Behdad Esfahbod
f3c06fba3f Revert "[subset] Set to None empty Coverage tables in MarkGlyphSets"
This reverts commit 02616ab9b39d2e9618baebc4e051ae0a85200751.

Make OTS happy. Phew.
https://github.com/khaledhosny/ots/issues/172
2018-05-08 16:28:17 -07:00
Behdad Esfahbod
2ab38f9ba4 [subset] Handle None coverages in MarkGlyphSets 2018-05-08 15:24:36 -07:00
Cosimo Lupo
ca92b172f5
ttFont: allow to build glyph order without post nor cmap, just maxp.numGlyphs
could be useful to read in incomplete sfnt fonts e.g. containing only GPOS or GSUB tables
and a bare maxp table with the numGlyphs
2018-05-06 15:33:18 +01:00
Jens Kutilek
ae4472860f No need to use .keys() 2018-05-04 13:37:59 +02:00
Jens Kutilek
4a16d1839d Add __len__ method to TTFont._TTGlyphSet 2018-05-04 13:12:18 +02:00
Cosimo Lupo
a2f21a2155
Bump version: 3.26.0 → 3.26.1.dev0 2018-05-03 16:10:00 +01:00
Cosimo Lupo
e7e2bb9312
Release 3.26.0 2018-05-03 16:09:59 +01:00
Cosimo Lupo
7508aab346
Update changelog 2018-05-03 16:07:37 +01:00
Cosimo Lupo
28bd06a8de
README.rst: place gitter badge at the top next to the others
[ci skip]
2018-05-03 14:23:21 +01:00
Cosimo Lupo
1a42fa9e8a
Merge pull request #1256 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.rst
2018-05-03 14:21:04 +01:00
The Gitter Badger
e899eab92b Add Gitter badge 2018-05-03 13:19:14 +00:00
Cosimo Lupo
f82ef7a410
[Doc/designspaceLib] mention list of 'subs' in RuleDescriptor 2018-05-03 12:27:50 +01:00
Cosimo Lupo
23af3227b7
[Doc/designspaceLib] mark rule 'name' as optional 2018-05-03 11:51:18 +01:00
Cosimo Lupo
162ad1c842
Merge pull request #1254 from fonttools/designspacelib-conditionset-spec
designspaceLib: This adds conditionsets to the rule element.
2018-05-03 11:35:14 +01:00
Erik van Blokland
6958481eb0
Merge pull request #1253 from fonttools/designspacelib-layer-spec
Designspacelib layer spec
2018-05-03 10:32:57 +02:00
Erik van Blokland
c79a4326ac Remove old test. 2018-05-03 10:04:07 +02:00
Erik van Blokland
066a9c9061 This adds conditionsets to the rule element. 2018-04-29 12:23:19 +02:00
Erik van Blokland
1fededb376 Changed sourceDescriptor object attribute to layerName.
Changed non-standard axis name to all caps.
2018-04-28 13:01:25 +02:00
Behdad Esfahbod
0ecf5c5c94 [varLib.models] Refine modeling one last time
In a523a697164a4 I changed the model such that when computing master
supports and we hit another master, cut the box in one dimension only,
to avoid interferring with other master.  The axis to cut against was
chosen as axis that minimizes volume loss.  That was fine in a sense,
but missed a great amount of information resulting from relative
positioning of the two masters.  As such, it could not distinguish
between the following two situations:

behdad:fonttools 0 (master*)$ ./fonttools varLib.models 0,0 0,1 1,0 1,1 .5,.5 .55,.75
Sorted locations:
[{},
 {'A': 1.0},
 {'B': 1.0},
 {'A': 1.0, 'B': 1.0},
 {'A': 0.5, 'B': 0.5},
 {'A': 0.55, 'B': 0.75}]
Supports:
[{},
 {'A': (0, 1.0, 1.0)},
 {'B': (0, 1.0, 1.0)},
 {'A': (0, 1.0, 1.0), 'B': (0, 1.0, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0, 0.55, 1.0), 'B': (0.5, 0.75, 1.0)}]
behdad:fonttools 0 (02616ab...)$ ./fonttools varLib.models 0,0 0,1 1,0 1,1 .5,.5 .75,.55
Sorted locations:
[{},
 {'A': 1.0},
 {'B': 1.0},
 {'A': 1.0, 'B': 1.0},
 {'A': 0.5, 'B': 0.5},
 {'A': 0.75, 'B': 0.55}]
Supports:
[{},
 {'A': (0, 1.0, 1.0)},
 {'B': (0, 1.0, 1.0)},
 {'A': (0, 1.0, 1.0), 'B': (0, 1.0, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0, 0.75, 1.0), 'B': (0.5, 0.55, 1.0)}]

Check the last line. In both cases the box was cut against the second axis.
After this change, we get:

behdad:fonttools 0 (master)$ ./fonttools varLib.models 0,0 0,1 1,0 1,1 .5,.5 .55,.75
Sorted locations:
[{},
 {'A': 1.0},
 {'B': 1.0},
 {'A': 1.0, 'B': 1.0},
 {'A': 0.5, 'B': 0.5},
 {'A': 0.55, 'B': 0.75}]
Supports:
[{},
 {'A': (0, 1.0, 1.0)},
 {'B': (0, 1.0, 1.0)},
 {'A': (0, 1.0, 1.0), 'B': (0, 1.0, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0, 0.55, 1.0), 'B': (0.5, 0.75, 1.0)}]
behdad:fonttools 0 (master)$ ./fonttools varLib.models 0,0 0,1 1,0 1,1 .5,.5 .75,.55
Sorted locations:
[{},
 {'A': 1.0},
 {'B': 1.0},
 {'A': 1.0, 'B': 1.0},
 {'A': 0.5, 'B': 0.5},
 {'A': 0.75, 'B': 0.55}]
Supports:
[{},
 {'A': (0, 1.0, 1.0)},
 {'B': (0, 1.0, 1.0)},
 {'A': (0, 1.0, 1.0), 'B': (0, 1.0, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0.5, 0.75, 1.0), 'B': (0, 0.55, 1.0)}]

Just draw the boxes on a piece of napkin and convince yourself that this
is a good change.

If the ratios are equal, we cut against the first axis in the axisOrder:

behdad:fonttools 0 (master)$ ./fonttools varLib.models 0,0 0,1 1,0 1,1 .5,.5 .75,.75
Sorted locations:
[{},
 {'A': 1.0},
 {'B': 1.0},
 {'A': 1.0, 'B': 1.0},
 {'A': 0.5, 'B': 0.5},
 {'A': 0.75, 'B': 0.75}]
Supports:
[{},
 {'A': (0, 1.0, 1.0)},
 {'B': (0, 1.0, 1.0)},
 {'A': (0, 1.0, 1.0), 'B': (0, 1.0, 1.0)},
 {'A': (0, 0.5, 1.0), 'B': (0, 0.5, 1.0)},
 {'A': (0.5, 0.75, 1.0), 'B': (0, 0.75, 1.0)}]
2018-04-27 16:50:32 -07:00
Erik van Blokland
1c6c35dc38 Change to designspace documentation: add layer attribute to the source element.
Add `layerName` attribute to the sourcedescriptor object
Read and write layerName.
Add a source layer test.
XXX this also disables the test_check() test for the moment because it generates odd results.
2018-04-27 13:24:11 +02:00
Behdad Esfahbod
02616ab9b3 [subset] Set to None empty Coverage tables in MarkGlyphSets 2018-04-25 20:59:18 -07:00
Behdad Esfahbod
795f2f95fb [otBase] Fix sharing of tables referred to by different offset sizes
When an offset refers to a table, we keep the size of the offset to
the referred-to table. When sharing tables, we were ignoring this,
which could result in a long offset being written out as a short, or
vice versa.  Fix it by not sharing such tables. This is not optimal
but fixes the bug.

Bug has been there forever.
2018-04-25 20:57:19 -07:00
Behdad Esfahbod
fc819d6235 [subset] Don't drop a GDEF that only has VarStore 2018-04-25 16:10:57 -07:00
Behdad Esfahbod
1917d6913b [subset] Remove more nonsensical code
Remaining parts of 4e3192163470ca168ff753cb526480e59bc77e1a
2018-04-25 16:09:30 -07:00
Behdad Esfahbod
95838bd4df [otBase] If decoding tables fails, append breadcrumb to exception 2018-04-25 15:53:43 -07:00
Cosimo Lupo
55539f6651
Merge pull request #1249 from anthrotype/varlib-finder
[varLib] add a --master-finder command line option
2018-04-25 16:14:04 +01:00
Cosimo Lupo
f3e0cf3604
varLib_test: add tests for --master-dir and -o options 2018-04-25 13:19:58 +01:00
Cosimo Lupo
c616e10e45
varLib: add --master-finder option
Takes a template containing predefined strings {dirname}, {basename},
{stem}, {ext} and {fullname}, to customize the location of the binary
master TTFs in relation to the designspace source filenames.
2018-04-25 13:19:58 +01:00
Cosimo Lupo
6a89d9c41a
Merge pull request #1245 from anthrotype/mutator-prune-names
[varLib.mutator] prune fvar nameIDs from instance's name table
2018-04-18 13:57:47 +02:00
Cosimo Lupo
3fe84a65ea
[varLib.mutator] prune fvar nameIDs from instance's name table
Fixes https://github.com/fonttools/fonttools/issues/1227
2018-04-18 12:35:54 +01:00
Cosimo Lupo
04dc7339fd
[featureVars] remove unused fvar code; normalized default space is always (-1.0, 1.0) 2018-04-18 12:07:06 +01:00
justvanrossum
978967983c removing normalization step: min/max values are now expected to be given in normalized coordinates 2018-04-18 08:51:45 +02:00
Cosimo Lupo
0f1c6b3cf4
[featureVars] add doctests for non intersecting spaces or regions 2018-04-17 16:53:33 +02:00
Cosimo Lupo
9a04811ec2
[featureVars] use itertools to get combinations of indices
and rename getPermutations to iterAllCombinations.

It's not really permutations we are after here, but more combinations
of indexes sorted by decreasing length, from more specific to less
2018-04-17 15:58:48 +02:00
Cosimo Lupo
d7b4d06882
[varLib] minor: rename variables for clarity; fix mixed tab-space indent
confuses my vim
2018-04-17 14:22:52 +02:00
Cosimo Lupo
0c20948341
clarify coordinates are expressed in 'raw design' values, not 'user'
this is what tripped the whole misunderstanding
2018-04-17 12:31:14 +02:00
Cosimo Lupo
2002a6c92c
Revert "featureVars: modify normalization using avar maps"
This reverts commit 081ca1327c69ad74839b95d3c5096868a5f25532.

https://github.com/fonttools/fonttools/pull/1240#issuecomment-381923485
2018-04-17 12:23:38 +02:00
Cosimo Lupo
081ca1327c
featureVars: modify normalization using avar maps 2018-04-16 18:38:58 +02:00
Cosimo Lupo
63c86b4db3
Merge pull request #1236 from anthrotype/bad-classdef-fmt
Allow decompiling bad ClassDef tables with invalid format
2018-04-16 13:55:47 +02:00
Cosimo Lupo
8ee3f016d7
Merge pull request #1242 from anthrotype/stat-1.2
[varLib] make STAT 1.2, and reuse fvar nameIDs
2018-04-16 13:55:23 +02:00
Cosimo Lupo
ffc7dfc23d
[varLib] don't need to read nameTable in _add_stat
for now at least...
2018-04-16 12:55:51 +02:00
youlun
2bcca15c56 Add font-number parameter for subset 2018-04-16 12:47:25 +02:00
Cosimo Lupo
f688d4bb86
[Tests/varLib] adjust STAT expected test data 2018-04-16 12:40:02 +02:00
Cosimo Lupo
08c30e9fde
[varLib] make STAT v1.2, reuse fvar nameIDs
Fixes https://github.com/googlei18n/fontmake/issues/417
2018-04-16 12:40:02 +02:00
justvanrossum
4256e6c6bf make doctests independent of dict order repr 2018-04-16 10:33:30 +02:00