141 Commits

Author SHA1 Message Date
Cosimo Lupo
dc99925bee
instancer: always calculate inferred deltas upfront to simplify code
and instead of sumDeltas method, use in-place add operator.
2019-04-04 18:05:11 +01:00
Cosimo Lupo
f220d36df1
instancer: merge TupleVariations left with same axes after pinning
The instantiateTupleVariationStore function now groups TupleVariation
tables that have the same axes 'tents', then merges them into a single
TupleVariation by summing their deltas. The rounding to integer happens
after summing the scaled deltas as floats, to reduce off-by-one errors.

To be able to sum gvar TupleVariation, it needs to calculate the inferred
deltas so it now takes two optional lists (origCoords and endPts) that
are passed on to iup_delta function. These only make sense for gvar
type of TupleVariation, of course, and are unused for cvar tuples.

It also run iup_delta_optimize on the gvar deltas that are left after
partial instancing and whose inferred deltas had to be interpolated.
This can be disabled with --no-optimize CLI option.

Also added calcInferredDeltas and optimize methods to TupleVariation
class, which use functions from varLib.iup module, plus tests
that exercise them.
2019-04-04 15:11:23 +01:00
Cosimo Lupo
c6006a7f8c [glyf] remove_hinting should del program from composite glyph
Unlike simple glyphs, which always have 'program' attribute (even when empty, with no instructions)
in composite glyphs, it's the presence of 'program' attribute that determines whether
the optional WE_HAVE_INSTRUCTIONS component flag is set or not.
Thus, the trim method (with remove_hinting=True) should delete the attribute for
composite glyphs.

Fixes https://github.com/fonttools/fonttools/issues/1550
2019-03-21 12:16:54 +00:00
justvanrossum
12ec7f539e improve error message 2019-03-17 15:35:35 +01:00
justvanrossum
ac2413e905 [ttLib/glyf] raise TTLibError with the offending glyph name in the error message when a component (indirectly) references itself 2019-03-17 15:30:20 +01:00
justvanrossum
24b45b6326 fix embedded license URL in name tables of test fonts 2019-03-06 17:20:40 +01:00
justvanrossum
d897a08fc8 more updated issue URLs 2019-03-06 16:52:35 +01:00
justvanrossum
e22453c933 followup to #1531 2019-03-06 16:47:16 +01:00
Cosimo Lupo
71e44a52ee TupleVariation.toXML: sort attrs min/value/max in TTX dump
It's more legible if the peak value is written after the min and before the max value
defining a given region.
2019-03-04 16:41:26 -08:00
justvanrossum
7c319abbec remove some unused variables; test empty cmap for format 4 2019-03-03 11:59:59 +01:00
justvanrossum
d4a2d935c4 [cmap] changed some uses of list(map(...)) to list comprehensions an explicit loops, avoiding possibly large unneeded tmp lists; replaced use of oval() with int(); adding tests to verify all changes are covered 2019-03-03 10:30:05 +01:00
Sascha Brawer
6a7e299c09 Fix “DeprecationWarning: invalid escape sequence” in Python 3.7 2019-01-22 16:36:15 +01:00
Cosimo Lupo
8350332461
{v,h}mtx: allow to compile/decompile even without {v,h}hhea table
when no horizontal/vertical header table is present, we assume numberOfHMetrics == maxp.numGlyphs.
This allows to compile/decompile incomplete fonts, only containing head, maxp, hmtx, loca and glyf (or CFF),
that is the bare minimum to temporarily store glyph outline and metrics data for use with sparse/intermediate
master TTFs in varLib.
See https://github.com/googlei18n/ufo2ft/issues/308
2019-01-14 13:45:24 +00:00
Just van Rossum
6f7c0f1d09
[ttLib] cmap format 14 cleanup (#1437)
* cleanup cmap format 14 TTX format by removing redundant attributes
* don't output the name attr for a default mapping, instead of a glyph named 'None'
* still accept 'None' as an indicator glyph name, for bw compatibility
* swap order of TTX attrs uv and uvs
* make sure (unicode, glyphName) pairs are always tuples in uvsDict.
2019-01-10 19:19:35 +01:00
Just van Rossum
855378477f
[ttLib] adding a test for cmap format 14 (unicode variation sequences) (#1436)
Adding a test for cmap format 14 (unicode variation sequences), in preparation for #1435
2019-01-10 16:48:10 +01:00
Cosimo Lupo
683547dde2
Merge pull request #1359 from justvanrossum/addmultilingualnames-mac
[name] make addMultilingualNames() add mac names by default
2019-01-07 09:54:34 +00:00
Denis Moyogo Jacquerye
7e3164e8da kern table: add tests for overflowing subtable 2018-11-20 12:41:57 +00:00
justvanrossum
0d06fd23ce fix test failure in addMultilingualName() test by setting mac to None, which makes it behave like before 2018-11-02 12:12:57 +01:00
Sascha Brawer
2011ccf6ec [morx] Clean up compilation of AAT action tables; add more tests 2018-09-24 20:15:54 +02:00
Sascha Brawer
4a1871ff62 [morx] Support AAT action type to insert glyphs 2018-09-24 18:14:01 +02:00
Jens Kutilek
7c8077a63d Add glyf flags bit6 to ttx output (#1316)
* Implement glyf outline flags bit 6 when decompiling/compiling

* Add test data for outline flag bit 6

* Rename flags, use bitwise OR for setting flag bit

* Remove unneeded code
2018-09-14 15:27:32 +02:00
Cosimo Lupo
0df51c58e0
otTables_test: add unit test for splitMarkBasePos 2018-07-19 17:56:35 +01:00
Cosimo Lupo
0337fc92fc
Tests: adjust to use new otRound function 2018-06-14 17:49:37 +01:00
Cosimo Lupo
d9f7a26027
_g_l_y_f_test: test _checkFloat upgrades to double when overflowing short int 2018-06-07 15:40:50 +01:00
Miguel Sousa
efca91e7f1 [_n_a_m_e_test] ensure that struct format string is native str
https://github.com/fonttools/fonttools/pull/1193#issuecomment-367769342
2018-02-23 03:02:06 -08:00
Cosimo Lupo
f62f79eb23
otConverters: don't write XML comment if NameID value is 0 == NULL
Fixes https://github.com/fonttools/fonttools/issues/1151
2018-01-19 13:25:59 +00:00
Jens Kutilek
cb6676f93e Don't share points in cvar by default (fails in Chrome), adjust tests to test both shared and private points in cvar 2017-11-24 19:06:36 +01:00
Cosimo Lupo
f100754ffb
Merge pull request #1093 from silnrsi/graphite
Fix small graphite round trip bugs
2017-11-07 09:53:36 +00:00
Cosimo Lupo
d91faeaf1a
Merge pull request #1091 from readroberts/master
[CFF2] Fixes for writing PrivateDict BlueValues and Subrs to XML.
2017-11-06 10:13:57 +00:00
Cosimo Lupo
34f06f41a9
Merge pull request #1094 from anthrotype/apple-kern
fix compilation of AAT kern tables
2017-11-04 16:41:53 +00:00
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