74 Commits

Author SHA1 Message Date
Behdad Esfahbod
349cd94d17 [graphite] Fix for big-endian
Make all "if sys.byteorder..." and "byteswap" be on the same line for
earsier grep verification.

Fixes https://github.com/fonttools/fonttools/issues/1311
2018-09-05 21:12:53 -07:00
Behdad Esfahbod
f82128f25d Kill progress argument
Fixes https://github.com/fonttools/fonttools/issues/1008

Doesn't touch xmlReader / xmlWriter modules.
2018-01-25 17:30:23 -08:00
Sascha Brawer
155ec67ae6 [cvar] Implement cvar table 2017-01-10 17:57:04 +01:00
Sascha Brawer
689008a4f5 [gvar/cvar] Rename decompileVariationTuples to decompileVariationTupleStore
For consistency with the terminology of the OpenType 1.8 specification,
and for symetry with the compileVariationTupleStore function.
2017-01-09 19:00:39 +01:00
Sascha Brawer
5d3eae404c [cvar] Compile TupleVariationStores in common library 2017-01-09 17:34:45 +01:00
Sascha Brawer
c3d68a684e [cvar] Move compileSharedTuples() to module TupleVariation 2017-01-09 17:01:43 +01:00
Sascha Brawer
87d854e881 [cvar] Move decompilation of shared tuples to TupleVariation.py 2017-01-09 14:25:16 +01:00
Sascha Brawer
24a02fedd7 [cvar] Refactor decompilation of tuple variation stores 2017-01-09 14:05:52 +01:00
Sascha Brawer
7c082600d3 [cvar] Move decompilation for single TupleVariation out of gvar
Rename local variables to match terminology of OpenType 1.8 specification
2017-01-09 12:14:12 +01:00
Sascha Brawer
980ee57b0e [gvar] Rename gvar.decompileSharedCoords() to decompileSharedTuples()
The new name is consistent with the terminology of the OpenType 1.8
specification, which calls the decoded structure the `SharedTuples`
array.
2017-01-05 14:18:52 +01:00
Sascha Brawer
039cb48927 [gvar] Move gvar.computeMinMaxCoord() to TupleVariation.inferRegion()
Document what this helper function does, using terminology from
the OpenType 1.8 specification.
2017-01-05 13:35:27 +01:00
Sascha Brawer
39c4ef621c [cvar] Change warning message for out-of-range points 2017-01-05 08:55:36 +01:00
Sascha Brawer
01f95fc190 [gvar] Rename header fields to match OpenType specification
The initial implementation had been written with Apple's TrueType
specification, before OpenType supported variations.
2017-01-04 16:24:32 +01:00
Sascha Brawer
271987a89f [gvar] Adjust comment about broken variation fonts on macOS 2017-01-04 14:31:52 +01:00
Sascha Brawer
3420bb116c [gvar] Move TupleVariation to its own source file
The TupleVariation structure is used both for `gvar` and `cvar`.
2017-01-04 14:07:38 +01:00
Sascha Brawer
1d28abdb65 [gvar] Rename GlyphVariation to TupleVariation
In the OpenType 1.8 specification, this is called TupleVariation
so let's be consistent with the spec. (The initial implementation
in fonttools pre-dates OpenType 1.8).
2017-01-04 12:41:55 +01:00
Sascha Brawer
a837a3950f [gvar] Use flag names from OpenType 1.8
FontTools has initially been implemented using the Apple TrueType
specification.  When OpenType adopted variations, some identifier
names were changed.
2017-01-03 17:09:47 +01:00
Behdad Esfahbod
8e46c6a121 [varLib] Err if gvar tuples have unknown location axes 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
9c037fc826 [gvar] Add TODO 2016-07-16 21:22:20 -07:00
Behdad Esfahbod
b1eeaa5151 [gvar] Fix point encoding
Where more than one run is used, it's only the first run's first point
that is absolute, all other values are relative.

Similar fix landing in FreeType soon.  Fixes lizzard glyph (glyphname
"dollar") in Zycon.
2016-07-15 18:15:17 -07:00
Behdad Esfahbod
40198a2dec [gvar] Use array.array to decode deltas 2016-03-21 10:12:26 -07:00
Behdad Esfahbod
9987b7e14e [gvar] Use array.array to decode deltas 2016-03-21 10:12:26 -07:00
Miguel Sousa
a7aef47695 fix "indentation contains mixed spaces and tabs" errors reported by Landscape 2015-08-09 00:33:50 -07:00
Sascha Brawer
53e7db624a [GX] Make it easier to construct ‘fvar’ tables from code
In the previous table-driven implementation, client code had to
know the internals of the ‘fvar’ structure for correctly adding
variation axes to a font. In the new implementation, clients
do not have to futz around with binary offsets (which makes it
more likely that tools build correct fonts).
2015-06-24 15:05:03 +02:00
Behdad Esfahbod
37e6e6a380 Use dict comprehension now that we don't support Python 2.6 2015-06-11 17:05:15 -07:00
Sascha Brawer
7f6d2af45a [GX] Optimize ‘gvar’ tables for tuples affecting all points in a glyph
After this change, round-tripping through TTX shrinks the size of all
our test fonts. Specifically, Skia.ttf shrinks from 478K to 473K,
JamRegular.ttf from 113K to 107K, and BuffaloGalRegular from 67K to 61K.
2015-06-10 11:19:06 +02:00
Sascha Brawer
4bbc1f7e83 [GX] In ‘gvar’ code, rename numPoints to numPointsInGlyph
This make the code easier to understand, especially since there
is a diffence between numPointsInGlyph, numPointsInRun and
numPointsInData.

Also, we now pass numPointsInGlyph to compilePoints() to later
enable an optimization where numPointsInData == numPointsInGlyph.
However, this change does not yet make that optimization.
2015-06-10 10:54:08 +02:00
Sascha Brawer
f121b070f7 [GX] Emit correct number of points for long ‘gvar’ tuples
Before this change, the compilePoints() routine would wrongly clear
the most-significant bit of the lower byte in its binary output.

An example glyph affected by this bug was “perthousand.oldstyle” in
the version of Skia.ttf that Apple ships with MacOS X Yosemite 10.10.3.

Although the broken code path was exercised in the unit tests, the
length of the test input just happened to have the affected bit clear,
which is why this bug did not get caught by the previous test cases.
2015-06-10 09:46:18 +02:00
Sascha Brawer
1426431c2f [GX] Minor: Removed unneeded variable in “gvar” handling code 2015-06-09 15:17:58 +02:00
Sascha Brawer
1d211ff058 [GX] Removed unused function argument in ‘gvar’ handling code 2015-06-09 15:08:01 +02:00
Sascha Brawer
e39c2957de [GX] Fix some minor lint warnings by landscape.io 2015-06-09 14:04:33 +02:00
Sascha Brawer
624b2b7529 [GX] In ‘gvar’ tuples, treat (0,0) different from unspecified entries
After this change, MacOS Yosemite 10.3.3 renders the Oslash glyph
of Skia.ttf with the exact same outline before and after round-tripping
the font through TTX.  Before this change, the outlines were slightly
different after round-tripping through TTX.

In my initial reading of the “gvar” specification, I had assumed
that (0,0) entries had no significance. However, that is not
how the current MacOS implementation interprets it.
2015-06-09 12:41:40 +02:00
Sascha Brawer
64d8411c1c Remove work-around for https://github.com/behdad/fonttools/issues/286 2015-06-08 23:03:17 +02:00
Sascha Brawer
cd8af14991 [GX] Leave 'gvar' coordinates unchanged when round-tripping through TTX
Before this change, a rounding issue in fixedToFloat() would sometimes
change 'gvar' coordinate values when round-tripping Skia.ttf through TTX.
This change works around https://github.com/behdad/fonttools/issues/286.
2015-06-08 23:00:03 +02:00
Sascha Brawer
9dd0a7e4cd [GX] Replace range(len(...)) by enumerate(...)
This addresses 7271b779f3 (commitcomment-11374941)
2015-06-08 23:00:03 +02:00
Sascha Brawer
5ba59b3f4b [gvar] Take glyphs from gvar.variations
When compiling the set of shared coordinates, walk over glyphs in
self.variations instead of retrieving them in glyph order.

This addresses a code review comment:
0f86c1c0d3 (commitcomment-11375190)
2015-06-08 23:00:03 +02:00
Sascha Brawer
1447730438 Fix most pylint warnings for 'gvar' table 2015-06-08 23:00:03 +02:00
Sascha Brawer
513458f558 [GX] Test round-trip decompile/compile for glyph variations
Also, implement an __eq__ method on GlyphVariation so we can verify
whether the result of round-tripping actually equals the original input.
2015-06-08 23:00:02 +02:00
Sascha Brawer
54866e9294 Minor changes for Python 3 2015-06-08 23:00:02 +02:00
Sascha Brawer
6d5049cb57 Minor changes towards supporting python3. 2015-06-08 23:00:02 +02:00
Sascha Brawer
e4377af3fd Replace xrange() by range(), for python3
In Pyton 3, range() is implemented like xrange() in Python 2,
and there is no xrange() anymore. The savings from xrange() are
too small for us to really bother, so we choose to live inefficiently
on Python 2.
2015-06-08 23:00:02 +02:00
Sascha Brawer
9bb1ca02ba [GX] Remove obsolete, unused helper method 2015-06-08 23:00:01 +02:00
Sascha Brawer
7d0f22e1e3 [GX] Temporarily disable code path for emitting shared points in 'gvar' tables
With this work-around, all of {Skia, BuffaloGalRegular, JamRegular}.ttf
can be round-tripped through TTX, and the resulting TrueType font
can be displayed by MacOS X 10.9.5 including glyph variations.
2015-06-08 23:00:01 +02:00
Sascha Brawer
b309a36157 [GX] Improve tests for compiling 'gvar' tables 2015-06-08 23:00:01 +02:00
Sascha Brawer
d5005c7f3e [GX] Compile 'gvar' tables 2015-06-08 23:00:01 +02:00
Sascha Brawer
b85ff8ed31 [GX] Compile delta offsets for 'gvar' table to compact encoding 2015-06-08 23:00:01 +02:00
Sascha Brawer
94bf26eace Minor 2015-06-08 23:00:00 +02:00
Sascha Brawer
79e704807d [GX] Add comment on when to use shared versus private point lists for 'gvar' tuples 2015-06-08 23:00:00 +02:00
Sascha Brawer
970c37e395 [GX] Compile sets of packed point numbers for 'gvar' table
Work in progress. Prints out various debug info that will be removed
in the final version.
2015-06-08 23:00:00 +02:00
Sascha Brawer
6976d8ed33 [GX] Omit 'gvar' tuples whose deltas are all zero
In the Apple Skia font, about 5% of all tuples are redundant
because all their delta offsets are (0, 0); these tuples can
be omitted without any visual loss. But in the BuffaloGalRegular
and JamRegular fonts, there are no such redundant tuples.
2015-06-08 23:00:00 +02:00