@readroberts @brawer etc.,
Do we have any plan in place to extend the FEA syntax to support OpenType Variation fonts?
This would be a major change of course. Correct me if I'm wrong, there are two major aspects to be revised:
FeatureVariations table
fontTools already supports FeatureVariations so using .ttx syntax, one could build an rvrn feature. But how would be express this in .fea syntax?
ValueRecord variations.
Before 2001, AFDKO did support CFF-based Multiple Master OpenType fonts, so there must have been some syntax to support "per-master metrics data" for metrics, kerning etc. Also, the FEA syntax has some provisions for device-specific adjustments. As we know, GPOS/GDEF/JSTF data in OTVar is inspired by the device adjustments.
General approach
Currently, my understanding is that Google's fontmake uses a method where OT features in each master are compiled using feaLib or AFDKO, and then the fontTools/varLib code is called to add variation data to GPOS.
This generally opens up a legitimate question:
- Do we want to go the fontmake path, where a complete or partial FEA file would be provided per master, and then code would somehow "glue" it together? This would allow for re-using most or all of existing FEA code, and require smaller changes to the building libraries and FEA syntax. Of course this is always possible, i.e. this path can be used without changing the syntax at all.
- Do we want to express the ValueRecord variations in some list, akin to the current device metrics spec in the FEA syntax? This would get a bit ugly and require serious restructuring of the FEA syntax for existing projects.
- Do we want to go yet another path, and that might be adding a set of keywords similar to
languagesystem, script and language but refer to OTVar.
I can think of something like:
In the prolog section of the FEA file, we could have new keywords that could be used to compile the "fvar" table (perhaps), and to "set up" the general rules for how variations work. This would be somehow analogous to how languagesystem works:
varmaster wght 300.0 400.0 700.0;
varmaster wdth 75.0 100.0 120;
languagesystem latn dflt;
languagesystem cyrl dflt;
Then, inside any lookup, there could be some syntax that defines the values for the variation. Roughly, it could look like:
feature kern {
script latn;
language dflt;
lookup kern1 {
# Variation data for the default master
pos A A -50;
# Variation data for the wght -1 wdth -1 master
# Note: this data will need to be calculated against the default data to obtain the deltas
# If the default data does not contain an entry, then the value 0 is assumed in the default data.
var wght -1 wdth -1;
pos A V -300;
pos V A -250;
# Variation data for the wght 1 wdth 1 master
var wght 1 wdth 1;
pos A V -20;
pos V A -15;
} kern1;
script cyrl;
language dflt;
lookup kern1;
} kern;
With an approach like this, users could be flexible in using the include() statements for various masters, i.e. the whole thing could be expressed as:
feature kern {
script latn;
language dflt;
lookup kern1 {
var wght -1 wdth -1;
include(kern_ThinCondensed);
var wght 1 wdth 1;
include(kern_BlackExtended);
} kern1;
script cyrl;
language dflt;
lookup kern1;
} kern;
This way, "old-style" FEA files such as for the Source Sans Pro project: ExtraLight kern.fea and ExtraBold kern.fea could be used.
Note: The syntax I'm proposing is just an "idea".
@readroberts @brawer etc.,
Do we have any plan in place to extend the FEA syntax to support OpenType Variation fonts?
This would be a major change of course. Correct me if I'm wrong, there are two major aspects to be revised:
FeatureVariations table
fontTools already supports FeatureVariations so using
.ttxsyntax, one could build anrvrnfeature. But how would be express this in.feasyntax?ValueRecord variations.
Before 2001, AFDKO did support CFF-based Multiple Master OpenType fonts, so there must have been some syntax to support "per-master metrics data" for metrics, kerning etc. Also, the FEA syntax has some provisions for device-specific adjustments. As we know, GPOS/GDEF/JSTF data in OTVar is inspired by the device adjustments.
General approach
Currently, my understanding is that Google's fontmake uses a method where OT features in each master are compiled using feaLib or AFDKO, and then the fontTools/varLib code is called to add variation data to GPOS.
This generally opens up a legitimate question:
languagesystem,scriptandlanguagebut refer to OTVar.I can think of something like:
In the prolog section of the FEA file, we could have new keywords that could be used to compile the "fvar" table (perhaps), and to "set up" the general rules for how variations work. This would be somehow analogous to how
languagesystemworks:Then, inside any lookup, there could be some syntax that defines the values for the variation. Roughly, it could look like:
With an approach like this, users could be flexible in using the
include()statements for various masters, i.e. the whole thing could be expressed as:This way, "old-style" FEA files such as for the Source Sans Pro project: ExtraLight kern.fea and ExtraBold kern.fea could be used.
Note: The syntax I'm proposing is just an "idea".