openBrain wrote: ↑Fri Dec 13, 2019 4:07 pm
Also saw that in the commit list. Hope a font file will be accepted and hopefully can be used in ShapeString.
Create first the
Std_TextDocument, add text. Then create the
Draft ShapeString with a default font and text. Then you can set the string from the text document.
Code: Select all
import Draft
obj = App.ActiveDocument.addObject("App::TextDocument", "Text_document")
obj.Text = "Something something"
App.ActiveDocument.recompute()
obj2 = Draft.makeShapeString("Default", "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 10)
obj2.String = obj.Text
App.ActiveDocument.recompute()
Or just provide the text as input for the ShapeString function.
Code: Select all
obj2 = Draft.makeShapeString(obj.Text, "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 10)
App.ActiveDocument.recompute()
The graphical command of
Draft ShapeString, that is, when you click the button, could be updated so that the
task panel allows you to pick a previously created
Std_TextDocument.