drawbot
drawbot copied to clipboard
Feature variations do not work in multistyle Formatted String
I’m having some trouble where feature variations (in the opentype rvrn feature) are not applied when used in a multi-style formatted string.
I’ve included some code below to demonstrate the problem with Service Gothic’s $, but I’ve tested it in multiple fonts so I’m guessing you’ll be able to replicate this with the feature variation of your choice.
You can see that the bar of the dollar sign should be cut out in the Bold, but when it is appended to the Formatted String, the cut out doesn’t happen. The result doesn’t change if openTypeFeatures=dict(rvrn=True) is applied.
I am running Drawbot Version 3.126 on MacOS Catalina 10.15.7. I’ve also seen instances where this error seems to create bugs in letterspacing if the first variant is wider than the second... If helpful, l’m happy to email a font of mine where that happens.
As always, many thanks!
Screenshot showing my results of demo code:

Demo code:
fontPath = 'Service_Gothic_v0.1_Variable.ttf'
textString = '$$$\n'
# using a formatted string, and appending the new style
# it doesn’t work
newPage()
fs = FormattedString(textString, fontSize=250, font=fontPath, fontVariations=dict(wght=400))
fs.append('$$$', fontVariations=dict(wght=700), openTypeFeatures=dict(rvrn=True))
textBox(fs, (0, 0, width(), height()))
# using a formatted string, and appending the new style
# it works
newPage()
fs = FormattedString(textString*2, fontSize=250, font=fontPath, fontVariations=dict(wght=700))
textBox(fs, (0, 0, width(), height()))
# this page has multiple styles but does not use formatted string
newPage()
font(fontPath, 250)
fontVariations(wght=400)
textBox(textString, (0, 0, width(), height()))
fontVariations(wght=700)
textBox(textString, (0, 0, width(), height()-300))
Demo code showing spacing issue:
fs = FormattedString(
font='Job Clarendon Variable',
fontSize=400,
)
fs.append('iinii\n', fontVariations=dict(wght=900))
fs.append('iinii\n', fontVariations=dict(wght=400))
textBox(fs, (0, 0, width(), height()))
I would love to test this with the actual font, if possible.
There have been some (yet unreleased) changes to how fonts from paths are loaded, which may or may not influence this behavior (#421).
Emailed!
Thanks! Bug confirmed with latest dev version of DB, on 10.15.7.
It could be an OS bug.
Oh I think you might be right @justvanrossum, see what happens when I try to apply multiple styles in TextEdit, at least here on Catalina...
https://user-images.githubusercontent.com/6578861/112884855-ff27dd80-909d-11eb-8806-611377b5faba.mov
Urgh :(
Btw the problem is reproducible with MutatorSans as well, with its barred/unbarred cap I.
size(900, 250)
fontPath = 'MutatorSans-VF.ttf'
fs = FormattedString()
fs.fontSize(200)
fs.font(fontPath)
fs.fontVariations(wdth=380)
fs.fontVariations()
fs.append('III')
fs.fontVariations(wdth=70)
fs.fontVariations()
fs.append('III')
text(fs, (50, 50))
Font: https://github.com/LettError/mutatorSans/blob/master/MutatorSans-VF.ttf
If anyone can test this on Big Sur, that would be fantastic!
your MutatorSans example on macOS10.13:

this is as it should be.
Oh wow, things actually got worse...
I'm so tired of Apple VF/rvrn bugs.
on macOS 10.16 aka macOS11
those are serious bugs in CoreText...
also see https://github.com/typemytype/drawbot/issues/332 (which worked perfectly on 10.13 but not newer OSs)
Nuts.
Confirming this behavior on macOS 11.3 Beta (20E5217a) which is the latest version available (AFAIK)
