I'm trying to find a variable font debugging tool for Windows that uses the DWrite shaper, because I want to answer a question about how it processes feature variations. Not finding one, I tried writing my own, first with
DWriteShapePy and then with Harfbuzz. But neither of these seem to get DirectWrite to process feature variations at all.
For example, with Bahnscrift I would expect the dollar sign to be gid 696 for wght<=319 and gid 730 for wght >= 320. With the Harfbuzz OT shaper, that's what I see:
simon@DESKTOP-1I8LMGB MINGW64 ~/DWriteShapePy (main)
$ /c/bin/hb-shape.exe /c/Windows/Fonts/bahnschrift.ttf 'A$' --variations=wght=319 --shaper=ot
[gid2=0+1246|gid696=1+1181]
simon@DESKTOP-1I8LMGB MINGW64 ~/DWriteShapePy (main)
$ /c/bin/hb-shape.exe /c/Windows/Fonts/bahnschrift.ttf 'A$' --variations=wght=320 --shaper=ot
[gid2=0+1246|gid730=1+1181]
But with the DWrite shaper, the substitution is not made. (DWriteShapePy gives same result.)
simon@DESKTOP-1I8LMGB MINGW64 ~/DWriteShapePy (main)
$ /c/bin/hb-shape.exe /c/Windows/Fonts/bahnschrift.ttf 'A$' --variations=wght=319 --shaper=directwrite
[gid2=0+1246|gid730=1+1181]
simon@DESKTOP-1I8LMGB MINGW64 ~/DWriteShapePy (main)
$ /c/bin/hb-shape.exe /c/Windows/Fonts/bahnschrift.ttf 'A$' --variations=wght=320 --shaper=directwrite
[gid2=0+1246|gid730=1+1181]
So:
- Is there a good tool for testing variable fonts on the DirectWrite shaper?
- Why are feature variations not being processed correctly in DirectWrite?
Comments
Regarding Bahnschrift, the correct substitution for the $ is performed by DWrite. This can be verified as follows:
That's a fair way to think of 'rvrn'.
Certainly not. In particular, for instance, if you had a discretionary feature like 'swsh' and the substitutions needed to be different for certain portions of the design space, you'd simply use a feature variation for the 'swsh' feature table.