312 Commits

Author SHA1 Message Date
Sascha Brawer
1ddfe24338 [feaLib] Support multiple chain contexts after ignore sub
Although this construct is in violation of the `ignore sub` grammar
given by the current OpenType Feature File syntax specification,
the very same specification document illustrates (in example 3
of section 5.f.ii) the `ignore sub` statement with a comma-separated
list of backgrack/input/lookahead triples.

See https://github.com/adobe-type-tools/afdko/issues/105 for a request
to amend the OpenType Feature File syntax specification.

After this code change, feaLib can now parse testdata/spec5f_ii_3.fea;
the output is identical to what is generated by Adobe's makeotf tool.

https://github.com/behdad/fonttools/issues/503
2016-02-05 11:02:29 +01:00
Sascha Brawer
a862f70880 [feaLib] Add unit test for spec section 5.f.ii, example 2
Output is identical to makeotf.
2016-02-05 08:35:18 +01:00
Sascha Brawer
27e23f9a95 [feaLib] Emit context-free chains to single substitutions
Resolves https://github.com/behdad/fonttools/issues/509
2016-02-04 16:45:05 +01:00
Sascha Brawer
dba1d6666b [feaLib] Emit chains to LigatureSubst even without backtrack or lookahead
https://github.com/behdad/fonttools/issues/506
2016-02-04 15:31:29 +01:00
Sascha Brawer
ea4a4e34b3 [feaLib] Reverse lookup order for chained single substitutions
This makes feaLib's output more similar to output from makeotf.
Resolves https://github.com/behdad/fonttools/issues/507.
2016-02-04 15:07:47 +01:00
Sascha Brawer
3d6cf0d8e6 [feaLib] Reverse lookup order for chained multiple substitutions
https://github.com/behdad/fonttools/issues/507
2016-02-04 14:46:22 +01:00
Sascha Brawer
7574260bed [feaLib] Reverse lookup order for chained alternate substitutions
For this construct, makeotf throws an error: "Contextual alternate
rule not yet supported". If it had been implemented, we speculate
that the ordering would likely be the same as with other contextual
substitutions (the chain comes before, not after, the dependent lookup).

https://github.com/behdad/fonttools/issues/507
2016-02-04 14:34:45 +01:00
Sascha Brawer
e8a4b341f3 [feaLib] Reverse lookup order for chained ligature substitutions
https://github.com/behdad/fonttools/issues/507
2016-02-04 14:24:48 +01:00
Sascha Brawer
ab7b86005e [feaLib] Implement the ignore substitution statement
https://github.com/behdad/fonttools/issues/503
2016-02-04 11:39:03 +01:00
Sascha Brawer
aae350c84a [feaLib] Change semantics of script statement
Before this change, the `script` statement had inherited global
defaults. After this change, it overrides them. The new behavior
matches the behavior of makeotf v2.0.90.

Resolves https://github.com/behdad/fonttools/issues/505.

For the test case of https://github.com/behdad/fonttools/issues/501,
which was about an unrelated problem, feaLib now produces the exact
same output as makeotf v2.0.90.
2016-02-04 10:31:33 +01:00
Sascha Brawer
f9a236f54e [feaLib] Allow script and language statements in named lookup blocks
Although the specification writes the exact opposite, makeotf does
accept script and language statements inside named lookup blocks.
Since Glyphs.app (and possibly other tools, too) produce feature files
that make use of this syntax, enforcing the spec would break existing
files.

Resolves https://github.com/behdad/fonttools/issues/501.
2016-02-04 09:52:20 +01:00
Sascha Brawer
a3f70370fe [feaLib] Add a unit test for compiling enum pos statements
Example from section 6b.ii of the OpenType Feature File specification.
2016-02-04 09:23:46 +01:00
Sascha Brawer
a1fa968576 [feaLib] Use a different approach to synthesizing feature aalt
Resolves https://github.com/behdad/fonttools/issues/502.
2016-02-03 17:38:38 +01:00
Sascha Brawer
edb1ed0fcc [feaLib] Synthesize alternate substitutions for feature aalt
After this change, feaLib synthesizes the same lookups as makeotf v2.0.90
for `feature aalt` in the example of section 8.a of the OpenType Feature
File specification.
2016-02-03 15:17:37 +01:00
Sascha Brawer
bf79ceb2f2 [feaLib] Disallow lookup blocks inside feature aalt
The new behavior matches how makeotf v2.0.90 interprets
the OpenType Feature File Specification.
2016-02-03 11:39:50 +01:00
Sascha Brawer
faeba0c0c0 [feaLib] Support lookups with mixed glyph/class-based kerning
Resolves https://github.com/behdad/fonttools/issues/456
2016-02-02 18:24:48 +01:00
Sascha Brawer
c64019b3c6 [otlLib] Move building of class-based PairPos sutables from feaLib to otlLib 2016-02-02 15:17:01 +01:00
Sascha Brawer
f9e859c213 [otlLib] Move helper for building ClassDef tables from feaLib to otlLib 2016-02-02 10:48:47 +01:00
Sascha Brawer
0f609592bb [otlLib] Build multiple glyph-based PairPos subtables when needed
Before this change, feaLib would group glyph-based pair positionings
by value formats. After this change, this logic happens in otlLib.
But clients can still do their own grouping if they wish, by calling
the buildPairPosGlyphsSubtable() method directly.
2016-02-02 10:30:33 +01:00
Sascha Brawer
5095aa9ecf [otlLib] Move building of glyph-based PairPos subtables from feaLib to otlLib 2016-02-02 09:35:31 +01:00
Sascha Brawer
4ee17824e1 [feaLib] Use global scope for glyph classes; allow re-definitions
Resolves https://github.com/behdad/fonttools/issues/496
2016-02-01 18:29:41 +01:00
Sascha Brawer
befce507a8 [feaLib] Use global scope for lookup names
Resolves https://github.com/behdad/fonttools/issues/461
2016-02-01 14:39:32 +01:00
Cosimo Lupo
c4d2ebca66 remove deprecated use of 'quiet' option in test modules 2016-02-01 13:39:39 +00:00
Cosimo Lupo
ac56990aad replace all uses of codecs.open with py23.open 2016-01-26 15:45:27 +00:00
Sascha Brawer
ab8f9ee785 [feaLib] Add test case for bug 463
https://github.com/behdad/fonttools/issues/463
2016-01-26 12:45:56 +01:00
Sascha Brawer
6dcddd9e36 [feaLib] Compile test files to binary tables in addition to XML
https://github.com/behdad/fonttools/issues/463
2016-01-26 12:39:41 +01:00
Sascha Brawer
b2e663a1fc [feaLib] Compile lookups after assigning lookup indices
Before this change, feaLib had assigned a lookup index at the same
time as compiling each lookup. For chains, the implicit assumption was
that the chain's targets would always come before the contexual chain.
Normally this was indeed the case, but feaLib (and also makeotf)
sometimes merge several chain targets into one single lookup,
and then this assumption was not true anymore.

In the new version, the lookups get compiled in a separate pass,
after assigning lookup indices.

https://github.com/behdad/fonttools/issues/463
2016-01-26 12:09:52 +01:00
Sascha Brawer
f5af1cf682 [feaLib] Minor: Remove obsolete import statement 2016-01-25 19:46:02 +01:00
Sascha Brawer
c09e8862c0 [feaLib] Handle contextual chained SinglePos rules
Resolves https://github.com/behdad/fonttools/issues/485.
2016-01-25 16:27:18 +01:00
Sascha Brawer
a7c0b5c78f [feaLib] Implement chained contextual single positioning
https://github.com/behdad/fonttools/issues/485
2016-01-25 15:10:40 +01:00
Sascha Brawer
312136356a [feaLib] Raise FeatureLibError for not-yet-implemented construct 2016-01-25 12:26:23 +01:00
Sascha Brawer
82a444d659 [feaLib] Parse glyph patterns with multiple values
For example, we now recognize `pos one' 1 two' 2 three' 3;`
as a SinglePos statement, like makeotf does.

https://github.com/behdad/fonttools/issues/485
2016-01-25 12:18:17 +01:00
Behdad Esfahbod
58b49a1a42 [otlLib] change buildDevice API to take dict
Makes more sense.  feaLib can be simplified by storing a dict
as well, but for now just cast.
2016-01-22 19:45:56 +01:00
Behdad Esfahbod
4e13a2268e [otlLib] One more rename 2016-01-22 19:38:20 +01:00
Behdad Esfahbod
aea0ce9ae1 [otlLib] Adapt names to newly agreed scheme 2016-01-22 19:32:45 +01:00
Sascha Brawer
af48e43371 [otlLib] Move building of MarkLigPos from feaLib to otlLib 2016-01-22 14:50:17 +01:00
Sascha Brawer
036e2ce497 [otlLib] Move building of LigatureArrays from feaLib to otlLib
Not sure if empty ComponentRecords can be optimized away.
For the time being, leaving the output unchanged so that
the refactoring has no effect on the generated files.
2016-01-22 14:14:47 +01:00
Sascha Brawer
1978194caf [otlLib] Move building of LigatureAttach tables from feaLib to otlLib 2016-01-22 12:45:29 +01:00
Sascha Brawer
cf7c670e80 [otlLib] Move building of MarkBasePos from feaLib to otlLib 2016-01-22 11:53:34 +01:00
Sascha Brawer
50cbd5ca78 [otlLib] Move building of BaseArrays from feaLib to otlLib 2016-01-22 10:57:03 +01:00
James Godfrey-Kittle
34115b2f3f [feaLib] Add unit test for empty statement parsing 2016-01-21 13:32:58 -08:00
James Godfrey-Kittle
8fa5073e7e [feaLib] Accept empty statements in parser 2016-01-21 10:32:30 -08:00
Sascha Brawer
de24f4f0d4 [otlLib] Move building of BaseRecords from feaLib to otlLib 2016-01-21 17:23:36 +01:00
Sascha Brawer
08fa0f14dd [otlLib] Move building of MarkArrays from feaLib to otlLib 2016-01-21 16:23:55 +01:00
Sascha Brawer
f42d312580 [otlLib] Move building of ComponentRecords from feaLib to otlLib 2016-01-21 15:16:55 +01:00
Sascha Brawer
15ca8bb0a0 [otlLib] Move building of Mark2Records from feaLib to otlLib 2016-01-21 13:08:16 +01:00
Sascha Brawer
b07d168c0e [feaLib] Simplify how MarkArrays are built 2016-01-21 11:39:34 +01:00
Sascha Brawer
3c65e82307 [otlLib] Move building of otTables.Lookup from feaLib to otlLib 2016-01-20 19:25:41 +01:00
Sascha Brawer
51ec0bf5cc [otlLib] Move building of MarkGlyphSetsDef table from feaLib to otlLib 2016-01-20 11:28:33 +01:00
Sascha Brawer
3eacada029 [otlLib] Move building of LigCaretLists from feaLib to otlLib 2016-01-20 09:49:09 +01:00