Font registry can be used to load Freetype2 fonts and create font instances (optionally with Harfbuzz). These are owned and managed by FontRegistry.
More...
#include <FontRegistry.h>
|
class FontRegistryImpl & | impl |
|
Font registry can be used to load Freetype2 fonts and create font instances (optionally with Harfbuzz). These are owned and managed by FontRegistry.
- Examples
- ramses-example-text-basic/src/main.cpp, and ramses-example-text-languages/src/main.cpp.
◆ FontRegistry() [1/2]
ramses::FontRegistry::FontRegistry |
( |
| ) |
|
◆ ~FontRegistry()
virtual ramses::FontRegistry::~FontRegistry |
( |
| ) |
|
|
overridevirtual |
◆ FontRegistry() [2/2]
ramses::FontRegistry::FontRegistry |
( |
const FontRegistry & |
other | ) |
|
|
delete |
Deleted copy constructor.
- Parameters
-
◆ createFreetype2Font()
FontId ramses::FontRegistry::createFreetype2Font |
( |
const char * |
fontPath | ) |
|
◆ createFreetype2FontFromFileDescriptor()
FontId ramses::FontRegistry::createFreetype2FontFromFileDescriptor |
( |
int |
fd, |
|
|
size_t |
offset, |
|
|
size_t |
length |
|
) |
| |
Load Freetype2 font from an open file descriptor.
The font file must be in the already opened filedescriptor at absolute position offset within the file. The filedescriptor must be opened for read access and may not be modified anymore after this call. The filedescriptor must support seeking. Ramses takes ownership of the filedescriptor and will close it when not needed anymore.
The behavior is undefined if the filedescriptor does not contain a complete and valid font at offset.
- Parameters
-
[in] | fd | Open and readable filedescriptor. |
[in] | offset | Absolute starting position of the font data within fd. |
[in] | length | Size of the font data within fd. |
- Returns
- The font id, FontId::Invalid() on error
◆ createFreetype2FontInstance()
FontInstanceId ramses::FontRegistry::createFreetype2FontInstance |
( |
FontId |
fontId, |
|
|
uint32_t |
size, |
|
|
bool |
forceAutohinting = false |
|
) |
| |
◆ createFreetype2FontInstanceWithHarfBuzz()
FontInstanceId ramses::FontRegistry::createFreetype2FontInstanceWithHarfBuzz |
( |
FontId |
fontId, |
|
|
uint32_t |
size, |
|
|
bool |
forceAutohinting = false |
|
) |
| |
Create Freetype2 font instance with Harfbuzz shaping.
- Parameters
-
[in] | fontId | The id of the font from which to create a font instance |
[in] | size | Size (in rasterized texels of glyphs) of the font |
[in] | forceAutohinting | Force autohinting (a flag for FT2 library) |
- Returns
- The font instance id, FontInstanceId::Invalid() on error
- Examples
- ramses-example-text-languages/src/main.cpp.
◆ deleteFont()
bool ramses::FontRegistry::deleteFont |
( |
FontId |
fontId | ) |
|
Delete an existing font.
- Parameters
-
[in] | fontId | The id of the font to be deleted |
- Returns
- True on success, false otherwise
◆ deleteFontInstance()
bool ramses::FontRegistry::deleteFontInstance |
( |
FontInstanceId |
fontInstance | ) |
|
Delete an existing font instance.
- Parameters
-
[in] | fontInstance | The id of the font instance to be deleted |
- Returns
- True on success, false otherwise
◆ getFontInstance()
Get font instance object corresponding to given id.
- Parameters
-
[in] | fontInstanceId | The id of font instance |
- Returns
- The font instance object, nullptr if not found
Implements ramses::IFontAccessor.
◆ operator=()
Deleted copy assignment.
- Parameters
-
- Returns
- unused
◆ impl
class FontRegistryImpl& ramses::FontRegistry::impl |
Stores internal data for implementation specifics of FontRegistry.
The documentation for this class was generated from the following file:
- /home/runner/work/ramses/ramses/client/ramses-client/ramses-text-api/include/ramses-text-api/FontRegistry.h