Handle to an owned font.
More...
|
void | Close () |
| Dispose of a previously-created font.
|
|
FontShared | share () |
| Move this font into a FontShared.
|
|
constexpr | ResourceUnique (std::nullptr_t=nullptr) |
| Default constructor.
|
|
constexpr | ResourceUnique (base::value_type value, DELETER deleter={}) |
| Constructs from raw type.
|
|
constexpr | ResourceUnique (ResourceUnique &&other) |
| Move constructor.
|
|
| ResourceUnique (const ResourceUnique &other)=delete |
|
constexpr | ResourceUnique (std::nullptr_t=nullptr) |
| Default constructor.
|
|
constexpr | ResourceUnique (base::value_type value, DefaultDeleter< FontRef > deleter={}) |
| Constructs from raw type.
|
|
constexpr | ResourceUnique (ResourceUnique &&other) |
| Move constructor.
|
|
| ResourceUnique (const ResourceUnique &other)=delete |
|
| ~ResourceUnique () |
| Destructor.
|
|
constexpr ResourceUnique & | operator= (ResourceUnique other) |
| Assignment operator.
|
|
void | reset () |
| Resets the value, destroying the resource if not nullptr.
|
|
RESOURCE | release () |
| Returns reference and reset this.
|
|
constexpr | operator bool () const |
| Check if not null.
|
|
constexpr bool | operator== (const ResourcePtrBase &other) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullopt_t) const |
| Comparison.
|
|
constexpr reference | operator* () const |
| Gets reference.
|
|
constexpr const reference * | operator-> () const |
| Gets addressable reference.
|
|
constexpr reference * | operator-> () |
| Gets addressable reference.
|
|
reference | get () const |
| Get reference.
|
|
|
using | deleter = DELETER |
| The deleter type.
|
|
using | reference = RESOURCE |
| The reference resource type.
|
|
using | value_type = typename reference::value_type |
| The raw resource type.
|
|
constexpr | ResourceOwnerBase (base::value_type value={}, DELETER deleter={}) |
| Constructs from raw type.
|
|
void | free () |
| Frees resource.
|
|
constexpr | ResourcePtrBase (value_type value={}) |
| Constructs from raw type.
|
|
reference & | get () |
| Get reference.
|
|
- Category:
- Resource
- See also
- FontRef
◆ Close()
void SDL::Font::Close |
( |
| ) |
|
|
inline |
Call this when done with a font. This function will free any resources associated with it. It is safe to call this function on nullptr, for example on the result of a failed call to Font.Open().
The font is not valid after being passed to this function. String pointers from functions that return information on this font, such as FontRef.GetFamilyName() and FontRef.GetStyleName(), are no longer valid after this call, as well.
- Thread safety:
- This function should not be called while any other thread is using the font.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- Font.Open
◆ Open() [1/2]
Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.
- Parameters
-
src | an IOStreamRef to provide a font file's data. |
ptsize | point size to use for the newly-opened font. |
- Returns
- a valid FontRef on success.
- Exceptions
-
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- Font.Close
◆ Open() [2/2]
Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.
- Parameters
-
file | path to font file. |
ptsize | point size to use for the newly-opened font. |
- Returns
- a valid FontRef on success.
- Exceptions
-
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- Font.Close
◆ OpenWithProperties()
These are the supported properties:
prop::Font.CREATE_FILENAME_STRING
: the font file to open, if an IOStreamRef isn't being used. This is required if prop::Font.CREATE_IOSTREAM_POINTER
and prop::Font.CREATE_EXISTING_FONT_POINTER
aren't set.
prop::Font.CREATE_IOSTREAM_POINTER
: an IOStreamRef containing the font to be opened. This should not be closed until the font is closed. This is required if prop::Font.CREATE_FILENAME_STRING
and prop::Font.CREATE_EXISTING_FONT_POINTER
aren't set.
prop::Font.CREATE_IOSTREAM_OFFSET_NUMBER
: the offset in the iostream for the beginning of the font, defaults to 0.
prop::Font.CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN
: true if closing the font should also close the associated IOStreamRef.
prop::Font.CREATE_SIZE_FLOAT
: the point size of the font. Some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default.
prop::Font.CREATE_FACE_NUMBER
: the face index of the font, if the font contains multiple font faces.
prop::Font.CREATE_HORIZONTAL_DPI_NUMBER
: the horizontal DPI to use for font rendering, defaults to prop::Font.CREATE_VERTICAL_DPI_NUMBER
if set, or 72 otherwise.
prop::Font.CREATE_VERTICAL_DPI_NUMBER
: the vertical DPI to use for font rendering, defaults to prop::Font.CREATE_HORIZONTAL_DPI_NUMBER
if set, or 72 otherwise.
prop::Font.CREATE_EXISTING_FONT_POINTER
: an optional FontRef that, if set, will be used as the font data source and the initial size and style of the new font.
- Parameters
-
props | the properties to use. |
- Returns
- a valid FontRef on success.
- Exceptions
-
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- Font.Close
The documentation for this struct was generated from the following file: