MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ grow()

void MayaFlux::Portal::Text::GlyphAtlas::grow ( )
private

Double the atlas texture and re-rasterize every cached glyph into it.

Definition at line 88 of file GlyphAtlas.cpp.

89{
90 const uint32_t new_size = m_atlas_size * 2;
91
93 "GlyphAtlas: growing {}x{} -> {}x{} (pixel_size={})",
94 m_atlas_size, m_atlas_size, new_size, new_size, m_pixel_size);
95
96 struct CachedGlyph {
97 FontFace* face;
98 FT_UInt glyph_index;
99 };
100
101 std::vector<CachedGlyph> cached;
102 for (const auto& [face, glyphs] : m_cache) {
103 for (const auto& glyph_entry : glyphs) {
104 cached.push_back({ face, glyph_entry.first });
105 }
106 }
107
108 m_atlas_size = new_size;
109 m_texture = std::make_unique<Kakshya::TextureContainer>(
110 new_size, new_size, Portal::Graphics::ImageFormat::R8);
111
112 m_cursor_x = 0;
113 m_cursor_y = 0;
114 m_shelf_height = 0;
115 m_cache.clear();
116
117 for (const auto& c : cached) {
118 rasterize(*c.face, c.glyph_index);
119 }
120
121 m_dirty = true;
122}
#define MF_INFO(comp, ctx,...)
std::unordered_map< FontFace *, std::unordered_map< FT_UInt, GlyphMetrics > > m_cache
Per-face glyph cache.
std::unique_ptr< Kakshya::TextureContainer > m_texture
bool rasterize(FontFace &face, FT_UInt glyph_index)
@ API
API calls from external code.
@ Portal
High-level user-facing API layer.

References MayaFlux::Journal::API, m_atlas_size, m_cache, m_cursor_x, m_cursor_y, m_dirty, m_pixel_size, m_shelf_height, m_texture, MF_INFO, MayaFlux::Journal::Portal, and rasterize().

Referenced by rasterize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: