482 Commits

Author SHA1 Message Date
Sascha Brawer
c6ee46f299 [feaLib] Implement GPOS type 3: Cursive Attachment Positioning 2015-12-07 23:56:08 +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
b0fda8ec45 [feaLib] Replace invocation of deprecated has_key() by in 2015-12-07 22:49:20 +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
bdc72e1198 [feaLib] Do not emit empty GSUB and GPOS tables
The AFDKO `makeotf` tool does not emit empty tables, either.
2015-12-07 21:38:41 +01:00
Sascha Brawer
3433f363e7 [feaLib] Implement GPOS type 2, format 1 2015-12-07 21:26:58 +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
83dbae1da5 [feaLib] Do not emit any Value if ValueFormat is 0 2015-12-07 11:47:55 +01:00
Sascha Brawer
117683680e [feaLib] Emit SinglePos (GPOS type 1) in format 2 when this is more compact 2015-12-07 11:39:14 +01:00
moyogo
c01b956ae7 [feaLib] make Device Table from device tuples 2015-12-05 08:56:46 +00:00
moyogo
38b335e131 feaLib: misnamed function in builder_test.py 2015-12-04 16:56:58 +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
f45fab8c3a [feaLib] Sort GSUB glyph coverage tables by glyph ID
Before this change, feaLib would sort coverage tables by glyph name,
which is against the OpenType specification.  The current unittests
happen to use only glyphs where the ordering is identical whether
sorting by name or by ID; but I am about to add unittests (for GPOS)
where the ordering is different.

The ordering cannot be enforced by otTables because otTables does
not have access to the font's glyph order; therefore, the sorting
needs to happen inside feaLib.
2015-12-04 11:11:17 +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
37a79a330c [feaLib] Fix generated LigatureSubst lookups 2015-10-27 22:53:50 +01:00
Sascha Brawer
3f5e2ae820 [feaLib] Add expected output for chain substitution rules
Generated by running example 1 from the Feature File specification
section 5.f.i (Specifying a Chain Sub rule and marking sub-runs)
through AFDKO's makeotf tool, and then decompiling the resulting
GSUB table with ttx.

The actual test is commented out because the current version of feaLib
is not able to produce this output yet; marked with a TODO comment.
2015-10-27 20:36:56 +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
75e4053e39 [feaLib] Handle references to named lookup blocks 2015-09-28 16:49:17 +02:00
Sascha Brawer
459eabf2e4 [feaLib] Allow +*:~^! in glyph names but not in glyph class names
Matches the behavior of Adobe's `makeotf` tool v2.0.84 of 2015-09-03.
Resolves https://github.com/behdad/fonttools/issues/370.
2015-09-14 10:53:37 +02:00
Sascha Brawer
17ab15c4af [feaLib] Implement GSUB lookup type 2 2015-09-10 15:28:02 +02: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
Cosimo Lupo
d89bcd422d [feaLib] adjust test data to changes in builder.LookupBuilder
'LookupList' elements now contains 'Lookup' elements, in turn containing one or more lookup subtables
2015-09-09 18:21:33 +01:00
Cosimo Lupo
efea2c17de [feaLib] make LookupBuilder.build return Lookup instances, instead of raw subtables
The list of subtables should go in the 'SubTable' attribute of Lookup object.
This also sets the 'LookupType', 'LookupFlag' and 'SubTableCount' attributes.
2015-09-09 18:13:28 +01:00
Sascha Brawer
4846f9006f [feaLib] Use fontTools wrapper class for otTable's GSUB/GPOS tables
Resolves df740092d9 (commitcomment-13138084)
2015-09-09 17:00:27 +02:00
Sascha Brawer
a35291e8c1 [feaLib] Implement required qualifier on language statements 2015-09-08 15:55:54 +02:00
Sascha Brawer
a3783e1095 [feaLib] Reject language and script within feature aalt and size 2015-09-08 12:18:03 +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
683a8f5dbc [feaLib] Reject duplicate languagesystem declarations 2015-09-08 10:56:07 +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
c1ba66c2ea [feaLib] Write LangSysRecords to GSUB and GPOS tables 2015-09-07 22:03:50 +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
d3c743bb27 [feaLib] Build feature tables 2015-09-07 17:22:37 +02:00
Sascha Brawer
2537a4da29 [feaLib] Enforce uniform lookup types inside named lookup blocks 2015-09-07 16:27:12 +02:00
Sascha Brawer
0963673d58 [feaLib] Rename a test case, for consistency with other test cases 2015-09-07 16:13:34 +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
701c72116d [feaLib] Make feaLib compliant with the PEP8 style guide
After this change, pep8 v1.6.2 reports no style guide violations.
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
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