Hello, I just faced a bug because the font provided to the Curve.CreateTextOutlines method was not installed and Rhino silently used another font.
static Curve CreateTextOutlines(
I fixed my bug, but please document this behaviour or throw an exception instead of simply using another font.
Can you provide some sample code or a sample file where font substitution is occurring?
“Source Code Pro” is a font that I had to install from the internet, it was not preinstalled. The user did not have source code pro installed and rhino/grasshopper simply used another font instead.
You can see the component actually used a different font, especially for the character “t” once “Source code prooooooo” (or another non existing font) is used as input.
demonstrator_font.gh (7.6 KB)
The script produces this on my system, since I don’t have your font:
Rhino tries really hard to find the the font you specify. If not found, it tries really hard to return a font that is close, property wise, to what you specified.
There is no way to override this behavior.
If you won’t want to create outlines curves if the font does not exist, you’ll need to verify the font’s existence on your own. A Google search should provide sample code on how to check to see if a font is installed.
Yes, I already fixed my bug by checking if the font is already installed, as mentioned in my first message.
I want this behaviour to be documented in the documentation of the function - I assumed that it would raise an exception.