Remove overlap on variable font
-
Hello, first time posting, as I am only just starting out with DrawBot, so forgive me please if this question is easily answered. So far, I have been unable to find out how to solve this.
I am using a variable font and want to use draw it with a stroke and no fill, which works fine. As it is a variable font, the paths are of course overlapping. Is there a way to remove this overlap visually in DrawBot? Thanks!
-
You can convert it to a bezier path and apply remove overlap, but I guess its much easier to draw it twice: once with a stroke and the second time with only a fill with the same color as the background.
-
Hi, thanks a lot for the suggestion. Sadly, for my specific idea, the latter won't work, as I want to overlay multiple outlines of letters. I will try the first option. Thank you!
-
Sorry, I don't seem to be able to find out how to convert a text object to a bezier path. Could you tell me, please? I would be very much obliged! Thank you!
-
good luck! it will be slow to apply remove overlap to a lot of text
# create a fromatted string t = FormattedString() # set a font t.font("Skia") # set a font size t.fontSize(100) # set colors t.fill(None) t.stroke(0) # print out all variation settings for the current font print(t.listFontVariations()) # set some variation settings t.fontVariations(wght=2.34) # add text t += "Hello" # draw the fromatted string into a text box textBox(t, (10, 10, 300, 250)) # create a bezierPath path = BezierPath() # draw the formatted string into the bezier path # this will now be a path instead of text and a font path.textBox(t, (10, 10, 300, 250)) # apply remove overlap path.removeOverlap() # set color stroke(0) fill(None) # move the page a bit translate(300, 0) # draw the path drawPath(path)
-
Thank you very much! Since I have you here already, instead of opening a new thread, is there a way to clear a single character from a string? so far, I have only been able to utilise
txt = FormattedString("Hello") txt.append(" World")
But not, for instance,
txt.clear(" World").
in order to remove specific characters (by index, preferably). Is there some way of achieving this? Thank you!
-
you can slice a formattedString and keep the formatting:
txt = FormattedString() txt += "hello World" sub = txt[0:5] print(sub)