microsoft / DWriteShapePy

Python extension for streamlined DirectWrite text shaping.
MIT License
13 stars 7 forks source link

Add a dw-shape CLI utility #1

Closed simoncozens closed 3 years ago

simoncozens commented 3 years ago

This adds a rudimentary command line utility for shaping testing called dw-shape, patterned after hb-shape.

It seems to work, except in the case of variation support. I don't know why this is; whether something on my end, or something within DWriteShapePy:

simon@DESKTOP-1I8LMGB MINGW64 ~/DWriteShapePy (main)
$ python3 dw-shape.py --variations="wdth=100" /c/Windows/Fonts/bahnschrift.ttf abc
[gid130=0+1090|gid142=1+1114|gid144=2+1020]

simon@DESKTOP-1I8LMGB MINGW64 ~/DWriteShapePy (main)
$ python3 dw-shape.py --variations="wdth=75" /c/Windows/Fonts/bahnschrift.ttf abc
[gid130=0+1090|gid142=1+1114|gid144=2+1020]

This is annoying, because variation support was the actual thing I wanted to test. :-)

ghost commented 3 years ago

CLA assistant check
All CLA requirements met.

simoncozens commented 3 years ago

It seems to work, except in the case of variation support.

Now that I've got it compiled, hb-shape --shaper=directwrite has the same failure mode here. So maybe this is just a DirectWrite thing, not a DWriteShapePy issue.

simon@DESKTOP-1I8LMGB MINGW64 /c/bin
$ ./hb-shape.exe /c/Windows/Fonts/bahnschrift.ttf 'abc' --variations="wdth=75" --shaper=ot
[gid130=0+835|gid142=1+824|gid144=2+772]

simon@DESKTOP-1I8LMGB MINGW64 /c/bin
$ ./hb-shape.exe /c/Windows/Fonts/bahnschrift.ttf 'abc' --variations="wdth=75" --shaper=directwrite
[gid130=0+1090|gid142=1+1114|gid144=2+1020]
simoncozens commented 3 years ago

Thanks, Paul - any thoughts on why variation support isn't working?

simoncozens commented 3 years ago

Ah, I think I can answer my own question: "In the Windows 10 Creators Update, DirectWrite does not support arbitrary instances that utilize the continuous-variation capability of variable fonts." No, that information is out date. I still don't know why the variation support doesn't work.