500 Commits

Author SHA1 Message Date
Sascha Brawer
d2f9fa8a39 [feaLib] Simplify how ClassDef tables are built
In f0eb7e98ca0642f17ac82433db8c957fffd6a9d3, the various subclasses
of otTables.ClassDef were merged into one single class. Therefore,
we can now always instantiate otTables.ClassDef() which is simpler.
2016-01-14 11:56:57 +01:00
Sascha Brawer
bf29ec9555 [otlLib] Move the building of Device tables from feaLib to otlLib 2016-01-14 11:48:17 +01:00
Sascha Brawer
78092ba783 [feaLib] Do not set otTables.AlternateSubst.Format 2016-01-14 11:30:46 +01:00
Sascha Brawer
e60b939088 [feaLib] Simplify how coverage tables are built
In f0eb7e98ca0642f17ac82433db8c957fffd6a9d3, the various subclasses
of otTables.Coverage were merged into one single class. Therefore,
we can now always instantiate otTables.Coverage() which is simpler.
2016-01-14 11:17:56 +01:00
Sascha Brawer
1bffd6b872 [feaLib] Do not set LigatureSubst.Format 2016-01-14 11:06:11 +01:00
Cosimo Lupo
3dec54f24a builder_test: move BuilderTest's dynamic method setting out of "__main__" for py.test 2016-01-14 09:43:42 +00:00
Sascha Brawer
6246c71a07 [feaLib] Port to otlLib builder for supported lookups
Make the output of otlLib.buildLigatureSubst() deterministic.
Before this change, otlLib ligatures were emitted in a non-deterministic
sorting order (depending on what hash value Python would give
to a string tuple).
2016-01-14 10:27:54 +01:00
Sascha Brawer
0171515246 [feaLib] Fix for b4919b6c0a5ea0ca6747fe7699554e8a14d1f77f
After b4919b6c0a5ea0ca6747fe7699554e8a14d1f77f, the tests were
named correctly but they always used the exact same feature file,
irrespective of what file they were supposed to test.

Resolves https://github.com/behdad/fonttools/issues/465
2016-01-14 09:22:24 +01:00
Sascha Brawer
b4919b6c0a [feaLib] Check each test feature file in a separate unit test
Resolves https://github.com/behdad/fonttools/issues/465
2016-01-14 08:37:37 +01:00
Behdad Esfahbod
c3cb356e7f [feaLib] Fix for f0eb7e98ca0642f17ac82433db8c957fffd6a9d3
ClassDef1 and ClassDef2 are now same type, so can't differentiate
based on that anymore.
2016-01-13 17:29:42 +00:00
Sascha Brawer
cc749c9c73 [feaLib] Allow 63 chars in names of glyphs and glyph classes
Resolves https://github.com/behdad/fonttools/issues/460.
See https://github.com/adobe-type-tools/afdko/pull/99 for
the change to the OpenType Feature File format specification.
2016-01-13 16:31:05 +01:00
Sascha Brawer
bfc3bff0e3 [feaLib] Support CID glyph names
Resolves https://github.com/behdad/fonttools/issues/459
2016-01-12 10:58:00 +01:00
Sascha Brawer
f2806c4de2 [feaLib] For testing, use dates without leading zeroes
On Windows, some Python versions format "Jan 01" while others
format "Jan  1"; this caused test failures on the build farm.
By using a date without leading zeros (2011-12-13), we can
work around this.

https://github.com/behdad/fonttools/issues/455
2016-01-11 19:36:19 +01:00
Sascha Brawer
67686691c4 [feaLib] Also handle feature aalt without any custom lookups
Before this change, feaLib did not handle feature files that specified
`feature aalt` whose block just was referring to other features without
defining any lookups on its own. After this change, we can handle it.

Resolves https://github.com/behdad/fonttools/issues/441
2016-01-11 18:12:23 +01:00
Sascha Brawer
38f4ee7908 [feaLib] Implement table head with FontRevision statement 2016-01-11 18:01:47 +01:00
Sascha Brawer
2de6fc7744 [feaLib] Imlement special support for feature aalt 2016-01-11 16:00:52 +01:00
Sascha Brawer
03796cf3a4 [feaLib] Use specification example for table GDEF as unit test 2016-01-11 07:18:18 +01:00
Sascha Brawer
5696b50fac [feaLib] Implement the GlyphClassDef statement 2016-01-08 19:06:52 +01:00
Sascha Brawer
c79e005d77 [feaLib] Refactor GDEF building
The code for building GDEF tables had grown quite a bit, so it was
hard to understand what was going on. After this change, each GDEF
subtable gets built by a separate method. This increases legibility.
2016-01-08 17:38:49 +01:00
Sascha Brawer
13d23401f2 [feaLib] Parse GlyphClassDef statements
No output is generated yet; this will come in a later change.
2016-01-08 17:15:04 +01:00
Sascha Brawer
2b2d529404 [feaLib] Fix typo in comment for test case 2016-01-08 11:14:13 +01:00
Sascha Brawer
657a4463f3 [feaLib] Merge multiple LigatureCaret statements for the same glyph
The current OpenType Feature File specification is silent about
what the proper behavior should be when a single glyph has multiple
LigatureCaretByPos or LigatureCaretByIndex statements.  After
this change, we match the behavior of Adobe's `makeotf` tool.

Arguably, `makeotf` might not be optimal in its current behavior,
but it seems better to match the existing toolchain than to have
two conflicting interpretations of an ambiguous spec.  Once the
specification gets clarified, we will of course follow.

See https://github.com/adobe-type-tools/afdko/issues/95 for the
spec discussion.
2016-01-08 11:03:46 +01:00
Sascha Brawer
89ac1b2d0d [feaLib] Implement the Attach statement 2016-01-08 08:32:47 +01:00
Sascha Brawer
f8987125e7 [feaLib] Implement the LigatureCaretByIndex statement 2016-01-07 17:22:31 +01:00
Sascha Brawer
a44d8c5364 [feaLib] Implement the LigatureCaretByPos statement 2016-01-07 16:39:35 +01:00
Sascha Brawer
4daf0601b2 [feaLib] Adjust test case to use example from feature file format spec v1.17
In earlier versions of the OpenType Feature File Format specification,
the example was mal-formed so we had invented our own test case.
Adobe has kindly fixed the format specification:
https://github.com/adobe-type-tools/afdko/issues/88

This change revealed a bug in the parser where mark classes did
not get recognized as glyph classes; this is now fixed, too.
2016-01-07 13:02:21 +01:00
Sascha Brawer
adbf7ec4b1 [feaLib] Treat vkrn, vpal, vhal, valt as vertical features
Resolves https://github.com/behdad/fonttools/issues/449
2016-01-07 12:31:28 +01:00
Sascha Brawer
b7a7577750 [feaLib] Add test case for chaining to another chaining substitution 2016-01-07 12:03:22 +01:00
Sascha Brawer
db49f20d6b [feaLib] Support compact syntax for chaining to alternate substitutions
https://github.com/behdad/fonttools/issues/445

Not sure whether it makes much sense to define a contextual chain
that points to a GSUB type 3, but the OpenType feature file syntax
does not explicitly forbid it.  Adobe's `makeotf` tool rejects this
kind of input with "Contextual alternate rule not yet supported";
this implies that the construct is valid (albeit definitely exotic).
2016-01-07 11:32:54 +01:00
Sascha Brawer
e19d5a8cbe [feaLib] Add an overlooked test case to the suite of unittests
Because the test case had not been executed, there was a typo
in the expected output; this is now fixed.
2016-01-07 10:36:08 +01:00
Sascha Brawer
931bbc50c1 [feaLib] Support compact syntax for chaining to ligature substitutions
https://github.com/behdad/fonttools/issues/445
2016-01-07 10:31:13 +01:00
Sascha Brawer
b19c6b3dec [feaLib] Add test case for chaining GSUB type 6 to GSUB type 1 2016-01-07 09:25:08 +01:00
Sascha Brawer
e2405c9aef [feaLib] Implement explicit lookup references as calls
Before this change, the compiler had (essentially) implemented lookup
references by inlining the statements of the invoked lookup into the
current feature block. After this change, the lookup gets compiled
separately, and any call sites make explicit calls.
2016-01-07 08:57:34 +01:00
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
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
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
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
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