Fonts.FindOrCreate (adding a font to font table)

Hi @dale,

in order to draw a TextEntity i would like to use a font which is likely not installed on the users system but included with my plugin installation. The TextEntity is never added to the doc, instead the text is exploded into curves (because it is a single stroke font and RH6 does not allow to use it otherwise).

If i try below code to query if a font is installed:

import scriptcontext

def DoSomething():
    index = scriptcontext.doc.Fonts.FindOrCreate("Arial", False, False)
    font = scriptcontext.doc.Fonts[index]
    print font.EnglishFamilyName

Rhino 6 returns an index > 0 so i asume the font “Arial” is installed. However, if i replace “Arial” eg. with “Nonsense”, it still gives me an index > 0 , and it reports EnglishFamilyName = "Nonsense". Is this intended behavior ? (“Nonsense” is not a valid font name nor has it been installed).

Preferrably, i would like to add a font to my fonttable without having the user to install the font. Is it possible to create a text entity using the font i have the file path to ?


Hi @clement,

Rhino will only use your system’s installed Windows fonts. You will need to install the font before Rhino can use it.

Also, unlike Rhino5, Rhino 6 doesn’t have a font table. The FontTable class, a hold over from Rhino 5, is only a view into the DimStyleTable.

Hope this helps.

– Dale

Hi @dale, thanks. Unfortunately i have no way to install the font as Rhino is already open when my plugin code executes. I’ve found a workaround where i can add my not installed font file to a


and then use it to draw a string in a graphics path using


From the path i can get the points and i’ll try to convert them into lines which i add to the Rhino document…


1 Like