FontResourceProvider Class
Abstract interface for loading fonts and providing glyph data. More...
Declaration
Derived Classes
| class | FreeTypeFontResourceManager |
|
FreeType-based implementation of `FontResourceProvider` for OpenGL. More... | |
Public Destructor Index
| ~FontResourceProvider ()=default | |
|
Virtual destructor for proper cleanup of derived classes. More... | |
Public Member Functions Index
| void | loadFont (helios::engine::core::data::FontId fontId, unsigned int pixelHeight, std::string_view pathToFont)=0 |
|
Loads a font from the specified file path. More... | |
| helios::rendering::text::Glyph | glyph (char c, helios::engine::core::data::FontId fontId)=0 |
|
Retrieves the glyph data for a character. More... | |
Description
Abstract interface for loading fonts and providing glyph data.
`FontResourceProvider` defines the contract for font management in the helios text rendering system. Implementations handle the specifics of loading font files and caching glyph data for efficient text rendering.
## Responsibilities
- **Font Loading:** Load font files from disk and parse glyph metrics.
- **Glyph Retrieval:** Provide glyph data (texture, metrics) for individual characters.
- **Caching:** Cache loaded glyphs to avoid redundant loading.
- See Also
- See Also
- See Also
OpenGLGlyphTextRenderer
Definition at line 35 of file FontResourceProvider.ixx.
Public Destructor
~FontResourceProvider()
| virtual default |
Virtual destructor for proper cleanup of derived classes.
Definition at line 43 of file FontResourceProvider.ixx.
Public Member Functions
glyph()
|
Retrieves the glyph data for a character.
Returns the cached glyph metrics and texture ID for the specified character and font. The font must have been previously loaded via `loadFont()`.
- Parameters
-
c The character to retrieve the glyph for.
fontId The font to use for rendering.
- Returns
The glyph data for the character.
This method is marked `noexcept` and must not throw exceptions. If the character is not available, a fallback glyph should be returned.
Definition at line 74 of file FontResourceProvider.ixx.
Referenced by helios::rendering::text::TypeSetter::layout.
loadFont()
|
Loads a font from the specified file path.
Parses the font file and caches glyph data for later retrieval. The font is associated with the given `FontId` for identification.
- Parameters
-
fontId Unique identifier for this font.
pixelHeight The height of the font, in pixels.
pathToFont File system path to the font file (e.g., TrueType `.ttf`).
If a font with the same `fontId` is already loaded, behavior is implementation-defined (may replace or ignore).
Definition at line 58 of file FontResourceProvider.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.