typemytype / drawbot

http://www.drawbot.com
Other
408 stars 63 forks source link

Appending a glyph to a FormattedString does not work well when fontVariations are set #402

Open MrBrezina opened 4 years ago

MrBrezina commented 4 years ago
fs = db.FormattedString()
fs.font("Handjet-Regular")
fs.fontSize(350)
fs.fontVariations(wght=300)
fs.appendGlyph("A")
text(fs, (100, 100))

Draws a .notdef glyph from another font (Lucida?). Everything works as expected if I leave out this line fs.fontVariations(wght=300).

In case it is an issue in the Handjet font, let me know, please.

Another related, unexpected behaviour:

I thought I could set up the FormattedString like this:

fs = db.FormattedString("", font="Handjet-Regular", fontSize=350, …)
fs.append("xyz")

But that does not work, neither with append() nor with appendGlyph(). The font and fontSize settings are ignored for the text “xyz“. I would expect them to get carried on.

typemytype commented 3 years ago

also read https://forum.drawbot.com/topic/316/appending-a-glyph-to-a-formattedstring-does-not-work-well-when-fontvariations-are-set

an example with Skia

fs = FormattedString()
fs.font("Skia")
fs.fontSize(350)
fs.fontVariations(wght=0.93)
fs += "A"
fs.appendGlyph("A")
text(fs, (100, 100))

image