156 Commits

Author SHA1 Message Date
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
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
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
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
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
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
7e846691e4 [feaLib] Consistently name LookupBuilders after their OpenType subtable class 2015-12-09 12:59:20 +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
790ea83a02 [feaLib] Parse GPOS type 4 aka Mark-to-Base Attachment Positioning
However, no output tables are being built yet. This change is just
implementing the feature file parser.
2015-12-08 19:04:42 +01:00
Sascha Brawer
dfa1551ece [feaLib] Implement markClass statement 2015-12-08 17:04:21 +01:00
Sascha Brawer
c6ee46f299 [feaLib] Implement GPOS type 3: Cursive Attachment Positioning 2015-12-07 23:56:08 +01:00
Sascha Brawer
6240593839 [feaLib] Parse anchors in format A, B, C, D, and E 2015-12-07 22:48:10 +01:00
Sascha Brawer
46983f573f [feaLib] Parse GPOS type 2 format A and B, and ValueRecord format D
This is just the change on the parser. Building the output tables
is still marked as a TODO.
2015-12-07 17:18:18 +01:00
Sascha Brawer
5644da31d2 [feaLib] Parse device tables 2015-12-04 17:10:20 +01:00
Sascha Brawer
46c76dbf1f [feaLib] Parse ValueRecord format C
However, not sure how to build the otTables object graph for emitting
GPOS tables with device values; the current code thus silently strips
off any device values. Left a TODO comment for implementing this.
2015-12-04 15:49:04 +01:00
Sascha Brawer
b99f1c9af4 [feaLib] Implement GPOS type 1, Single Adjustment Positioning 2015-12-04 12:22:01 +01:00
Sascha Brawer
cab0067c7e [feaLib] Implement GSUB LookupType 8: Reverse chaining single substitutions 2015-12-03 13:05:42 +01:00
Sascha Brawer
152dff4361 [feaLib] Implement GSUB chain substitution rules 2015-11-30 15:02:09 +01:00
Sascha Brawer
75e4053e39 [feaLib] Handle references to named lookup blocks 2015-09-28 16:49:17 +02:00
Sascha Brawer
17ab15c4af [feaLib] Implement GSUB lookup type 2 2015-09-10 15:28:02 +02:00
Sascha Brawer
a35291e8c1 [feaLib] Implement required qualifier on language statements 2015-09-08 15:55:54 +02:00
Sascha Brawer
792a958d6c [feaLib] Implement parser for multiple substitutions (GSUB LookupType 2)
Actually building the GSUB table is not implemented yet, since this
will probably need changes to otTables.
2015-09-08 12:05:44 +02:00
Sascha Brawer
b0bbce88b1 [feaLib] Implement Single Substitution (GSUB lookup type 1) 2015-09-08 10:33:07 +02:00
Sascha Brawer
6140a4ec2b [feaLib] Build ScriptList subtable
Also, fixed a bug that caused language tags to be sometimes stripped.
Added an assertion to verify that language tags are always 4 chars.
2015-09-07 21:34:10 +02:00
Sascha Brawer
80de401c09 [feaLib] Implement ligature substitutions 2015-09-07 16:10:13 +02:00
Sascha Brawer
8e8a0d68c7 [feaLib] Prohibit script and language statements within named lookups 2015-09-07 13:33:44 +02:00
Sascha Brawer
5f2e55d5fc [feaLib] Emit lookups for alternate substitutions 2015-09-07 11:39:09 +02:00
Sascha Brawer
102c0e0e56 [feaLib] Handle languagesystem, script and languaguage statements
Currently, the compiler uses them to figure out which set of
languagesystems would apply for the current scope. However, this
information is not yet used for anything.
2015-09-07 11:39:09 +02:00
Sascha Brawer
4f27ce3585 [feaLib] Ensure that "languagesystem DFLT dflt;" comes first
According the to the OpenType Feature File specification,
"languagesystem DFLT dflt;" must be the first languagesystem
statement in a file.
2015-09-07 11:39:09 +02:00
Sascha Brawer
df740092d9 [feaLib] Basic test framework for building OpenType features 2015-09-07 11:39:09 +02:00
Sascha Brawer
72c1f165b4 [feaLib] Parse substitute from statements 2015-08-11 15:54:54 +02:00
Sascha Brawer
8b77f68dec [feaLib] Parse feature blocks with useExtension keyword 2015-08-11 15:28:59 +02:00
Sascha Brawer
f60d49471d [feaLib] Parse subtable statements 2015-08-11 15:14:47 +02:00
Sascha Brawer
abb9edacc9 [feaLib] Parse anchorDef statements 2015-08-11 12:53:30 +02:00
Sascha Brawer
00714511f0 [feaLib] Parse chained contextual substitution rules 2015-08-11 12:22:07 +02:00
Sascha Brawer
c165a1e019 [feaLib] Parse lookup blocks and references 2015-08-11 10:59:26 +02:00
Sascha Brawer
6d7540ecac [feaLib] Move block parsing to a separate method
We will soon support additional blocks beyond `feature`,
and keeping this refactoring separate from new functionality
makes it easier for code reviewers to follow the changes.
2015-08-11 10:19:39 +02:00
Sascha Brawer
1f2fadc864 [feaLib] Parse language statements 2015-08-10 16:30:10 +02:00
Sascha Brawer
4ab6e6b169 [feaLib] Parse script statement 2015-08-10 11:30:47 +02:00
Sascha Brawer
4bcdc60ca8 [feaLib] Remove write() methods
For now, it looks like we won't need them for anything; removing this
code makes the codebase a little bit less complicated.
2015-08-10 11:24:24 +02:00