_-TextObject Font name does not exist

Hi everyone,

I want to create a TextObject with an installed font (Chez Vous). I have installed the font in Windows.
In Rhino command if I use TextObject I am able to select “Chez Vous” from the font dropdown and create a textobject with it. However when I use _-TextObjext _F “Chez Vous” … I get the error “Font name does not exist”. What am I missing?

Any help would be much appreciated
Alex

Hi Alex,

Enclose your font name with chr(34):

import rhinoscriptsyntax as rs

fontName = chr(34)+"Chez Vous"+chr(34)
text = "someText"
textHeight = 10
Italic = "No"
Bold = "Yes"
point = rs.GetPoint("pick up the text object point")

commandString = "_-TextObject FontName=%s Height=%s Italic=%s Bold=%s %s %s" % (fontName, textHeight, Italic, Bold, text, point)
rs.Command(commandString)

Also rhinoscriptsyntax has its own function for adding TextObjects.

Hi djordje,

Thank you for your quick reply.
Unfortunately when I run your script I still get the error that the font name can not be found.
As for the function for adding textobject within rhinoscriptsyntax, I am trying to make a 3D textobject (with option output=solid). Unfortunately the method you referred to does not support this.

I think the actual font filename does not have a space, it’s ChezVous…

http://www.dafont.com/chez-vous.font

Check your font folder to see what its Windows name is…

And a link to a post where I set up _TextObject in a Python script

–Mitch

Hi Helvetosaur,

Thank you for your reply.
I have tried many names (Font name, Filename, Window font name):
“Chez Vous”
“ChezVous”
“Chez Vous Regular”
“ChezVousRegular”
“ChezVous-Regular”

unfortunately none of these worked

Can you send me the font via PM so I can test? I promise not to distribute it further… --Mitch

Hi Alex,

I do not have your font installed but the upper method should work. Always enclose your font names with chr(34) if they are consisted of 1> words (have an empty “space” between the words).
As Mitch pointed out, something is wrong with your font name.

The following is what I’m using to test:

import rhinoscriptsyntax as rs

def CreateTextObjsAsSolids():
    text_string=rs.GetString("Text to insert?")
    if not text_string: return
    pt=rs.GetPoint("Text insert point?")
    if not pt: return
    ht=rs.GetReal("Text height?",minimum=0)
    if not ht: return
    thk=rs.GetReal("Solid thickness?",minimum=0)
    if not thk: return
    
    opts='_GroupOutput=_Yes _FontName="Your Font Name" _Italic=_No _Bold=_No '
    opts+='_Height={} _Output=_Solids _Thickness={} '.format(ht,thk)
    opts+='_LowerCaseAsSmallCaps=_No _AddSpacing=_No '
    
    rs.EnableRedraw(False)
    rs.Command('_-TextObject '+opts+'"'+text_string+'"'+' '+str(pt),True)
CreateTextObjsAsSolids()

The font name appears not to be the file name, but rather the name you see in the Fonts folder.

–Mitch

In the fonts folder of windows is the font name “Chez Vous Regular” which I have tried to no avail.

OK, thanks for the font, I have tested everything I can think of and the font just does not want to behave like the others on my system. Funny thing is that you can choose it in the dialog version of the command and it works fine, but not with the command line version.

If you choose it with the dialog version, the next time you run the dash version the font name shows up simply as “Chez Vous”. However, inputting the same name (in quotes) into the dash version it says “Font doesn’t exist”… Bizarre. :confounded:

–Mitch

Bizarre isn’t it. Well thanks a lot for your time and effort. I will be writing a mail to McNeel support, hopefully they will be able to solve the problem

Hi Alex, Mitch -

http://mcneel.myjetbrains.com/youtrack/issue/RH-30360

thanks,

-Pascal

Hi Pascal,

Thats great that this was fixed so fast. I see that the release target is 5.11, 6.0. When will this be available?
Not quite sure how to compare this with current Rhino Version “Version 5 SR11 64-bit
(5.11.50226.17195, 26-2-2015)”

Kind regards
Alex

That info may be erroneous, the body of the report states that it is fixed for 6.0 only… Can’t be fixed for 5.11, as that is already released.

–Mitch

Thanks for your reply,
I interpreted more as the 6th minor update/release for version 5.11.
But then I guess I will need to wait for version 6. Any indication when this will be released?

Alex

Not soon… sorry. I don’t know if there will be a V5 SR12, it seems unlikely at this point. --Mitch

In all likelihood, there will be an SR12…

@dale, can you confirm above problem has been fixed in SR12 ? We’re facing the exact problem using an *.otf font and need to find a solution for all platforms, RH5, RH6 and Mac.

If not, is there a way to reference the font file using a path or use a font from a private font collection in a TextObject. A C# solution would help as well.

_
c.

@clement,

The YouTrack item, referenced by Pascal, says the issue was fixed in the Rhino WIP.

– Dale

@dale, thanks.

I found a way for V5 using Rhino.Geometry.TextEntity() and python.

To locate the font i used:

te.FontIndex = scriptcontext.doc.Fonts.FindOrCreate("the_font_name", False, False)

_
c.