4595 Commits

Author SHA1 Message Date
Sascha Brawer
18fae34cad [morx] Make sure that morx subtables have the expected length 2017-10-25 15:35:56 +02:00
Sascha Brawer
5316bb83b6 [morx] Use a sub-reader when decoding AAT ligatures
Since the AAT ligature subtable does not encode the number of ligature
glyphs, we need to infer this from the total structure length. We pass
this around by creating a custom sub-reader that only has the substruct
as its data. There might have been easier ways to accomplish this, but
we should anyway change the XML output for MorxSubtables to use custom
flag names, similar to what we're already doing for flags of morph actions.
Having a custom converter for MorxSubtables is in preparation for that
later XML format change.
2017-10-25 15:35:56 +02:00
Sascha Brawer
1ac4a020ec [morx] Handle morx ligature substitution rules 2017-10-25 15:35:56 +02:00
Sascha Brawer
b6317ce60a [morx] Handle the ligature list components sub-table 2017-10-25 15:35:56 +02:00
Sascha Brawer
d7d94d7b02 [morx] Fix broken unit tests for morx subtables 2017-10-25 15:35:56 +02:00
Sascha Brawer
86454e79de [morx] Compile ligature actions subtable for AAT ligatures
Tests fail because other subtables still need to be implemented.
2017-10-25 15:35:56 +02:00
Sascha Brawer
04f01f245b [morx] Use the same value for testing as in specification comments
The hexdump in the specification is wrong, but the correct value
is in the comments. Before this change, the finite-state transducer
in our test data could be decompiled but would not implement the
behavior explained in the AAT specification.
2017-10-25 15:35:56 +02:00
Sascha Brawer
d373808341 [AAT] Decode the morx ligature actions table 2017-10-25 15:35:56 +02:00
Sascha Brawer
a7ddb0b609 [AAT] Decode morx tables with ligature substitutions
Only handling those parts that are shared with other substitution types.
The actualy ligature actions are not implemented yet.
2017-10-25 15:35:56 +02:00
Cosimo Lupo
faedfacbae [reverseContourPen_test] fix expected result for ReverseContourPointPen
This test is not normally run. It is skipped when ufoLib is not importable,
as it's the case from the test runner's virtual environment.

The only reason it exists is so that I could check that the
ReverseContourPen I was writing behaves the same as using ufoLib's
ReverseContourPointPen when the latter is run through the
SegmentToPointPen and PointToSegmentPen converters.

The two methods for reversing contours now diverge since
https://github.com/fonttools/fonttools/pull/1080,
but only nominally because both produce effectively the same results.
The only difference is that, when using the point pens with
outputImpliedClosingLine=True, the closing lineTo is always there even
when it's redundant. In our implmentation, we only output the closing
lineTo when it is the same as moveTo (this was necessary in order to
fix https://github.com/googlei18n/cu2qu/issues/51)
Nevertheless, the total number of points is the same in both cases.

Maybe this test should not be here, as it's testing functionalities
from a different package.

Closes https://github.com/fonttools/fonttools/issues/1081
2017-10-25 11:18:35 +01:00
Cosimo Lupo
273ff46104 Merge pull request #1080 from anthrotype/reverse-pen-dupl-move
[reverseContourPen] don't imply closing lineTo if == moveTo
2017-10-24 21:15:23 +01:00
Cosimo Lupo
1ef034c385 use outputImpliedClosingLine=True with ReverseContourPointPen
One way to work around https://github.com/googlei18n/cu2qu/issues/51
when using the ufoLib's ReverseConturPointPen via the converter pens
would be to pass the outputImpliedClosingLine=True argument
(False by default) to the PointToSegmentPen.

This way, all the final lineTos are explicitly outputted, even when
they are redundant and could be implied (i.e. when they are not
duplicate points).

Note that this test is skipped by the CI, because ufoLib is not a
dependency of fonttools; you can run locally if you wish.
2017-10-24 19:20:44 +01:00
Cosimo Lupo
e201ea9891 [reverseContourPen] don't imply closing lineTo when same as moveTo
Previously, for closed paths, we were always dropping a lineTo segment
that followed moveTo, because after reversing the contour this lineTo
would become the last segment, and in the Pen protocol a closePath
always implies a line to the fist point.

This is OK when the move point and the following lineTo oncurve point
(which becomes last after reversal) don't overlap.

However, if they do, we ended up dropping the duplicate point.

This cu2qu issue exemplify the problem (cu2qu actually uses the
ReverseContourPointPen wrapped by ufoLib's converter pens, but
fontTools' ReverseContourPen does exactly the same):

https://github.com/googlei18n/cu2qu/issues/51

With this patch, the ReverseContourPen now emits the last lineTo
when it is the same as moveTo.
2017-10-24 19:04:38 +01:00
Cosimo Lupo
0a22639ed3 [reverseContourPen_test] add test case from cu2qu#51
https://github.com/googlei18n/cu2qu/issues/51#issue-179370514a
2017-10-24 19:04:38 +01:00
Cosimo Lupo
d316ebebbb [reverseContourPen_test] keep duplicate point in expected result 2017-10-24 18:14:22 +01:00
Jens Kutilek
cb364aff2c Remove outdated comment 2017-10-22 17:56:12 -04:00
Jens Kutilek
eb3e4e56c9 Update comments in gvar test data 2017-10-22 17:56:12 -04:00
Jens Kutilek
3245553abc Fixing one test at a time ... 2017-10-22 17:56:12 -04:00
Jens Kutilek
8a4619788d Adapt test data 2017-10-22 17:56:12 -04:00
Jens Kutilek
35febd302e Fix some more compile calls 2017-10-22 17:56:12 -04:00
Jens Kutilek
97a31eb34e Missed a change in return values 2017-10-22 17:56:12 -04:00
Jens Kutilek
3745cf19ec Keep track of whether a tuple with proposed shared points actually can use them 2017-10-22 17:56:12 -04:00
Jens Kutilek
671cdc2edb Reactivate shared point logic 2017-10-22 17:56:12 -04:00
Jens Kutilek
abe0553c63 Fix constant name in unused code 2017-10-22 17:56:12 -04:00
Cosimo Lupo
94c79e4cbd [fixedTools] add floatToFixedToFloat to __all__ 2017-10-22 12:22:56 +01: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
Cosimo Lupo
5de673c424 [Tests] adjust GDEF expected data 2017-10-20 20:13:14 -04: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
5fabd3eb32 [varLib] Fix build expectation after MVAR support in mutator
Looks right to me...
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
b9d4795be4 [merge] Comment 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
a34749cc16 [merge] Print out duplicate glyphs in failure message 2017-10-20 20:13:14 -04:00
Cosimo Lupo
330d46ab7e Merge pull request #1078 from fonttools/travis-py276
run tests on Python 2.7.6 on Travis
2017-10-20 12:42:36 +02:00
Cosimo Lupo
f3d93bef1b [travis] don't set -x either, else Travis log gets too verbose 2017-10-20 12:31:03 +02:00
Cosimo Lupo
6fb4153c8d [travis] don't run coverage for python 2.7.6
as it does not change from the other 2.7 build
2017-10-20 12:19:04 +02:00
Cosimo Lupo
f15a0f3b17 [travis] don't set -e in before_install.sh or else whole build mayu fail
https://travis-ci.org/fonttools/fonttools/jobs/290382261
2017-10-20 12:12:31 +02:00
Cosimo Lupo
b2cd8178dd [travis] export a different PYENV_ROOT
https://travis-ci.org/fonttools/fonttools/jobs/290377841#L506
2017-10-20 12:02:21 +02:00
Cosimo Lupo
78eb7ebc5d [travis] also test on python 2.7.6
We install python 2.7.6 using pyenv.

This should help us catch issues like this earlier
https://github.com/fonttools/fonttools/issues/993
2017-10-20 11:47:31 +02:00
Cosimo Lupo
3a97f425b8 [sstruct] handle format strings with unicode_literals
properly fixes issue with struct module in python < 2.7.7

https://github.com/fonttools/fonttools/issues/993
2017-10-20 11:09:04 +02:00
Behdad Esfahbod
cca7a79018 [varLib] Adjust for supportScalar() default ot=True change
Fixup for 028ed0125244531215d4d774474d929acda14d49
2017-10-19 10:07:08 -07:00
Behdad Esfahbod
7e34ce6082 Whitespace 2017-10-19 09:54:32 -07:00
Cosimo Lupo
9d08673c2f [_n_a_m_e] pass bytes to struct when using unicode_literals
Before Python version 2.7.7, the struct.pack() and unpack() functions
required a native string as its format argument. For example:

Passing unicode strings as the struct pack/upack format would raise:

TypeError: Struct() argument 1 must be string, not unicode.

This error occurs when we use `from __future__ import unicode_literals`.

This problem was fixed in Python 2.7.7. Since then, struct now also
accepts unicode format strings.

Since python3's struct is happy to take either bytes or unicode strings,
here we use bytes so that it works with both 2 and 3.

Also see http://pythen-future.erg/stdlib_incompatibilities.html#struct-pack

Fixes https://github.com/fonttools/fonttools/issues/993
2017-10-19 14:03:24 +02: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