3194 Commits

Author SHA1 Message Date
Cosimo Lupo
d0abb273c3 Bump version: 3.14.0 → 3.14.1.dev0 2017-08-17 12:37:33 +01:00
Cosimo Lupo
a1c2cf1137 [TupleVariation] write axis coord values as float in toXML()
https://github.com/fonttools/fonttools/pull/1026#pullrequestreview-56807115
2017-08-17 11:13:00 +01:00
Cosimo Lupo
ed0d09be22 Merge pull request #1026 from anthrotype/avar-tests
[varLib] add tests for avar; always include default maps
2017-08-17 11:12:37 +01:00
Behdad Esfahbod
03cf8fc157 Fix hhea/vhea compile with metrics tables 2017-08-16 16:42:59 -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
Cosimo Lupo
9a49610d9a [_a_v_a_r] normalize output of toXML() by roundtripping float->fixed->float
Otherwise dumping avar table to TTX after it's been generated by
varLib could produce different float strings than when dumping the
same avar table after compiling and decompiling.
2017-08-16 18:33:55 +01:00
Cosimo Lupo
dfeacfba36 [varLib.models] minor
We need to use float (0.) rather than int (0) for the normalized axis
origin, otherwise some varLib roundtrip tests may fail.

E.g.

```diff
       <tuple>
-        <coord axis="wght" max="1.0" min="0.0" value="0.61"/>
+        <coord axis="wght" max="1.0" min="0" value="0.61"/>
```
2017-08-16 16:35:57 +01:00
Cosimo Lupo
04eacf13cd [varLib] include default maps for all avar axes, even without <map> elements
This is a follow-up to Jens' comment:

19c4b377b8 (commitcomment-23458151)

Now, if there's any axis that has 'interesting' segment maps (and thus
an avar table is added), we also ensure that for the rest of the axes
that aren't modified (either because no <map> elements are defined or
because an identity mapping is defined in the designspace), we always
have a non-empty segment maps array containing the three default maps:
{-1.0: -1.0, 0.0: 0.0, 1.0: 1.0}.

This is to work around CoreText and DirectWrite rendering issue with
empty avar segment maps arrays.
2017-08-16 16:30:11 +01:00
Sascha Brawer
77876e8df4 [AAT] Add table definitions for lcar table
After this change, fonttools is able to dump the `lcar` table of
the AppleChancery font to XML. However, the resulting XML cannot
be compiled back to TrueType, yet. So, something is still broken
with the implementation of AAT lookups. Need to do more testing
before the support for table `lcar` can be added to fonttools.
2017-08-16 02:42:55 +02:00
Sascha Brawer
49ee69b401 [AAT] Store value converter as a member variable of AATLookup 2017-08-15 23:40:47 +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
Behdad Esfahbod
8b4f0bb1e4 [morx] Write StructLength properly
Code looks like a hack, but is solid.
2017-08-14 12:34:56 -07:00
Behdad Esfahbod
338374e170 [morx] Minor 2017-08-14 12:34:56 -07:00
Sascha Brawer
7ee4fc8896 [morx] Remove morx table from table list
Temporarily removing the `morx` table from the table list so that
the rest of the AAT work can be merged into master.
2017-08-14 21:34:15 +02:00
Sascha Brawer
020f7391ef [morx] Parametrize AATLookup value type in otData 2017-08-14 21:34:15 +02:00
Sascha Brawer
e8f21cb571 [morx] Parametrize AATLookup.read() for different value types 2017-08-14 21:34:15 +02:00
Sascha Brawer
ce5d9de936 [morx] Pass font to format-specific AATLookup.read() methods
To use self.valueConverter.read(), we will need to pass the font.
2017-08-14 21:34:15 +02:00
Sascha Brawer
191c620951 [morx] Parametrize AATLookup.write() for different value types 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
bdf29b4169 [morx] Separate building from writing lookup tables
For AAT lookup format 2 (and other formats too), we need to shuffle
the data before we can estimate the encoded size. After this restructuring,
this data shuffling only needs to happen once.
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
Behdad Esfahbod
f188187b08 [morx] Implement StructWithLength.write() 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
Behdad Esfahbod
75b0eaa5bb [morx] Fix SubStruct xmlWrite() 2017-08-14 21:34:15 +02:00
Sascha Brawer
7f774ae84c [morx] Change MorphType to uint8, to comply with the spec 2017-08-14 21:34:15 +02:00
Sascha Brawer
b00e2dfec4 [morx] Recognize MorphType as another type of lookup
Currently, this makes no difference at all. Later, we'll use this
for dispatching AAT lookup types in the same way how we already
dispatch OpenType lookup types.
2017-08-14 21:34:15 +02:00
Sascha Brawer
f56b71937d Add missing parts from morx branch
After this change, the `morx` table in Zapfino.ttf can be ttx'ed again.
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
Behdad Esfahbod
6eb807b55f [subset] Keep (empty) DefaultLangSys for Script 'DFLT'
That's still required by the spec.
https://bugzilla.mozilla.org/show_bug.cgi?id=1331737#c32
2017-08-11 14:51:15 -07:00
Behdad Esfahbod
f0c58ddf9b [varLib] Remove unused import 2017-08-09 21:43:44 -07:00
Behdad Esfahbod
fe01d87b94 [subset] Support GSUB/GPOS.FeatureVariations
We should add a test using the font at:
https://github.com/behdad/harfbuzz/issues/521

Test with:
$ fonttools subset avar_rvrn.ttf --text=r
2017-08-08 17:21:58 -07:00
Behdad Esfahbod
b2e9882b30 [subset] Update list of features 2017-08-08 17:21:58 -07:00
Jens Kutilek
f36c7ec39f Make "unexpected character" exception ASCII-safe 2017-08-08 13:46:05 +02:00
Behdad Esfahbod
a1629fa52b [varLib] Update supportScalar() to allow for OpenType-specific contraints
Part of https://github.com/fonttools/fonttools/issues/1020
2017-08-07 17:05:29 -07:00
justvanrossum
18fa7ccec0 supportScalar(): ignore an axis when its peak value is 0; fixes #1020 2017-08-07 13:16:24 +02:00
Erik van Blokland
4762865cac Makes it a bit easier to find out what is wrong with the values. 2017-08-05 20:37:37 +02:00
Behdad Esfahbod
b9151ffacb [varLib] Add assertions to make sure we merge similar ValueFormat2-zeroedness 2017-08-04 09:22:43 +01:00
Behdad Esfahbod
49f249b118 [varLib] Add faster tables first
Speeds up development speed :).
2017-08-04 09:07:38 +01:00
Behdad Esfahbod
f3031ce797 [varLib] Add comment 2017-08-04 08:55:34 +01:00
Behdad Esfahbod
010ea47de1 [varLib] Minor rename 2017-08-04 08:41:29 +01:00
Cosimo Lupo
b5ab6d3af3 [varLib] temporary workaround to make MVAR tests pass
https://travis-ci.org/fonttools/fonttools/jobs/260671300#L2519-L2519

Behdad will revert this later
2017-08-03 17:57:16 +01:00
Cosimo Lupo
74035147a0 [varLib] remove unused 'instances' argument in _add_avar 2017-08-03 14:57:02 +01:00
Behdad Esfahbod
3746f75d7f [varLib] Split _add_fvar_avar() into _add_fvar() and _add_avar() 2017-08-03 12:38:23 +01:00
Cosimo Lupo
19c4b377b8 [varLib] add predefined avar mappings to fix rendering in CoreText
Fixes https://github.com/googlei18n/fontmake/issues/295
2017-08-02 15:12:26 +01:00