SketchUp C API

- Main Page
- Related Pages
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Related Functions
SUFontRef Struct Reference

A font entity reference. More...

`#include <SketchUpAPI/model/font.h>`

Inherits SUEntityRef.

## Related Functions
(Note that these are not member functions.)
enum SUResult | SUFontGetFaceName (SUFontRef font, SUStringRef *name)
| Retrieves the face name of a font object. More...
enum SUResult | SUFontGetPointSize (SUFontRef font, size_t *size)
| Retrieves a font's point size. More...
enum SUResult | SUFontGetBold (SUFontRef font, bool *is_bold)
| Retrieves a boolean indicating whether the font is bold. More...
enum SUResult | SUFontGetItalic (SUFontRef font, bool *is_italic)
| Retrieves a boolean indicating whether the font is italic. More...
enum SUResult | SUFontGetUseWorldSize (SUFontRef font, bool *use_world_size)
| Retrieves a boolean indicating whether the size of the font is defined as a height in world space. A false value indicates that the font size is defined in points (i.e. in screen space). More...
enum SUResult | SUFontGetWorldSize (SUFontRef font, double *world_size)
| Retrieves the height of the font in inches when the font size is defined as a height in world space. That is, when SUFontGetUseWorldSize() returns true. More...
SUEntityRef | SUFontToEntity (SUFontRef font)
| Converts from an SUFontRef to an SUEntityRef. This is essentially an upcast operation. More...
SUFontRef | SUFontFromEntity (SUEntityRef entity)
| Converts from an SUEntityRef to an SUFontRef. This is essentially a downcast operation so the given entity must be convertible to an SUFontRef. More...
#define | SU_FONT_INFO_VERSION
| Current version of the SUFontInfo struct.
enum SUResult | SUModelAddFont (SUModelRef model_ref, const struct SUFontInfo *font_info, SUFontRef *added_font_ref)
| Returns an object reference to a font object based on font_info. More...
Related Functions inherited from SUEntityRef
enum SURefType | SUEntityGetType (SUEntityRef entity)
| Returns the concrete type of the given entity. More...
enum SUResult | SUEntityGetID (SUEntityRef entity, int32_t *entity_id)
| Retrieves the id of the entity. More...
enum SUResult | SUEntityGetPersistentID (SUEntityRef entity, int64_t *entity_pid)
| Retrieves the persistent id of the entity. More...
enum SUResult | SUEntityGetNumAttributeDictionaries (SUEntityRef entity, size_t *count)
| Retrieves the number of attribute dictionaries of an entity. More...
enum SUResult | SUEntityGetAttributeDictionaries (SUEntityRef entity, size_t len, SUAttributeDictionaryRef dictionaries[], size_t *count)
| Retrieves the attribute dictionaries of an entity. More...
enum SUResult | SUEntityAddAttributeDictionary (SUEntityRef entity, SUAttributeDictionaryRef dictionary)
| Adds the attribute dictionary to an entity. The given dictionary object must not belong to another entity. In other words, each dictionary should be added to one entity only. More...
enum SUResult | SUEntityGetAttributeDictionary (SUEntityRef entity, const char *name, SUAttributeDictionaryRef *dictionary)
| Retrieves the attribute dictionary of an entity that has the given name. More...
enum SUResult | SUEntityGetModel (SUEntityRef entity, SUModelRef *model)
| Retrieves the model object associated with the entity. More...
enum SUResult | SUEntityGetParentEntities (SUEntityRef entity, SUEntitiesRef *entities)
| Retrieves the entities object which contains the entity. More...

## Detailed Description

A font entity reference.

Since
  SketchUp 2017, API 5.0

## Friends And Related Function Documentation

SUFontRef SUFontFromEntity | ( | SUEntityRef | entity | ) |
| related

Converts from an SUEntityRef to an SUFontRef. This is essentially a downcast operation so the given entity must be convertible to an SUFontRef.

Since
  SketchUp 2019, API 7.0

Parameters

  [in] | entity | The given entity reference.

Returns
  - The converted SUFontRef if the downcast operation succeeds
  - If not, the returned reference will be invalid

enum SUResult SUFontGetBold | ( | SUFontRef | font,
|  | bool * | is_bold
| ) |  |
| related

Retrieves a boolean indicating whether the font is bold.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | font | The font object.
  [out] | is_bold | The boolean retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if font is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if is_bold is NULL

enum SUResult SUFontGetFaceName | ( | SUFontRef | font,
|  | SUStringRef * | name
| ) |  |
| related

Retrieves the face name of a font object.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | font | The font object.
  [out] | name | The name retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if font is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if name is NULL
  - SU_ERROR_INVALID_OUTPUT if name does not point to a valid SUStringRef object

enum SUResult SUFontGetItalic | ( | SUFontRef | font,
|  | bool * | is_italic
| ) |  |
| related

Retrieves a boolean indicating whether the font is italic.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | font | The font object.
  [out] | is_italic | The boolean retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if font is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if is_italic is NULL

enum SUResult SUFontGetPointSize | ( | SUFontRef | font,
|  | size_t * | size
| ) |  |
| related

Retrieves a font's point size.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | font | The font object.
  [out] | size | The returned font size.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if font is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if size is NULL

enum SUResult SUFontGetUseWorldSize | ( | SUFontRef | font,
|  | bool * | use_world_size
| ) |  |
| related

Retrieves a boolean indicating whether the size of the font is defined as a height in world space. A false value indicates that the font size is defined in points (i.e. in screen space).

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | font | The font object.
  [out] | use_world_size | The boolean retrieved.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if font is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if is_italic is NULL

enum SUResult SUFontGetWorldSize | ( | SUFontRef | font,
|  | double * | world_size
| ) |  |
| related

Retrieves the height of the font in inches when the font size is defined as a height in world space. That is, when SUFontGetUseWorldSize() returns true.

Since
  SketchUp 2017, API 5.0

Parameters

  [in] | font | The font object.
  [out] | world_size | The returned world size factor.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if font is not a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if world_size is NULL

SUEntityRef SUFontToEntity | ( | SUFontRef | font | ) |
| related

Converts from an SUFontRef to an SUEntityRef. This is essentially an upcast operation.

Since
  SketchUp 2019, API 7.0

Parameters

  [in] | font | The given font reference.

Returns
  - The converted SUEntityRef if font is a valid font.
  - If not, the returned reference will be invalid.

enum SUResult SUModelAddFont | ( | SUModelRef | model_ref,
|  | const struct SUFontInfo * | font_info,
|  | SUFontRef * | added_font_ref
| ) |  |
| related

Returns an object reference to a font object based on font_info.

Note
  The returned font reference may be for either an existing object in the model or a new in-model object if none existed previously. It may also become invalid if assigned to an object which later has a different font assigned to it.

Since
  SketchUp 2026.0, API 14.0

Parameters

  [in] | model_ref | The model font is to be associated with.
  [in] | font_info | Struct that defines all parameters of the new font.
  [out] | added_font_ref | The font object returned.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if `model_ref` is not a valid object
  - SU_ERROR_NULL_POINTER_INPUT if `font_info` is NULL
  - SU_ERROR_INVALID_ARGUMENT if `font_info` contains invalid data
  - SU_ERROR_OUT_OF_RANGE if `font_info` contains values that are out of range
  - SU_ERROR_NULL_POINTER_OUTPUT if `added_font_ref` is NULL
  - SU_ERROR_OVERWRITE_VALID if `added_font_ref` already references a valid object

The documentation for this struct was generated from the following files:

- SketchUpAPI/model/defs.h
- SketchUpAPI/model/font.h
- SketchUpAPI/model/model.h