361 Commits

Author SHA1 Message Date
Cosimo Lupo
a12bfa160a [_k_e_r_n_test] test toXML/fromXML for unknown formats 2017-11-04 12:02:57 +00:00
Cosimo Lupo
d715575794 [_k_e_r_n] fix order of format/coverage bytes
In OT kern subtable header, the format is the high byte of 'coverage'
bit mask (bits 8-15), and the low byte (bits 0-7) is the actual coverage
bits.

In AAT kern, it's the opposite: the coverage flags are the high byte,
whereas the subtable format is the low byte.

Also adjusted the test data, and set coverage to 1 for OT kern subtable
(which means the usual horizontal kerning).
2017-11-04 10:56:07 +00:00
Cosimo Lupo
5d16828031 fixup
had removed that fixture and squashed.. should have re-run the test
before pushing :-/
2017-11-03 20:07:09 +00:00
Cosimo Lupo
a2a4f45ef2 [_k_e_r_n_test] decompile/compile tests for unknown formats 2017-11-03 20:00:04 +00:00
Martin Hosken
4a009d1eea Fix tests 2017-11-04 00:34:47 +07:00
Cosimo Lupo
5f2177a990 [_k_e_r_n_test] Add tests for OT and AAT kern format 0 subtable 2017-11-03 16:08:37 +00:00
justvanrossum
4e8295920a return None if no unicode cmap subtables were found 2017-11-03 16:19:48 +01:00
justvanrossum
113f9cc498 add (0, 4) to default cmaps to search for; add getBestCmap() to TTFont as well; added test for the latter 2017-11-03 16:01:45 +01:00
justvanrossum
baf2fbf87d added tests for cmap.getBestCmap() 2017-11-03 15:10:06 +01:00
ReadRoberts
212168f192 [CFF2] Update the test file C_F_F__2.ttx to match the change in the CFF2 output for XML 2017-11-02 12:09:04 -07:00
Cosimo Lupo
240ef765a8 [_k_e_r_n_test] rewrite as pytest-style; fix indentation 2017-11-02 10:37:56 +00: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
17e627e366 [morx] Add test case for unrecognized lookup types 2017-10-31 12:50:46 +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
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
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
Denis Moyogo Jacquerye
7f352b028b TSI tables content as utf-8 and unicode instead of bytes (#1060)
* TSI tables content as unicode

* TSI1: update tests for utf-8
2017-09-21 18:04:57 +02:00
Martin Hosken
b0ae563d4d Add Graphite table tests 2017-09-19 15:45:44 +02: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
f80b341977 [AAT] Another unit test for decoding the ankr anchor points table 2017-08-31 14:44:24 +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
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
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
4bf68d82bc [otConverters_test] add tests for _LazyList 2017-08-18 17:26:35 +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
Sascha Brawer
d05617b4bd [AAT] Support prop table with glyph properties 2017-08-17 11:09:53 -07:00
Sascha Brawer
d11e7d98e8 [AAT] Support lcar table 2017-08-16 11:47:27 -07:00
Sascha Brawer
ff7cf27777 [AAT] Fix binary search headers of AATLookup formats 2 and 6
In format 2 and 6, AAT lookups contain a binary search header with
the number of elements in the lookup table. Before this change, the
element count would also include the special trailing end-of-table
value that is required by the font format specification.  However,
the binary search header should only count the actual elements
without the trailer.

Also, in the examples from the AAT specification, the special
end-of-table entries use 0xFFFF for glyph ID keys, and zeroes
for the filler values. Before this change, we had filled the
values with 0xFF bytes.
2017-08-16 19:43:25 +02:00
Sascha Brawer
4cf76edd87 [AAT] Delegate XML reading and writing to value class converter
Before this change, the code assumed that all values of AAT lookups
get internally represented as strings, which is correct for GlyphID
values but not generally the case.

Also renaming the XML element from `Substitution` to `Lookup`
because AAT lookups have other uses beyond glyph substitutions.
2017-08-15 19:40:50 +02:00
Sascha Brawer
228550a1d2 [AAT] Do not prune AATLookup values
Before this change, the decoder would silently remove "redundant" values
when decompiling AAT lookups. However, it is perfectly valid for a lookup
to map a glyph ID to itself, and also not all AAT lookups have glyph IDs as
their value range.
2017-08-15 18:33:57 +02:00
Sascha Brawer
020f7391ef [morx] Parametrize AATLookup value type in otData 2017-08-14 21:34:15 +02:00
Sascha Brawer
61874d3600 [morx] Generalize AATLookup to other value types
With AAT, the same lookup data structure can be used for various
types of values. In the morx table, the values are glyph IDs or
glyph classes, which both are encoded as 16-bit unsigned integers.
In other AAT tables, however, the values can be different data types
with different encodings. By passing a `valueWriter` callback and
explicit `valueSize`, we prepare for eventually templatizing
the building of AATLookups.

Also, assert that the called writer wrote the exact number of bytes
that was predicted when figuring out what format should be used for
encoding an AATLookup.
2017-08-14 21:34:15 +02:00
Sascha Brawer
7f2007f46c [morx] Write AATLookup format 8 2017-08-14 21:34:15 +02:00