SUFontCreate functionality missing?

I am attempting to use the SUText— C API functions in the SDK_WIN_x64_2020-0-363 for Sketchup.
In doing this I get a Validity Check issue, apparently because the font is missing?

However, for the life of me I cannot find a way to create or select a font?
The SUFont— functions only contain getters as far as I can see?

Clues, anyone?

SUModelGetNumFonts (SUModelRef model, size_t* count)

SUModelGetFonts (SUModelRef model, size_t len, SUFontRef fonts[], size_t* count)

SUDimensionGetFont (SUDimensionRef dimension, SUFontRef *font)

SUDimensionSetFont (SUDimensionRef dimension, SUFontRef font)

SUTextGetFont (SUTextRef text, SUFontRef *font)

SUTextSetFont (SUTextRef text, SUFontRef font)

However, SUFontCreate() and SUModelAddFont() functions have not yet been implemented.

So the workaround perhaps might be to create an empty model template with an unused component definition with text objects using the fonts you want to use.


and I just logged the following

Ah… SUModelGetNumFonts / SUModelGetFonts… I never thought of looking at the model level.
Really stupid of me!!!
It appears to me that the C SDK model by default has two fonts built in: Arial and Tahoma.
So fetching one of the model fonts, and using that for SUText— purposes should work, of course, which I just now have successfully tested!!
Thanks again, Dan.
And your suggestion to use an otherwise empty model template is clever as well!

At least on Windows it’s an application (or the program) that usually loads fonts as a resource and must release them when it closes. So that’s the first place I looked, but the C API has like 3 functions that belong to the application because it’s not yet “live certified.”

Anyway, it makes sense that the model database would have a collection of fonts (or fontface names) that would need to be loaded to support entities using text. So I looked there.

I know how to load font resources using the Windows SDK. (I’ve done it in the past to tweak SketchUp’s Ruby Console to use a different font.) But I’m not sure how one would cast them to a SUFontRef.

We used to do this prior to v2014 when layer#color= was implemented to add a set of specially colored layers.

There is also the trick of adding a component file that has nothing but cpoints on preset layers (named and colored a certain way.) The component trick was also used prior to the dimension classes being exposed to the API. (A unit length dimension component was inserted then positioned and scaled. Quite the hack.)

So we’ve had to use such “hacks” before.