70 uint32_t atlas_size = 512);
84 const GlyphMetrics* get_or_rasterize(FT_UInt glyph_index);
95 const GlyphMetrics* get_or_rasterize(FT_ULong codepoint);
111 [[nodiscard]]
bool is_dirty()
const {
return m_dirty; }
121 [[nodiscard]] uint32_t
pixel_size()
const {
return m_pixel_size; }
126 [[nodiscard]] uint32_t
atlas_size()
const {
return m_atlas_size; }
135 [[nodiscard]] uint32_t line_height()
const;
138 bool rasterize(FT_UInt glyph_index);
146 std::unordered_map<FT_UInt, GlyphMetrics>
m_cache;
148 uint32_t m_cursor_x { 0 };
149 uint32_t m_cursor_y { 0 };
150 uint32_t m_shelf_height { 0 };
152 bool m_dirty {
false };
SignalSourceContainer wrapping GPU texture data as addressable pixel bytes.
Owns a single FT_Face loaded from a file path.
GlyphAtlas(const GlyphAtlas &)=delete
GlyphAtlas(GlyphAtlas &&)=delete
GlyphAtlas & operator=(const GlyphAtlas &)=delete
std::unique_ptr< Kakshya::TextureContainer > m_texture
bool is_dirty() const
Returns true if at least one glyph was rasterized since the last call to clear_dirty().
void clear_dirty()
Clear the dirty flag after re-uploading the atlas to GPU.
GlyphAtlas & operator=(GlyphAtlas &&)=delete
Kakshya::TextureContainer & texture()
uint32_t pixel_size() const
Pixel size passed at construction.
std::unordered_map< FT_UInt, GlyphMetrics > m_cache
uint32_t atlas_size() const
Atlas texture dimension (width == height == atlas_size).
const Kakshya::TextureContainer & texture() const
The atlas texture as a TextureContainer (R8, atlas_size x atlas_size).
Rasterizes and packs glyphs from a FontFace into a TextureContainer.
int32_t bearing_x
Horizontal bearing in pixels (from FT_GlyphSlot).
float uv_x0
Left UV edge in atlas texture.
float uv_x1
Right UV edge in atlas texture.
uint32_t height
Glyph bitmap height in pixels.
int32_t advance_x
Horizontal advance in pixels (26.6 fixed-point >> 6).
uint32_t width
Glyph bitmap width in pixels.
float uv_y0
Top UV edge in atlas texture.
int32_t bearing_y
Vertical bearing in pixels (from FT_GlyphSlot).
float uv_y1
Bottom UV edge in atlas texture.
Per-glyph layout and UV data produced by GlyphAtlas.