Add fontVariation to text drawn in bezierPath?



  • This is kind of a follow-up question to another forumpost of mine.

    I have a bezierPath where I draw a letter. After that I scale this shape to a certain size. I just can't find a way to draw the letter with using fontVariations.
    (I know how to use fontVariations when I just draw text outside of a bezierPath. So the font is working.)

    Any ideas on how I can do this?



  • I tried this (B is the bezierPath).
    This doesn't work:

    fontVariations(wdth = self.vw)
    self.B.text("E", (0, 0), fontSize=100, font='Variabletest-Thin')
    

    Is there another syntax I should be using? I don't get any errors btw.



  • hi. you can use a FormattedString:

    txt = FormattedString()
    txt.append("hello world", font='Skia', fontSize=150, fontVariations=dict(wdth=0.8, wght=1.3))
    
    B = BezierPath()
    B.text(txt, (100, 100))
    
    drawPath(B)
    

  • admin

    thanks @gferreira!
    use a FormattedString with BezierPath.text to convert to hard outlines.


Log in to reply
 

Looks like your connection to DrawBot Forum was lost, please wait while we try to reconnect.