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
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
e132741b2c
[feaLib] Parse languagesystem
in the same way as all other statements
...
In the new version, the parse_languagesystem_() function returns
an ast.LanguageSystemStatement, which then gets appended to the
current list of statements by the caller. Before this change,
the parse_languagesystem_() function would always append the
newly parsed statement to the list of top-level statements.
In practice, it does not matter because `languagesystem` is
only valid at the top level, but there is no good reason why
the parser method would have to be different from all other
constructs.
2015-08-11 12:55:09 +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
Sascha Brawer
bc8279bab1
[feaLib] Parse ignore sub
and ignore substitute
statements
2015-08-10 11:17:52 +02:00
Sascha Brawer
482c498943
[feaLib] Improve unit tests for subtitution rules
2015-08-10 11:17:52 +02:00
Sascha Brawer
08d01bb24d
[feaLib] Parse substitution rules for LookupTypes 1 and 3
...
The parsed representation should handle most of other LookupTypes
as well, but the parser cannot recognize them yet.
2015-08-10 11:17:52 +02:00
Sascha Brawer
37fa652fa9
[feaLib] Add unit test for scoping of valueRecordDef statements
2015-08-10 11:17:52 +02:00
Sascha Brawer
402726f02c
[feaLib] Clarify an error message
2015-08-10 11:17:52 +02:00
Sascha Brawer
5270a978a9
[feaLib] Support hexadecimal numbers
...
The OpenType Feature File specification does not specify hex numbers
as explicit token type, but they appear several times in the examples
given by the spec.
2015-08-10 11:17:52 +02:00
Sascha Brawer
c06a377aa3
[feaLib] Implement valueRecordDef statements
2015-08-10 11:17:52 +02:00
Sascha Brawer
4169e584cc
[feaLib] Clarify error message for malformed glyph class references
...
The new message makes clearer what exactly the parser was looking for
when processing a glyph class reference.
2015-08-10 11:17:52 +02:00
Sascha Brawer
bb5a7e7caf
[feaLib] Make symbol tables separate objects
...
For example, named value records follow the same scoping rules
as named glyph classes.
2015-08-10 11:17:52 +02:00
Sascha Brawer
944fab8a5f
[feaLib] Implement parsing of feature blocks
2015-08-10 11:17:52 +02:00
Sascha Brawer
3936e334f1
[feaLib] Resolve references to glyph classes
2015-08-10 11:17:52 +02:00
Sascha Brawer
a0bbd5fab9
[feaLib] Detect duplicate glyph class definitions
2015-08-10 11:17:52 +02:00
Sascha Brawer
d72aac035e
[feaLib] Restrict length of glyph class names to 30 characters
...
This is required by the OpenType Feature File specification,
section 2.g.ii "Named glyph classes".
2015-08-10 11:17:52 +02:00