1851 Commits

Author SHA1 Message Date
Sascha Brawer
7eee900ea3 [feaLib] Add test for rejecting inconsistent flags in a named lookup block 2016-01-06 17:53:26 +01:00
Sascha Brawer
45cc496bed [feaLib] Support compact syntax for chaining to multiple substitutions
https://github.com/behdad/fonttools/issues/445
2016-01-06 17:33:34 +01:00
Sascha Brawer
6c5cb7f06e [feaLib] Fix typo on header comment 2016-01-06 16:24:43 +01:00
Sascha Brawer
a543b2e3b9 [feaLib] Support compact syntax for chaining to single substitutions
Resolves https://github.com/behdad/fonttools/issues/445 for single
substitutions. The compact forms for chaining to other GSUB types
are not yet supported; these will get fixed in follow-up changes.
2016-01-06 16:15:26 +01:00
Sascha Brawer
654c086574 [feaLib] Do not use glyph class 0 when building ClassDef2 tables
See https://github.com/adobe-type-tools/afdko/issues/90 for context.
2015-12-23 15:14:00 +01:00
Sascha Brawer
6254974112 [feaLib] Support GPOS type 2, format 2: Class-based kerning tables 2015-12-23 11:35:49 +01:00
Sascha Brawer
26c02e4d95 [feaLib] Add helper for creating glyph class definition tables
The helper will be used for building class-based kerning tables.
2015-12-22 14:42:13 +01:00
Sascha Brawer
dd23788a53 [feaLib] Raise a not-yet-implemented error for class-based kerning
Before this change, we silently generated bad fonts. After this
change, we emit the exact same output like `makeotf` for specific
kerning pairs, and reject the input file for the not yet implemented
class-based kerning. (The implementation of class-based kerning
is coming soon).
2015-12-21 16:06:59 +01:00
Sascha Brawer
3812e992c1 [feaLib] Enumerate also the second glyph class in enum pos statements
Before this change, the compiler would enumerate only the first
glyph class of a kerning pair. However, that behavior did not match
the behavior of the `makeotf` tool.
2015-12-21 15:16:47 +01:00
Cosimo Lupo
7c63234ca6 Merge pull request #437 from anthrotype/fix-macres-overflow
macRes: fix OverflowError while reading resource on 32-bit Python
2015-12-15 11:27:15 +00:00
Behdad Esfahbod
462496ce32 [mtiLib] Minor 2015-12-15 12:09:19 +01:00
Behdad Esfahbod
fd84ac769b [mtiLib] Disable lookupMap until we fix forward references 2015-12-15 12:09:19 +01:00
Cosimo Lupo
e4ab85e90a macRes: fix OverflowError while reading resource on 32-bit Python
Fixes https://github.com/behdad/fonttools/issues/436
2015-12-15 11:01:26 +00:00
Sascha Brawer
cba2220446 [feaLib] Pass syntax tree nodes for kerned glyphs to builder
For GPOS type 2, the OpenType Feature File format makes a semantic
difference between `glyph` and `[glyph]`, so we need to pass the
syntax tree for the kerned glyphs and glyph classes down to the builder.

Previously, we were expanding syntax tree nodes to glyphSets at
parsing time. Therefore, the builder could not distinguish a statement
for kerning two single glyphs from a statement for kerning two glyph
glasses, where each glyph class would consist of a singleton
glyph. (Debating whether or not it makes much sense to have this
distinction is outside the scope of fonttools; we want to implement
the language in its present form).

The builder does not yet use this information for building different
tables. This change is just about plumbing.
2015-12-14 12:33:07 +01:00
Cosimo Lupo
0227945781 _t_r_a_k: do not import unicode_literals as it makes struct fail on some old Python 2.7.x
On the latest Python 2.7.10, struct accepts both unicode and str as 'fmt'.
However on Travis for py27 we use the built-in OSX Python, which on OSX 10.9 is Python 2.7.5.

Travis log: https://travis-ci.org/anthrotype/fonttools/jobs/96473892#L3010

Python issue: https://bugs.python.org/issue19099
2015-12-12 19:28:59 +00:00
Cosimo Lupo
8bc30bc4d2 ttLib.__init__: replace '>>>' with '>>' in docstring to avoid triggering pytest doctests discovery
the docstring references an example 'afont.ttf' file which obviously doesn't exist.
2015-12-12 18:11:59 +00:00
Sascha Brawer
0dd370760e [feaLib] Clean up the handling of markClass statements 2015-12-12 12:55:21 +01:00
Sascha Brawer
dcae8fd8ba [feaLib] Represent mark class names as nodes in the syntax tree
Again, this will be needed for eventually distinguishing `glyph`
from `[glyph]` or `@CLASS`, which makes a semantic difference
when building GPOS type 2 tables.
2015-12-11 16:30:20 +01:00
Behdad Esfahbod
a9a5bd6d28 [mtiLib] Make backward lookup and feature name references work 2015-12-11 16:38:33 +01:00
Behdad Esfahbod
3d289927a4 [mtiLib] Remove unused function 2015-12-11 16:38:25 +01:00
Behdad Esfahbod
e9738c655e [mtiLib] Allow intermixing of lookups and feature / script tables 2015-12-11 16:38:21 +01:00
Behdad Esfahbod
942cdd8477 [mtiLib] Towards recognizing symbolic references 2015-12-11 16:38:18 +01:00
Sascha Brawer
e99eb7948b [feaLib] Distinguish between glyphs and glyph classes in parse tree
This will be needed for implementing class-based kerning.  According
to the OpenType Feature File specification, a different table needs to
be built for `glyph` versus `[glyph]`.
2015-12-11 15:16:22 +01:00
Sascha Brawer
3a41bf7024 [feaLib] Make ValueRecord an Expression, not a Statement 2015-12-11 14:39:59 +01:00
Sascha Brawer
ac86de36fb [feaLib] Implement the lookupflag statement 2015-12-10 19:17:11 +01:00
Sascha Brawer
dfd210faef [feaLib] Parse lookupflag also when MarkAttachmentType comes last
Before this fix, the parser failed to process statements of the form
`lookupflag MarkAttachmentType @GLYPHCLASS;` when no other flag
were set after the glyph class. However, statements like
`lookupflag MarkAttachmentType @GLYPHCLASS RightToLeft;` were
getting recognized perfectly fine.
2015-12-10 16:00:54 +01:00
Behdad Esfahbod
74ebf424c6 [mtiLib] Fix file permission 2015-12-10 15:44:51 +01:00
Sascha Brawer
0dbb2fdcc0 [feaLib] Parse lookupflag statements
They do not have any impact yet, this change is just for the parsing.
2015-12-10 13:06:28 +01:00
Behdad Esfahbod
ef03a3be47 Merge fd2ft, rename it to mtiLib
Implements Monotype Imaging's OpenType_Table_Source format as
specified at:

  http://monotype.github.io/OpenType_Table_Source/otl_source.html
2015-12-10 12:57:37 +01:00
Sascha Brawer
e0a3350406 [feaLib] Implement GPOS type 8: Chaining contextual positioning 2015-12-09 23:53:20 +01:00
Sascha Brawer
cb0adb98b9 [feaLib] Parse GPOS type 8: Chaining contextual positioning
No output is generated yet, this change is just on the parser.

The OpenType Feature File specification is surprisingly vague about
the exact syntax of chaining contextual positioning rules, so I expect
that we will have to iterate on this parser. However, the test case
in parser_test.py gets recognized by `makeotf`, so the current
implementation is unlikely to be completely wrong.
2015-12-09 23:04:36 +01:00
Cosimo Lupo
4ae2604dca Merge pull request #397 from rsheeter/master
Experimental support for Google-style color bitmap fonts
2015-12-09 21:38:28 +00:00
Rod Sheeter
9927a91653 Remove change to _dict_subset (meant to be local/test only). Add a cmap fmt 0 to color font test file. 2015-12-09 13:32:35 -08:00
Sascha Brawer
a364f60d1d [feaLib] Change semantics of markClass to also define a glyphclass
While not really documented in the OpenType Feature File specification,
the AFDKO makeotf tool handles the `markClass` statement this way.
Also, some examples in the specification seem to imply this semantics.
2015-12-09 22:15:52 +01:00
Rod Sheeter
905eb831b9 Add Google-style color font test and make _dict_subset more forgiving. 2015-12-09 13:05:16 -08:00
Cosimo Lupo
812609e90c [subset] fix logic of EBLC subsetting; avoid KeyError in EBDT subsetting 2015-12-09 09:42:15 -08:00
Rod Sheeter
9189d1a1f0 Experimental support for Google-style color bitmap fonts 2015-12-09 09:42:15 -08:00
Sascha Brawer
c2c033d3cf [feaLib] Implement GPOS type 6: Mark-to-mark attachment positioning 2015-12-09 17:56:47 +01:00
Sascha Brawer
2af0adde6c [feaLib] Parse Mark-to-mark attachment positioning statements
No output is produced yet; this will come in an upcoming change.
2015-12-09 17:14:13 +01:00
Sascha Brawer
96223b8aee [feaLib] Implement GPOS type 5: Mark-to-ligature attachment positioning 2015-12-09 16:51:15 +01:00
Sascha Brawer
d622f99982 [feaLib] Clean up class names of Abstract Syntax Tree statements
The class names of tree nodes for substitution and positioning rules
are now consistent with `builder.py`, which in turn is consistent with
`otTables.py`.
2015-12-09 13:58:05 +01:00
Sascha Brawer
5b1b1d17f6 [feaLib] Restructure MarkBasePosBuilder in preparation of MarkLigPosBuilder
The upcoming MarkLigPosBuilder will have some parts in common with
MarkBasePosBuilder. Move these common parts into a helper method,
so that MarkLigPosBuilder will be able to call them.

Also, clean up the structure of MarkBasePosBuilder.
2015-12-09 13:23:50 +01:00
Sascha Brawer
7e846691e4 [feaLib] Consistently name LookupBuilders after their OpenType subtable class 2015-12-09 12:59:20 +01:00
Sascha Brawer
652bbeb51b [feaLib] Centralize how lookups are built from subtables 2015-12-09 12:51:01 +01:00
Sascha Brawer
320a4a57c6 [feaLib] Centralize the building of coverage tables 2015-12-09 12:30:57 +01:00
Sascha Brawer
0532ec85d3 [feaLib] Parse GPOS type 5: Mark-to-Ligature Attachment Positioning
No output is produced yet, this is just the change on the parser.
2015-12-09 10:40:49 +01:00
Sascha Brawer
25acebd824 [feaLib] Minor parser refactoring in preparation for GPOS type 5
GPOS type 5 has much in common with GPOS type 4, so we want to share
the common parsing code.
2015-12-08 23:46:04 +01:00
Sascha Brawer
0fbbe037bf [feaLib] Implement GPOS type 4: Mark-to-Base Attachment Positioning 2015-12-08 22:28:02 +01:00
Behdad Esfahbod
6c4d14dbce Enable writing of Count values that are never set
This can happen with empty MarkMark / MarkBase tables.
2015-12-08 20:41:54 +01:00
Behdad Esfahbod
8128b509a4 [subset] Augment ContextHelper
As needed in my Monotype OpenType format parser.  I'm not using the object
directly from subset module, but pushing back my changes here, in the hope
that we move this object to ttLib proper soon.
2015-12-08 20:40:42 +01:00