127 Commits

Author SHA1 Message Date
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
ab7b86005e [feaLib] Implement the ignore substitution statement
https://github.com/behdad/fonttools/issues/503
2016-02-04 11:39:03 +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
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
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
James Godfrey-Kittle
8fa5073e7e [feaLib] Accept empty statements in parser 2016-01-21 10:32:30 -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
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
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
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
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
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
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
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
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
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
bce961b575 [feaLib] Fix documentation typo
Thanks to @mashabow for noticing it.
701c72116d (commitcomment-13147708)
2015-09-10 07:13:10 +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
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
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