Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5793

Fonts.FindOrCreate fails to find font

$
0
0

Hi @Pascal and @dale,

i am trying to create a TextEntity using the “Arial Black” font. To locate it, i use:

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

Unfortunately the font is never found after Rhino is freshly opened. Only if i run eg. the _TextObject command before, and create something using the Arial Black font, it is then found with my script. If i then open a new file, the font is also found using FindOrCreate. But if i reopen Rhino, the font is not found again.

How to reliably locate the font and use it ? Things i’ve tried allready:

I’ve iterated over System.Drawing.Text.InstalledFontCollection().Families (slow) which lists my required font.Name as “Arial Black”. Unfortunately, this is not the proper Name to use with FindOrCreate, it only can use the font if i put an underscore between the words and do before what i’ve described above.

Do i really need to script the Rhino command as shown here ?

Note: this is R6, i try to find a way to do this reliable in R6 and R7

thank you,
c.

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5793

Trending Articles