justvanrossum / drawbot-skia

A cross-platform subset of the DrawBot drawing API, using Skia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fontVariations() does not work correctly on Linux

justvanrossum opened this issue · comments

Possibly due to a bug in skia-python: kyamagu/skia-python/issues/112

Or due to me using the skia-python API wrong.

This test script does not give the expected result on Linux: https://github.com/justvanrossum/drawbot-skia/blob/master/tests/apitests/fontVariations.py

size(275, 400)
rect(0, 0, width(), height())
font("../fonts/MutatorSans.ttf")
fontSize(100)
fill(1)
text("ABCXYZ", (10, 15))
fontVariations(wght=600)
text("ABCXYZ", (10, 115))
variations = fontVariations(wdth=200)
assert {'wdth': 200, 'wght': 600.0} == variations, variations
text("ABCXYZ", (10, 215))
variations = fontVariations(wdth=1000, resetVariations=True)
assert {'wdth': 1000, 'wght': 0.0} == variations, variations
text("ABCXYZ", (10, 315))

This appears to be fixed thanks to recent changes to the TextStyle object: I no longer use the skia API to get at the current VF location, and setting is apparently not a problem.