@clement / @dale can you elaborate on this solution. Not finding clear resources to resolve this issue in V5. Thx in advance.
in my solution i used below script, replace Arial
with the font name in question. It worked for me in Rhino 5 SR12 using a *.otf font which had one space character in the fontname. I used the identical font name as it appeared in the _TextObject
dialog:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DoSomething():
te = Rhino.Geometry.TextEntity()
te.Plane = Rhino.Geometry.Plane.WorldXY
te.Text = "Hello World"
te.TextHeight = 10.0
te.Justification = Rhino.Geometry.TextJustification.BottomLeft
te.FontIndex = scriptcontext.doc.Fonts.FindOrCreate("Arial", False, False)
scriptcontext.doc.Objects.AddText(te)
scriptcontext.doc.Views.Redraw()
DoSomething()
_
c.
1 Like
@Dale, above does not seem to work with Rhino 6 WIP. It reports:
Message: 'TextEntity' object has no attribute 'FontIndex'
_
c.