3194 Commits

Author SHA1 Message Date
Behdad Esfahbod
a302000023 [merge] Remove debug asserts
Fixes https://github.com/fonttools/fonttools/issues/1056
2017-09-18 13:10:03 -04: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
Behdad Esfahbod
556508b0e9 [merge] Remove unused features & lookups 2017-09-15 00:58:42 -04:00
Behdad Esfahbod
d802580cee [merge] Merge Script records, almost properly
Right now only merges DefaultLangSys.  Also, does not remove unused Feature's after merge.
Moreover, does not merge kind Lookups of the same Feature.

But it works!
2017-09-15 00:58:42 -04:00
Behdad Esfahbod
d76d6c1a5f [merge] Remove lookup_id() / feature_id(), use custom dict
I added the id() trick because normal objects are not hashable in Python3.
Remove that hack and use a custom dict subclass that allows us to use
objects as keys as long as they don't change.

The custom dict has a different, desirable, property as well: upon seeing
keys it does not know, it just adds them to the end of the list.  Will use
this feature in next commits to merge ScriptList properly.
2017-09-15 00:58:42 -04:00
Behdad Esfahbod
93763eec0b Minor 2017-09-15 00:58:42 -04:00
Behdad Esfahbod
9d5a468781 [merge] Define lookup_id() and feature_id()
Prepare to merge ScriptRecords properly
2017-09-15 00:58:42 -04:00
Cosimo Lupo
de59719db4 move stuff to fontTools.svgLib.path sub-package
in case later on we want to add things to svgLib which don't have to do with paths specifically
2017-09-12 22:21:20 -04:00
Cosimo Lupo
ecf781cfce move fontTools.misc.svgPath to fontTools.svgLib 2017-09-12 08:46:04 -04:00
Cosimo Lupo
ce530a51d3 [svgPath] tag ImportError with '# pragma nocover'
It appears that cElementTree is still present as a deprecated alias in python 3
We tell coverage to skip this branch since it is not (currently) being hit
2017-09-11 17:35:46 +01:00
Cosimo Lupo
cb72f9499c [svgPath/parser] typo 2017-09-11 17:34:04 +01:00
Cosimo Lupo
d6f54f90bd [svgPath/parser] handle open paths with endPath() 2017-09-11 17:31:58 +01:00
Cosimo Lupo
d093eba098 [svgPath] add SVGPath class supporting the Pen protocol 2017-09-08 19:26:57 +01:00
Cosimo Lupo
433c7a4f91 [svgPath.parser] add standard __future__ and py23 imports 2017-09-08 18:17:34 +01:00
Cosimo Lupo
cb91e3d742 [svgPath] export parse_path function from svgPath.parser submodule 2017-09-08 18:17:34 +01:00
Cosimo Lupo
e431bc2dc2 make svgPath into a package; mv svgPath.py svgPath/parser.py 2017-09-08 18:16:02 +01:00
Cosimo Lupo
ed4cfcdf82 [svgPath] add docstring to parse_path; make 'current_pos' a tuple 2017-09-08 18:16:02 +01:00
Cosimo Lupo
1ba2c3fe9c [svgPath] modify parse_path so it calls pen object directly 2017-09-08 18:16:02 +01:00
Cosimo Lupo
e2bb8f3053 [svgPath] add copy of parser module from svg.path package
The upstream code comes from here:

https://github.com/regebro/svg.path

I prefer to 'vendor' the svg path parser instead of adding it as a
requirement to fonttools, because this way we can patch it to call a
pen object directly instead of returning a list of Path instances.

Also I'm only interested in the parser module, the rest of svg.path
is not useful here.

The license of svg.path is MIT, so it's compatible with fonttools
license (BSD 2-clause).

I added the original code so it's clear from the subsequent commits
what changes are being applied.
2017-09-08 17:41:19 +01:00
Sascha Brawer
db0d193db6 [AAT] Support cidg table with CID-to-glyph mapping 2017-09-06 12:52:22 +02:00
Sascha Brawer
0f05f824d2 [AAT] Support gcid table with glyph-to-CID mapping 2017-09-06 01:40:49 +02:00
Sascha Brawer
ee1662e57e [AAT] Support morx tables with contextual substitution 2017-09-05 23:01:21 +02:00
Sascha Brawer
31b02d0bed [AAT] Support morx tables with Rearrangement subtables 2017-09-04 21:26:53 +02:00
Sascha Brawer
49fc88244b [AAT] Write AATLookups to XML in alphabetical order again
The XML output for other tables is also sorted alphabetically
by glyph name, not by glyph order.

This reverts commit c77e9fe12d5879aeb79c05f8ececebb3275524b7.
2017-09-01 15:56:21 +02:00
Sascha Brawer
c77e9fe12d [AAT] Write AATLookups to XML in glyph order
Before this change, the AAT lookups were alphabetically sorted by glyph name,
but it seems more natural to write XML in the usual glyph order. No changes to
the binary format (which already was in glyph order); this only affects how
XML output is produced.
2017-08-31 17:50:45 +02:00
Sascha Brawer
898f6911f8 [AAT] Implement subsetting of anchor points table 2017-08-31 12:49:55 +02:00
Sascha Brawer
92124ee5a6 [AAT] Implement anchor point table
The AAT `ankr` anchor point table is an auxiliary table for `kerx`,
used to store anchor overrides in case the glyph itself does not
supply the needed anchors as control points. Among the fonts that
come pre-installed with MacOS 10.12.6, `ankr` is used by a handful
of non-Latin fonts such as “Myanmar MN”, “Devanagari Sangam MN”,
and “Arial HB”.

https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html
2017-08-31 11:45:18 +02:00
Sascha Brawer
90f257cc60 [AAT] Support mort and morx tables with non-contextual substitutions
Other metamorphosis types are not yet supported and will raise an error
upon decompilation. The TTX tool catches the error and continues to emit
a hexdump of the table contents, just as before this change.
2017-08-30 14:46:34 +02:00
Sascha Brawer
7bb171ed4a [AAT] Do not assume that StructWithLength is always 32 bits long
Most AAT tables encode struct lengths into 32 bits but some use only 16.
Therefore, take the size of the encoded struct length from otData.
2017-08-29 09:49:39 +02:00
Sascha Brawer
5d8a9df7fb [AAT] Make StructLength a computed value 2017-08-29 09:34:25 +02:00
Behdad Esfahbod
48bb8d9d59 [subset] Further minor simplification 2017-08-27 18:31:34 -07:00
Behdad Esfahbod
2d755f0d39 [subset] Simplify glyf.closure_glyphs() similarly 2017-08-27 18:30:04 -07:00
Behdad Esfahbod
61ac8e7589 [subset] Simplify COLR.closure_glyphs() 2017-08-27 18:27:03 -07:00
Sascha Brawer
307d0d4c57 [AAT] Implement subsetting of baseline table 2017-08-26 09:53:04 +02:00
Sascha Brawer
16a4001901 [AAT] Implement subsetting of lcar ligature carets table 2017-08-25 07:35:13 -07:00
Sascha Brawer
13fe9b5c34 [AAT] Make lcar ligature carets table a format-switching table
For consistency with other AAT tables, and to support additional
formats in the (rather unlikely) case those would ever be defined.
2017-08-25 14:53:43 +02:00
Sascha Brawer
f5793401ce [AAT] Implement bsln baseline table
The AAT baseline table uses arrays whose length is constant instead of
getting encoded in the data. Extended otBase to support such arrays.
2017-08-25 03:55:06 -07:00
Bill Amidei
b5edc7e9f5 Add ability to split glyphs to 1 glyph per ttx file. Addresses Issue #153 2017-08-23 12:33:25 -07:00
Sascha Brawer
84b0cacf95 [AAT] Implement subsetting of opbd Optical Bounds table 2017-08-22 14:36:05 -07:00
Sascha Brawer
28b179a018 [AAT] Implement subsetting of prop table with AAT glyph properties 2017-08-22 08:06:59 -07:00
Sascha Brawer
61d2cde14a [AAT] Add comments to explain why we call seek() on subreader
https://github.com/fonttools/fonttools/issues/1031
2017-08-19 20:41:43 -07:00
Sascha Brawer
2f69d2959c [AAT] Fix decompilation of AppleChancery and other AAT fonts
Fixes https://github.com/fonttools/fonttools/issues/1031.
2017-08-19 20:41:43 -07:00
Cosimo Lupo
cc645c4396 Bump version: 3.15.1 → 3.15.2.dev0 2017-08-18 17:49:29 +01:00
Cosimo Lupo
b7cfdaf367 Release 3.15.1 2017-08-18 17:49:28 +01:00
Sascha Brawer
a47f658855 [AAT] Support the opbd table with optical bounds
Interestingly, this can handle the examples from the AAT specification
(which are part of the unit tests), and also most AAT fonts on my disk.
However, some other AAT fonts such as Apple Chancery cannot be decompiled.
The failure seems to be a general problem with how fonttools decompiles
AAT lookups of format 4, and unrelated to this present change.
2017-08-18 08:39:44 -07:00
Cosimo Lupo
1aef1683df [otConverters] must also implement _LazyList.__radd__
We can't set, e.g. `__radd__ = NotImplemented` as it's not a callable.
NotImplemented is what is returned from a rich comparison method
when self doesn't know how to compare with the other object.

_LazyList object may also occur on the right hand side of a `+`
operator, when the left operand is a list. Also in this case we
want to first unpack the _LazyList and return a new list containing
elements from both.
2017-08-18 15:53:56 +01:00
Behdad Esfahbod
6ef48bd26f [ot] Make LazyList return regular lists in __add__ 2017-08-17 11:32:13 -07:00
Sascha Brawer
d05617b4bd [AAT] Support prop table with glyph properties 2017-08-17 11:09:53 -07:00
Cosimo Lupo
549eef81b3 Bump version: 3.15.0 → 3.15.1.dev0 2017-08-17 12:38:51 +01:00
Cosimo Lupo
6e11a9da58 Release 3.15.0 2017-08-17 12:38:51 +01:00