13#include <utility/graphic/texture.hpp>
17#include <utility/graphic/text/glyph.hpp>
19namespace utility::graphic
73 std::shared_ptr<Texture>
getAtlas(
bool shouldRegenerate =
false);
82 bool hasGlyph(uint32_t codePoint)
const;
The FontSized class represents a specific size of a font face, managing the glyphs and texture atlas ...
std::map< uint32_t, Glyph > _generatedGlyphs
A map storing the generated glyphs for this font size.
uint32_t _fontSize
The font size in points for this FontSized object.
void resizeAtlas(int newHeight)
Grow the atlas to the given new height, preserving existing glyphs.
std::shared_ptr< Texture > getAtlas(bool shouldRegenerate=false)
Retrieves the texture atlas containing the rendered glyphs for this font size.
std::shared_ptr< Texture > _generatedAtlas
The font size in points for this FontSized object.
int _atlasWidth
The width of the texture atlas.
void generateAtlas()
Generates the texture atlas based on the currently generated glyphs for this font size.
int _penY
The y-coordinate of the pen for glyph placement.
void * _correspondingFace
The corresponding FreeType face associated with this FontSized object.
int _rowHeight
The height of each row in the texture atlas.
~FontSized()=default
Destructs the FontSized object, releasing any allocated resources.
int _atlasHeight
The height of the texture atlas.
float _descender
The descender value for the font size, representing the depth of the lowest glyph below the baseline.
Glyph generateGlyph(uint32_t codePoint)
Generates a glyph for a specific Unicode code point and adds it to the texture atlas.
std::vector< Glyph > generateGlyphs(const codePointString &codePoints)
Generates glyphs for a string of Unicode code points and adds them to the texture atlas.
float _ascender
The ascender value for the font size, representing the height of the tallest glyph above the baseline...
Glyph measureGlyph(uint32_t codePoint) const
Compute glyph metrics for a code point without rasterizing or mutating the texture atlas.
bool hasGlyph(uint32_t codePoint) const
Checks whether a glyph has already been generated for this font size.
float _lineHeight
The line height value for the font size, representing the vertical distance between lines of text.
int _penX
The x-coordinate of the pen for glyph placement.
Code point definitions for text rendering.
std::vector< uint32_t > codePointString
A type representing a string of Unicode code points.
The Glyph struct represents a single character's visual representation in a font atlas.