3129 Commits

Author SHA1 Message Date
justvanrossum
43a39588b3 fiddled with the doc string 2017-11-03 15:16:32 +01:00
justvanrossum
9dcddb853a Added getBestCmap() convenience method to the cmap table, to return the best available unicode cmap in the font 2017-11-03 11:36:01 +01:00
Sascha Brawer
045287aa25 [morx] Compile state table in a separate method
This makes the code slightly easier to understand.
2017-10-31 23:28:40 +01:00
Sascha Brawer
d54f14e0a2 [morx] Cosmetic renaming of ligAction to action
Beyond composing ligatures, AAT finite-state transducers can also
execute insertion actions without rewriting existing glyphs. The
corresponding actions have almost the same structure as ligature
actions, so we can share a lot of the plumbing within fonttools.

This renaming is in preparation of a larger change to support `morx`
ables with insertions.
2017-10-31 16:25:41 +01:00
Sascha Brawer
5f03a64a57 [morx] Implement InsertionMorphAction 2017-10-31 14:34:12 +01:00
Sascha Brawer
a0b9854ef0 [morx] Emit more meaningful subtable flags
Before this change, we were emitting XML with numeric values for `morx`
coverage flags. Now, we emit XML that makes more sense to human readers.
XML files from previous versions of fonttools can still be parsed.
2017-10-31 12:50:46 +01:00
Cosimo Lupo
e69484e030 Bump version: 3.18.0 → 3.18.1.dev0 2017-10-30 16:50:59 +00:00
Cosimo Lupo
244093b1bf Release 3.18.0 2017-10-30 16:50:26 +00:00
Khaled Hosny
534326bd1d [feaLib] Fix writing back nested glyph classes
Before this change, the following glyph class:

  @Vowels = [@Vowels.lc @Vowels.uc y Y];

Would be written back as:

  @Vowels = [@Vowels.lc = [a e i o u]; @Vowels.uc = [A E I O U]; y Y];

Which is clearly invalid. It seems for GlyphClass.asFea() to work
correctly here we should be using GlyphClassName not GlyphClass
for the nested classes (similar to the code at the beginning of
parse_glyphclass_()).
2017-10-27 23:27:07 +03: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
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
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
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
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
Jens Kutilek
cb364aff2c Remove outdated comment 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
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
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
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
Behdad Esfahbod
9d4991e20c [varLib] Move MVAR data table to varLib.mvar 2017-10-17 11:09:50 -07:00
Cosimo Lupo
84abdf8fd1 Bump version: 3.17.0 → 3.17.1.dev0 2017-10-16 18:38:25 +02:00
Cosimo Lupo
e512d8ddd4 Release 3.17.0 2017-10-16 18:37:05 +02: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
Cosimo Lupo
76e49d6ff5 rename SVGPen to SVGPathPen
This is to make clear that the pen deals specifically with SVG "path" element, not all SVG.
2017-10-15 15:18:35 +02:00