253 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
654c086574 [feaLib] Do not use glyph class 0 when building ClassDef2 tables
See https://github.com/adobe-type-tools/afdko/issues/90 for context.
2015-12-23 15:14:00 +01:00
Sascha Brawer
6254974112 [feaLib] Support GPOS type 2, format 2: Class-based kerning tables 2015-12-23 11:35:49 +01:00
Sascha Brawer
26c02e4d95 [feaLib] Add helper for creating glyph class definition tables
The helper will be used for building class-based kerning tables.
2015-12-22 14:42:13 +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
0dd370760e [feaLib] Clean up the handling of markClass statements 2015-12-12 12:55:21 +01:00
Sascha Brawer
ac86de36fb [feaLib] Implement the lookupflag statement 2015-12-10 19:17:11 +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
c2c033d3cf [feaLib] Implement GPOS type 6: Mark-to-mark attachment positioning 2015-12-09 17:56:47 +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
5b1b1d17f6 [feaLib] Restructure MarkBasePosBuilder in preparation of MarkLigPosBuilder
The upcoming MarkLigPosBuilder will have some parts in common with
MarkBasePosBuilder. Move these common parts into a helper method,
so that MarkLigPosBuilder will be able to call them.

Also, clean up the structure of MarkBasePosBuilder.
2015-12-09 13:23:50 +01:00
Sascha Brawer
7e846691e4 [feaLib] Consistently name LookupBuilders after their OpenType subtable class 2015-12-09 12:59:20 +01:00
Sascha Brawer
652bbeb51b [feaLib] Centralize how lookups are built from subtables 2015-12-09 12:51:01 +01:00
Sascha Brawer
320a4a57c6 [feaLib] Centralize the building of coverage tables 2015-12-09 12:30:57 +01:00
Sascha Brawer
0fbbe037bf [feaLib] Implement GPOS type 4: Mark-to-Base Attachment Positioning 2015-12-08 22:28:02 +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
b0fda8ec45 [feaLib] Replace invocation of deprecated has_key() by in 2015-12-07 22:49:20 +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
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
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
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
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
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