69 Commits

Author SHA1 Message Date
James Godfrey-Kittle
34115b2f3f [feaLib] Add unit test for empty statement parsing 2016-01-21 13:32:58 -08: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
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
5696b50fac [feaLib] Implement the GlyphClassDef statement 2016-01-08 19:06:52 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
2391a11fc8 [feaLib] Test that the parser rejects enum pos cursive constructs 2015-12-07 22:53:38 +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
moyogo
c01b956ae7 [feaLib] make Device Table from device tuples 2015-12-05 08:56:46 +00: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
dbefc71d23 [feaLib] Minor: Rename a test file, for consistency with other test caes
It is example 1 in section 5.f.i of the specification, and there
more examples in the same section. For consistency, use the same convention
as the other test cases.
2015-10-27 19:59:25 +01: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
86004df3b0 [feaLib] Reject script dflt and language DFLT
These are invalid casing variants of the frequently used
`script DFLT` and `language dflt`. Adobe's makeotf tool
does a similar check.
2015-09-08 09:26:24 +02:00
Sascha Brawer
20392fb491 [feaLib] Fix test failures caused by an earlier bug fix
An earlier change made sure that language tags would always be
four characters in length, even when ending in whitespace.
This made a few test cases in parser_test.py fail. By accident,
I had only run builder_test (instead of all unittest in fonttools)
before committing that change.
2015-09-07 22:05:10 +02:00
Sascha Brawer
80de401c09 [feaLib] Implement ligature substitutions 2015-09-07 16:10:13 +02:00
Sascha Brawer
b54c04f1d4 [feaLib] Enforce language "dflt" for script "DFLT"
Also add ';' to some langaugesystem test cases. This makes the
snippets syntactically valid. The parser is still expected to
reject them for other reasons, just as before this change.
2015-09-07 11:39:09 +02:00
Sascha Brawer
9ddd313577 [feaLib] Merged LexerError and ParserError
This simplifies the public API to the library.  For clients, it does
not matter which exact component was detecting an error.  And we will
soon have more components; there would be little point in declaring
CompilerError, TableBuilderError, and so forth.
2015-09-07 11:39:09 +02:00
Sascha Brawer
fb050c7a7f [feaLib] Parse rules for multiple substitution (GSUB LookupType 2) 2015-08-11 16:45:54 +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