2589 Commits

Author SHA1 Message Date
Cosimo Lupo
b2ac89cc42 [apply-feature-file.py] swap args position in addOpenTypeFeatures func call
this changed in commit 5e64857b975c842acadd0eba859c689a23c81b63

Fixes #553
2016-03-20 19:31:28 +00:00
Sascha Brawer
7eed24725f Allow include statements not terminated by a semicolon
The lexer passes the semicolon to the parser, which will read over it.
Resolves https://github.com/behdad/fonttools/issues/552.
2016-03-20 17:26:20 +01:00
Sascha Brawer
9ec04f0537 Merge pull request #547 from adrientetar/patch-2
feaLib: support string input
2016-03-20 09:09:06 -07:00
Adrien Tétar
492df7359b feaLib: fix tests 2016-03-20 15:01:33 +01:00
Sascha Brawer
cf81e8adeb Merge pull request #551 from khaledhosny/fealib-base
[feaLib] Support BASE table
2016-03-20 04:57:49 -07:00
Khaled Hosny
1ac37d7d00 [feaLib] Support BASE table
Just the parts documented a currently implemented by Adobe’s
implementation.
2016-03-20 13:36:02 +04:00
Cosimo Lupo
c3056bcae5 Merge pull request #550 from khaledhosny/fealib-featurename
[feaLib] Support stylistic set featureNames and size feature
2016-03-19 18:29:01 +00:00
Khaled Hosny
40be0e6f3a [feaLib] Support size feature 2016-03-19 21:55:24 +04:00
Khaled Hosny
6e291cf705 [feaLib] Fix parsing float numbers
Numbers with integral parts >= 10 were incorrectly parsed as integers as
next_char always pointed to the second number not the decimal point.
2016-03-18 18:42:59 +04:00
Khaled Hosny
9feaab13aa [feaLib] Support stylistic set featureNames
Does not handle featureNames for cvXX features, but it shouldn’t be hard
for someone to extend the code to support them if inclined to do so.
2016-03-18 14:08:00 +04:00
Khaled Hosny
53dc98be55 [feaLib] Fix parsing name records
Don’t override supplied encoding and language ids.
2016-03-18 14:06:33 +04:00
Sascha Brawer
6a07beb699 Merge pull request #548 from mashabow/spec9e
[feaLib] Fix typo in testdata/spec9e.*
2016-03-16 17:48:27 -07:00
Masaya Nakamura
1adb1ad9e8 [feaLib] Fix typo in testdata/spec9e.*
Feature File Spec itself was fixed in https://github.com/adobe-type-tools/afdko/pull/110
2016-03-17 09:44:20 +09:00
Adrien Tétar
5e64857b97 feaLib: support string input 2016-03-15 20:01:29 +01:00
Sascha Brawer
4680701b6e Merge pull request #545 from khaledhosny/fea-lookupflag
Fix handling of default lookupflag
2016-03-15 09:12:44 -07:00
Sascha Brawer
41fbf35f63 Merge pull request #546 from khaledhosny/fealib-names
[feaLib] Support name table
2016-03-15 08:54:29 -07:00
Khaled Hosny
4e316cd337 [feaLib] Support name table 2016-03-15 17:49:02 +04:00
Behdad Esfahbod
8d9f04c576 Typo 2016-03-13 11:24:35 -07:00
Behdad Esfahbod
e2299a16b0 [otBase] Minor
Part of fixing https://github.com/behdad/fonttools/issues/518
2016-03-12 20:42:16 -08:00
Behdad Esfahbod
407c246433 [otBase] Minor renamings
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:42:13 -08:00
Behdad Esfahbod
c02ced3393 [otBase] Minor
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:42:08 -08:00
Behdad Esfahbod
6b46d8e553 [otBase] Move code around
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:42:05 -08:00
Behdad Esfahbod
4b94fd55cb Simplify overflow handling code
The code that is being removed is untested and does not seem to make
fixing an overflow any easier.  The fixer code just needs to know
which subtable caused the overflow and does not care about the item
within.  As such, no point in trying to find a "right" item.

In fact, leaving item as is, is more useful in debugging overflows
as it reflects which item's offset actually overflowed.

Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:11:34 -08:00
Behdad Esfahbod
c1080d9796 Implement splitting PairPosFormat2 in case of overflow
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 18:17:37 -08:00
Khaled Hosny
8d1930a27a Fix handling of default lookupflag
According to the spec:
> The lookupflag attribute defaults to 0 at the start of a feature
> block.
>
> The lookupflag attribute stays the same until explicitly changed, until
> a lookup reference statement is encountered that changes it, until the
> script is changed, or until the end of the feature.

This is an attempt to fix this by resetting the lookupflag at the start
and end of feature/lookup blacks. I’m not sure if resetting it in lookup
blocks is correct (my reading of the spec suggests it is not), but one
needs to test this against makeotf and see how it behaves here.
2016-03-13 00:43:10 +04:00
Behdad Esfahbod
7319cd0afc Minor 2016-03-12 02:21:07 -08:00
Cosimo Lupo
8bf333facb Merge pull request #544 from anthrotype/ttProgram-eq
test for NotImplemented in __ne__; add __eq__ and __ne__ to ttProgram.Program
2016-03-11 16:22:59 +00:00
Cosimo Lupo
d82a31dd57 return NotImplemented from __ne__ if __eq__ returns NotImplemented
otherwise `not NotImplemented` (always False) is returned from __ne__ when `type(self) != type(other)`, leading to illogic results like:

>>> from fontTools.ttLib.tables.DefaultTable import DefaultTable
>>> t = DefaultTable('test')
>>> t == 0
False
>>> t != 0
False

The latter of course should return True.
2016-03-11 15:10:50 +00:00
Cosimo Lupo
d4b9a2bec3 [ttGlyphPen_test] ttProgram has __eq__ now, remove unnecessary assignments
previously assertEqual would fail, despite the `program` attributes where both empty, as the object have different id(). The Program.__eq__ method now compares self.__dict__ == other.__dict__, hence the test pass.
2016-03-11 15:10:50 +00:00
Cosimo Lupo
35c46aa0e2 [ttProgram] add __eq__ and __ne__ methods to Program class 2016-03-11 15:10:50 +00:00
Cosimo Lupo
bc51241ca9 Merge pull request #542 from anthrotype/haveInstructions
[ttGlyphPen] only add empty ttProgram to simple glyphs, not to composites
2016-03-11 11:23:52 +00:00
Cosimo Lupo
9b83c377c2 [ttGlyphPen] only add empty ttProgram to simple glyphs, not to composites
Unlike simple glyphs (with contours) which must always have `instructionLength`, the field is optional in composite glyphs and depends on whether `WE_HAVE_INSTR` flag is set:
https://www.microsoft.com/typography/otspec/glyf.htm

In the previous code, the TTGlyphPen was adding an empty `program` attribute to any new glyph, including composite glyphs. It should only do it for simple glyphs.

For example, if you take Roboto-Regular.ttf from here:
https://github.com/google/roboto/releases/tag/v2.129

The font (unhinted) was compiled using the ttGlyphPen. It has 1434 composite glyphs. For each of them, a USHORT value for the number of instructions (0) is written, so the binary ttf is 2.868 KB greater than
what it should be.
2016-03-11 10:53:41 +00:00
Behdad Esfahbod
b01c41bcea [Snippets] Add symfont.py, for symbolic font statistics analysis 2016-03-10 06:13:18 -08:00
Cosimo Lupo
87d13888ce [ttGlyphPen] check last point in qCurveTo is not None
otherwise, if points[-1] == 0, the on-curve point won't be added.
2016-03-09 17:58:48 +00:00
Sascha Brawer
c3e2d37299 Snippet for applying a feature file to a font
It would be nice to also handle MTI feature files, and to process
TTX in addition to binary fonts, and and and... but it's a start.
https://github.com/behdad/fonttools/issues/527
2016-03-09 17:19:10 +01:00
Behdad Esfahbod
5794f9f6a2 Merge pull request #538 from jamesgk/master
[TTGlyphPen] Add component flags argument
2016-03-07 17:42:28 -08:00
James Godfrey-Kittle
fd5b6de3ba [TTGlyphPen] Add component flags argument 2016-03-07 14:48:46 -08:00
Behdad Esfahbod
a0d6ab6a07 [ttLib] Fix bug in OTLOffsetOverflowError generation
Part of fixing https://github.com/behdad/fonttools/issues/537

Now on to fixing the actualy overflow.
2016-03-04 06:06:33 -08:00
Behdad Esfahbod
bf28ca10d7 [EBLC] Decompile and release copies of data early
Apparently string slices are not as smart as I was hoping for.
Slicing a looong (say, 1MB) string and holding onto it is not a
good idea if done thousands of times.  So, do fewer slicings and
decompile subtables immediately instead of holding onto data.

This makes me want to rethink the kind of data structures we use
for lazy processing.

Fixes https://github.com/behdad/fonttools/issues/317
2016-03-02 11:31:20 +09:00
Behdad Esfahbod
7aed5c3ca9 GlyphCoordinates: add test for non-integer transform() 2016-02-24 13:01:09 +09:00
Behdad Esfahbod
87b1c0f403 GlyphCoordinates: Fix translating by non-integer 2016-02-24 12:58:32 +09:00
Behdad Esfahbod
d0552c994c GlyphCoordinates: add failing test for translating non-integer 2016-02-24 12:57:18 +09:00
Behdad Esfahbod
26621d548f GlyphCoordinates: return early from _checkFloat(), if already float 2016-02-24 12:52:38 +09:00
Behdad Esfahbod
cfd46b43f1 Merge pull request #526 from jamesgk/master
[TTGlyphPen] Don't cast values to int
2016-02-17 13:53:31 +07:00
James Godfrey-Kittle
f02e771527 [TTGlyphPen] Don't cast values to int
The glyf table will handle rounding when compiling, so this is
unnecessary.
2016-02-16 17:17:14 -08:00
Sascha Brawer
655fb4a856 Skip names whose offset+length points outside the string table
Resolves https://github.com/behdad/fonttools/issues/525
2016-02-16 14:39:44 +01:00
Cosimo Lupo
83e91d3af1 Merge pull request #521 from jamesgk/master
Replace one last call to debug() in mtiLib
2016-02-11 07:55:59 +00:00
James Godfrey-Kittle
c4dd050d8d Replace one last call to debug() in mtiLib
I think this was mistakenly left out of
b62f5509524a49101ab6f211f1c3b63458f52f5e
2016-02-10 14:18:38 -08:00
Behdad Esfahbod
d87d6aa39e [ot] Make sure GSUB/GPOS top arrays don't share bytes
Fixes https://github.com/behdad/fonttools/issues/518
Fixes https://github.com/behdad/fonttools/issues/372
2016-02-10 18:00:48 +07:00
Behdad Esfahbod
1085d8973d [ot] Minor 2016-02-10 17:28:56 +07:00