Owns font file data and basic format metadata.
More...
#include <a3d/Font.h>
|
| | Font (const std::filesystem::path &path) |
| | Loads font data from path and derives its name and type from the path. More...
|
| |
| | Font (std::unique_ptr< Buffer > buffer) |
| | Takes ownership of buffer as font data with no name or known type. More...
|
| |
| const std::optional< std::string > & | name () const |
| | Returns the font name, or an empty optional when no name is known. More...
|
| |
| Type | type () const |
| | Returns the detected or assigned font type. More...
|
| |
| const Buffer * | buffer () const |
| | Returns the owned font-data Buffer, or nullptr when no Buffer is owned. More...
|
| |
Owns font file data and basic format metadata.
Copying a Font deep-copies its Buffer; moving transfers the owned data.
Definition at line 25 of file Font.h.
◆ Type
Recognized font container types.
| Enumerator |
|---|
| Unknown | Unknown or unspecified font type.
|
| OTF | OpenType font data.
|
| TTF | TrueType font data.
|
Definition at line 31 of file Font.h.
◆ Font() [1/2]
| a3d::Font::Font |
( |
const std::filesystem::path & |
path | ) |
|
|
explicit |
Loads font data from path and derives its name and type from the path.
The name is the filename stem. The .otf and .ttf extensions select OTF and TTF respectively; other extensions leave the type Unknown.
- Exceptions
-
| std::runtime_error | if the file cannot be opened, sized, or read. |
◆ Font() [2/2]
| a3d::Font::Font |
( |
std::unique_ptr< Buffer > |
buffer | ) |
|
|
explicit |
Takes ownership of buffer as font data with no name or known type.
◆ buffer()
| const Buffer * a3d::Font::buffer |
( |
| ) |
const |
Returns the owned font-data Buffer, or nullptr when no Buffer is owned.
◆ name()
| const std::optional< std::string > & a3d::Font::name |
( |
| ) |
const |
Returns the font name, or an empty optional when no name is known.
◆ type()
| Type a3d::Font::type |
( |
| ) |
const |
Returns the detected or assigned font type.
The documentation for this class was generated from the following file: