272 Commits

Author SHA1 Message Date
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
Sascha Brawer
91827e663f [morx] Write AATLookup format 2 2017-08-14 21:34:15 +02:00
Sascha Brawer
68dc15375b [morx] Fix output for AATLookup format 6
We now produce the correct binary search headers, and add a fake item
for terminating the binary search.
2017-08-14 21:34:15 +02:00
Sascha Brawer
57f01b27cb [morx] Preliminary code for writing AATLookups
Needs more work.
2017-08-14 21:34:15 +02:00
Sascha Brawer
4b5b8ea53d [morx] Implement AATLookup.xmlRead 2017-08-14 21:34:15 +02:00
Sascha Brawer
b40ba05f6f [morx] Group AATLookup substitutions into a parent XML element 2017-08-14 21:34:15 +02:00
Sascha Brawer
483bb67b60 Rebase morx branch to current master 2017-08-14 21:34:15 +02:00
Masaya Nakamura
423e829b73 [_v_h_e_a_test] Add tests for recalc() 2017-08-01 10:53:27 +09:00
Masaya Nakamura
a4fda12810 [_h_h_e_a_test] Add tests for recalc() 2017-08-01 10:51:48 +09:00
ReadRoberts
22162d8a71 Update CFF2 test XML data to match latest output: default FontMatrix is omitted from FDArray FontDict. 2017-06-20 16:23:52 -07:00
Denis Moyogo Jacquerye
6d07d48846 Upate CFF tests for default for UnderlinePosition
Missing UnderlinePosition added in a72f26e5
2017-06-09 07:03:54 +01:00
Behdad Esfahbod
af041259ee Fix tests for recent changes 2017-05-18 16:06:10 -07:00
Cosimo Lupo
1c9198e3f0
[_g_l_y_f] add test for GlyphCoordinates' float precision loss issue (#964) 2017-05-16 10:34:37 +01:00
Sascha Brawer
017fa4e9c6 [fvar] Expose flags in XML
Fixes https://github.com/fonttools/fonttools/issues/932.
2017-05-02 00:51:44 +08:00
Sascha Brawer
3f839878eb [name] Fix issues with name.addMultilingualName()
Fixes https://github.com/fonttools/fonttools/issues/931.
2017-04-21 13:14:24 +08:00
Sascha Brawer
a5c8977dd3 [name] Fix platform ID for names whose language code is in ltag table
https://github.com/fonttools/fonttools/issues/931
2017-04-20 17:38:31 +08:00
Sascha Brawer
e8530360bd [name] Add helper for building multi-lingual names
Fixes https://github.com/fonttools/fonttools/issues/921.
2017-04-19 02:26:32 +08:00
Sascha Brawer
068ca5afbb [ltag] Helper method for adding language tags 2017-04-18 18:15:32 +08:00
Cosimo Lupo
901b0c3a07
[_a_v_a_r_test] remove test_fixupSegments
e886617
2017-04-14 09:45:08 +01:00
Cosimo Lupo
fab26fd5c1
[loggingTools] rename 'match' to 'assertRegex'
https://github.com/fonttools/fonttools/pull/913#discussion_r110820088

https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRegex
2017-04-11 09:34:39 +01:00
Cosimo Lupo
18bd3c6afe
[TSI1] add tests for decompile method 2017-04-10 20:53:10 +01:00
Cosimo Lupo
b26eeb2eb2
[TSI0] add tests for decompile, compile and toXML methods 2017-04-10 20:53:10 +01:00
Cosimo Lupo
7fe876a803
[minor] remove semicolons 2017-04-10 11:57:13 +01:00
Behdad Esfahbod
fdbf066a8c [glyf] Add __bool__ / __nonzero__ to GlyphCoordintes
I'm really unhappy that doctests do NOT work anymore :(.
2017-04-05 15:43:14 +02:00
Cosimo Lupo
e6f39f855c
[tables_test] minor: fix docstrings 2017-03-13 11:28:39 +00:00
Sascha Brawer
989270afc5 [AAT] Use ☃ instead of 🌍 to test non-ASCII characters
On some Python builds, Unicode characters above U+FFFF get escaped
to two question marks ?? instead of just one ?. This is not a real
problem, but for testing it is a nuisance when the results depend
on the platform.
2017-03-10 20:20:22 +08:00
Sascha Brawer
ea1adf42a7 [AAT] Add Char64 converter for 64-byte ASCII character strings
Used by Apple Advanced Typography tables, for example `gcid`.
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html

https://github.com/fonttools/fonttools/issues/178
2017-03-10 20:20:22 +08:00
Sascha Brawer
d7a298f36d [otConverters] Add unit test for otConverters.UInt8
This class had been added in the `morx` branch, and I wanted
to merge it into master. While writing tests for it, I noticed
that `otConverters` has meanwhile been extended by an `UInt8`
converter. Therefore, only adding a test for the existing
implementation.
2017-03-09 20:52:26 +01:00
Sascha Brawer
910edb47df [otConverters] Add unit test for otConverters.Long
I've got some changes in the `morx` branch which I'd like to merge
into master.  So I'm writing this unit test as an example how to
test `otConverter` code.
2017-03-09 20:41:34 +01:00
Cosimo Lupo
0fc9313e79
[C_F_F__2_test] fix path to test data files 2017-03-05 22:53:05 +00:00
ReadRoberts
f208bf3421
1) Fold back in the changes introduced by Just van Possum in patch 744
2) Moved the C_F_F__2_test.py files and script under Tests/, paralleling what was done the C_F_F test  files.
2017-03-05 22:53:05 +00:00
Cosimo Lupo
9fbefd1d71
[test_tables] minor whitespace 2017-03-02 13:40:41 +00:00
Cosimo Lupo
9c6aaf0bf6
[test_tables] skip cmap tests when unicodedata2 is not installed
When the tests are run with `python setup.py test` (e.g. from the ./run-tests.sh
script), we can't have setuptools install pre-compiled wheels for extra test
requirements (e.g. Brotli, unicodedata2).
Instead of failing, it's better that we skip the tests that have such extra
requirements.

NOTE: The recommended way to run the full test suite is by using tox
(like we do on the CI), or by installing pytest and the rests of requirements.txt,
and then run `pytest` command directly.
2017-03-02 13:34:39 +00:00
Cosimo Lupo
0a9ab169fe
[test_tables] remove unused import 2017-03-02 13:30:12 +00:00
Cosimo Lupo
43bf2c4cb4
[aots/cmap4_font4.ttx.cmap] 0x37f is "GREEK CAPITAL LETTER YOT" 2017-03-02 13:29:06 +00:00