Skip to main content

FontResourceProvider.ixx File

Abstract interface for loading and providing font glyph data. More...

Included Headers

#include <string_view> #include <helios.engine.core.data.FontId> #include <helios.rendering.text.Glyph>

Namespaces Index

namespacehelios
namespacerendering

Graphics rendering infrastructure. More...

namespacetext

Text rendering abstractions and data types. More...

Classes Index

classFontResourceProvider

Abstract interface for loading fonts and providing glyph data. More...

Description

Abstract interface for loading and providing font glyph data.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file FontResourceProvider.ixx
3 * @brief Abstract interface for loading and providing font glyph data.
4 */
5module;
6
7#include <string_view>
8
9export module helios.rendering.text.FontResourceProvider;
10
11import helios.rendering.text.Glyph;
12
13import helios.engine.core.data.FontId;
14
15
16export namespace helios::rendering::text{
17
18 /**
19 * @brief Abstract interface for loading fonts and providing glyph data.
20 *
21 * `FontResourceProvider` defines the contract for font management in the helios
22 * text rendering system. Implementations handle the specifics of loading font files
23 * and caching glyph data for efficient text rendering.
24 *
25 * ## Responsibilities
26 *
27 * - **Font Loading:** Load font files from disk and parse glyph metrics.
28 * - **Glyph Retrieval:** Provide glyph data (texture, metrics) for individual characters.
29 * - **Caching:** Cache loaded glyphs to avoid redundant loading.
30 *
31 * @see Glyph
32 * @see TextMesh
33 * @see OpenGLGlyphTextRenderer
34 */
36
37
38 public:
39
40 /**
41 * @brief Virtual destructor for proper cleanup of derived classes.
42 */
43 virtual ~FontResourceProvider() = default;
44
45 /**
46 * @brief Loads a font from the specified file path.
47 *
48 * Parses the font file and caches glyph data for later retrieval.
49 * The font is associated with the given `FontId` for identification.
50 *
51 * @param fontId Unique identifier for this font.
52 * @param pixelHeight The height of the font, in pixels.
53 * @param pathToFont File system path to the font file (e.g., TrueType `.ttf`).
54 *
55 * @note If a font with the same `fontId` is already loaded, behavior is
56 * implementation-defined (may replace or ignore).
57 */
58 virtual void loadFont(helios::engine::core::data::FontId fontId, unsigned int pixelHeight, std::string_view pathToFont) = 0;
59
60 /**
61 * @brief Retrieves the glyph data for a character.
62 *
63 * Returns the cached glyph metrics and texture ID for the specified character
64 * and font. The font must have been previously loaded via `loadFont()`.
65 *
66 * @param c The character to retrieve the glyph for.
67 * @param fontId The font to use for rendering.
68 *
69 * @return The glyph data for the character.
70 *
71 * @note This method is marked `noexcept` and must not throw exceptions.
72 * If the character is not available, a fallback glyph should be returned.
73 */
75
76
77
78 };
79
80
81}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.