760 Commits

Author SHA1 Message Date
Behdad Esfahbod
92093990cc [ot] Minor 2015-07-02 15:01:20 -07:00
Behdad Esfahbod
aa9b3b6d43 [ot] Add readArray() and writeArray()
To be used soon to optimize partial / glyph array loading.
2015-07-02 15:01:15 -07:00
Behdad Esfahbod
64f1179230 Minor moving code around in prep for optimization work 2015-07-02 15:01:11 -07:00
Sascha Brawer
db1773af5d Remove redundant line
It should have been removed in #4792d7419cd44a6fb3988b760b87dcb494db8488
2015-07-01 12:21:07 +02:00
Sascha Brawer
4792d7419c Do not expose 'fvar' axis and instance flags in XML
The specification defines no values for these flags.
Resolves https://github.com/behdad/fonttools/issues/312
2015-07-01 09:10:32 +02:00
Cosimo Lupo
e05db5c75f [_c_m_a_p] fix compiling of cmap subtable format 6
Fixes https://github.com/googlefonts/fontbakery/issues/551

the `codes` variable needs to be a sorted list of cmap keys, else the following line
```python
codes = range(codes[0], codes[-1] + 1)
```
cannot work properly, since dict keys are unsorted.

Up until 13a08d0c3a59402459875155b7dbd194787fb229, there was a line with
```python
codes.sort()
```
which was deleted for some reason.
2015-06-27 17:01:51 +01:00
Sascha Brawer
292315cf63 [GX] Use OpenType range for weight axis in ‘fvar’ test 2015-06-27 02:07:37 +02:00
Cosimo Lupo
4fd6373b92 [TTFont] keep input file open if we didn't open it 2015-06-26 18:30:18 +01:00
Cosimo Lupo
356c923411 [TTFont] wrap input file in a temporary stream to allow overwriting
Fixes https://github.com/behdad/fonttools/issues/302
2015-06-26 12:19:42 +01:00
Behdad Esfahbod
389c445760 Merge pull request #300 from brawer/fvar
[GX] Make it easier to construct ‘fvar’ tables from code
2015-06-26 01:48:03 -07:00
Behdad Esfahbod
e7795be277 Merge pull request #307 from garretrieger/master
Test for load a kern table with a bad glyph id.
2015-06-25 18:36:02 -07:00
Behdad Esfahbod
0c68f18361 Fix compile/decompile of kern table with invalid glyphs
Was "broken" in the performance work in commits
8724513a67f954eac56eeb77ced12e27d7c02b6b and
1d93f9099de4987c5c7d7e49a23f4c46a45dfab2.

Use slow method if exception raised.

The changes should move to TTFont layer itself.  I'll move them
in a separate commit.
2015-06-25 18:31:52 -07:00
Garret Rieger
8bebea7253 Test for load a kern table with a bad glyph id. 2015-06-25 18:17:04 -07:00
Behdad Esfahbod
16edc99440 Merge pull request #305 from anthrotype/fix_program_len
add doctests for __bool__ method in ttProgram.Program and _f_p_g_m
2015-06-25 11:46:47 -07:00
Cosimo Lupo
3a856eeef8 [ttProgram] add doctests for __bool__ method 2015-06-25 19:22:42 +01:00
Cosimo Lupo
efdb837075 [_f_p_g_m] add doctests for __bool__ method 2015-06-25 19:22:01 +01:00
Cosimo Lupo
ca6e5c4f0a Merge pull request #303 from anthrotype/fix_program_len
[ttProgram] add missing __len__ method to Program class
2015-06-25 20:06:05 +02:00
Cosimo Lupo
ac41b6086b [_f_p_g_m] remove __len__ method from fpgm (and prep) table 2015-06-25 19:03:39 +01:00
Cosimo Lupo
733c05f51d [_f_p_g_m] add __bool__ and __nonzero__ methods to fpgm table 2015-06-25 19:03:39 +01:00
Cosimo Lupo
ea9c2faecd [ttProgram] add __bool__ and __nonzero__ methods to Program 2015-06-25 19:03:39 +01:00
Cosimo Lupo
63ebca3ada Merge pull request #297 from anthrotype/fix_bitmaps
[E_B_D_T_] make 'bitmaps' directory in the same location as output TTX file
2015-06-25 10:54:18 +02:00
Sascha Brawer
3cb5c9ca7c Replace calls to obsolete unittest.assertEquals()
Since Python 2.7, unittest.assertEquals() has been deprecated.
https://docs.python.org/2.7/library/unittest.html#deprecated-aliases
2015-06-25 10:11:52 +02:00
Behdad Esfahbod
27ade7643b Default itemSize to 16 in getSearchRange()
For compat with original fonttools.

Fixes https://github.com/typesupply/woffTools/issues/1
2015-06-24 16:07:06 -07:00
Behdad Esfahbod
ee3b5c0b6f Speed up name.getDebugName()
Avoid decoding all strings, and break early if found English.
2015-06-24 15:30:06 -07:00
Sascha Brawer
5bd9ade399 [GX] Remove ‘fvar’ table definition from otTables.py
There now is a Python implementation of variation axes, because this
makes it (much) easier to build variable fonts from code. Therefore,
the definitions in otTables.py are not needed anymore.
2015-06-24 15:58:05 +02:00
Sascha Brawer
5772339f19 [GX] Minor: Address landscape.io complaints about ‘fvar’ handler 2015-06-24 15:53:02 +02: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
Sascha Brawer
29328f20e5 Helper function to find a debug string for a name
Useful for generating XML comments when tables refer to name IDs.
For example, XML for a named instance in an ‘fvar’ table is easier
to read when it says <!-- Bold --> in addition to nameID="258".
2015-06-24 09:08:19 +02:00
Cosimo Lupo
55e4704043 [E_B_D_T_] make extfile 'bitmaps' directory in same location as output file 2015-06-23 11:51:30 +01:00
Behdad Esfahbod
c7b6d1943d Fix decompiling of cmap table
Previously, if a subtable's data was shared amongst two different encodings,
the second one being loaded was getting a cmap member assigned while retaining
its data item.  If we subset the cmap and then save that subtable, the original
unsubset data will be written out.  Fix, but removing data when assigning cmap.

Explains and obviates mystery hack in subsetter.
2015-06-22 19:14:09 -07:00
Sascha Brawer
b3cda9ea22 Minor: Remove unused imports in ‘avar’ parser 2015-06-21 12:13:51 +02:00
Sascha Brawer
cd3c28ab2d [GX] Support 'avar' table 2015-06-20 00:13:01 +02:00
Behdad Esfahbod
ca83ef2bf9 Merge pull request #277 from anthrotype/misspelling
[OS/2] fix misspellings 'usMaxContext', 'usFirstCharIndex', 'usLastCh…
2015-06-18 10:36:03 -07:00
Cosimo Lupo
5052950f81 [OS/2] fix misspelled attributes, and keep them using property decorators 2015-06-13 23:19:18 +01:00
Behdad Esfahbod
108c5853ea Fixup 6c83fe4846c711123c38654e5eb83d0a595d56ea
Ouch!
2015-06-12 15:04:37 -07:00
Sascha Brawer
2e6522c619 Re-generated table list now that ‘gvar’ is a supported table
Change was auto-generated by MetaTools/buildTableList.py
2015-06-12 22:25:14 +02:00
Behdad Esfahbod
fd39e88d2d Merge pull request #291 from brawer/gvar
[GX] Remove work-arounds for Python 2.6 from ‘gvar’ tests
2015-06-12 11:23:25 -07:00
Behdad Esfahbod
6c83fe4846 Really fix SingleSubst delta math
I had broken this in e06166b83aa82582dab2e011520b1a77f72aa9f9.

Fix that, and other issues.  Since I made that last commit, it has
become clear that SingleSubst works by adding delta and then doing
module 65536.

HarfBuzz was updated for this in 2011:
commit 52ebdff49d13f239efc886de935d47be9860f6e5
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Tue Sep 27 12:38:16 2011 -0400

    Fix GSUB lookuptype 1 subtype 1 delta wrapping
2015-06-12 10:27:04 -07:00
Sascha Brawer
2a44b81d64 [GX] Remove work-arounds for Python 2.6 from ‘gvar’ tests 2015-06-12 11:37:42 +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
Behdad Esfahbod
bd9375ae8e Use set literals 2015-06-11 13:42:38 -07:00
Behdad Esfahbod
b50b6f23c3 Merge pull request #258 from brawer/gvar
[GX] Support 'gvar' table
2015-06-10 11:28:40 -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
Cosimo Lupo
b1bd77f9f6 fix xmlWriter and _l_t_a_g tests failing on Windows because of \r\n 2015-06-10 10:17:05 +01: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
ca6126ea67 [GX] Fix ‘gvar’ unittest on Python 2.6
unittest.TestCase.assertSetEqual() was added in Python 2.7,
so we default to assertEqual() on Python 2.6.
2015-06-10 10:09:28 +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