Adding FeatureVariations to variable fonts ↩
What is FeatureVariations?
FeatureVariations is the none interpolatable variations, A.K.A. Discontinuous variation.
This is about the famous dollar.nostroke vs dollar.withstroke.
Small animation of this thing in action ($), one axis!
In the example the feature is activated if the axis value is greater than someValue. This is a one axis example but there can be as many axis involved as your design requires.
Animation, Example of multi axis. Pan?
Make it work.
- create
rvrnfeature - create lookup
- generate variable OpenType font
- ttx
- fvar
- index axes
- GSUB
- change version number
- index feature
rvrn& lookup - add
FeatureVariationstable with correct indexes
- fvar
- recompile
Create rvrn feature
The registered feature tag for this is rvrn. In this feature substitute the activated glyphs by the default glyphs. In the example of the dollar:
feature rvrn {
sub dollar.nostroke by dollar.withstroke;
} rvrn;
Create the lookup
Also make a lookup where the substitutions is reversed. Make up a name for it:
lookup DollarNoStrokeActive {
sub dollar.withstroke by dollar.nostroke;
} DollarNoStrokeActive;
Generate the variable font
Generate the variable font. The FeatureVariations are not working yet.
TTX
With TTX you can access the font tables (decompile), edit them and recompile the font.
- Open Terminal
- Navigate to the directory of your variable font.
ttx -t GSUB -t fvar <path-of-your-otvar.ttf>This generates a ttx file with only theGSUBandfvartables, these are the only ones we need. Open the ttx file in your favourite code editor.- Change the GSUB version number 0x00010000 > 0x0001000
1 -
Look for the index number of
rvrnfeature. And for the index number of the lookup.… <FeatureList> … <FeatureRecord index="6"> <FeatureTag value="rvrn"/> … <LookupList> <Lookup index="8"> <LookupType value="1"/> <LookupFlag value="0"/> <!-- SubTableCount=1 --> <SingleSubst index="0" Format="2"> <Substitution in="dollar.withstroke" out="dollar.nostroke"/> … … - add FeatureVariations block
- with indexes …
-
recompile
<fvar> <!-- Weight --> <Axis> <AxisTag>wght</AxisTag> <Flags>0x0</Flags> <MinValue>0.0</MinValue> <DefaultValue>20.0</DefaultValue> <MaxValue>30.0</MaxValue> <AxisNameID>256</AxisNameID> </Axis> <!-- Angle --> <Axis> <AxisTag>ANGL</AxisTag> <Flags>0x0</Flags> <MinValue>0.0</MinValue> <DefaultValue>180.0</DefaultValue> <MaxValue>360.0</MaxValue> <AxisNameID>257</AxisNameID> </Axis> <!-- Steps --> <Axis> <AxisTag>STEP</AxisTag> <Flags>0x0</Flags> <MinValue>10.0</MinValue> <DefaultValue>20.0</DefaultValue> <MaxValue>60.0</MaxValue> <AxisNameID>258</AxisNameID> </Axis> <!-- Style_1 --> <NamedInstance flags="0x0" subfamilyNameID="259"> <coord axis="wght" value="20.0"/> <coord axis="ANGL" value="180.0"/> <coord axis="STEP" value="20.0"/> </NamedInstance> </fvar>