pub struct StaticFontAtlas { /* private fields */ }Expand description
A texture atlas containing font glyphs for efficient GL text rendering.
StaticFontAtlas manages a GL 2D texture array where each layer contains a single
character glyph. This design enables efficient instanced rendering of text by
allowing the GPU to select the appropriate character layer for each rendered cell.
§Architecture
The atlas uses a GL 2D texture array where:
- Each layer contains one character glyph
- ASCII characters use their ASCII value as the layer index
- Non-ASCII characters are stored in a hash map for layer lookup
- All glyphs have uniform cell dimensions for consistent spacing
Implementations§
Source§impl StaticFontAtlas
impl StaticFontAtlas
Sourcepub fn load(
gl: &Context,
config: FontAtlasData,
) -> Result<StaticFontAtlas, Error>
pub fn load( gl: &Context, config: FontAtlasData, ) -> Result<StaticFontAtlas, Error>
Creates a TextureAtlas from a grid of equal-sized cells
Trait Implementations§
Source§impl Atlas for StaticFontAtlas
impl Atlas for StaticFontAtlas
Source§fn get_base_glyph_id(&self, key: &str) -> Option<u16>
fn get_base_glyph_id(&self, key: &str) -> Option<u16>
Returns the base glyph identifier for the given key
Source§fn underline(&self) -> LineDecoration
fn underline(&self) -> LineDecoration
Returns the underline configuration
Source§fn strikethrough(&self) -> LineDecoration
fn strikethrough(&self) -> LineDecoration
Returns the strikethrough configuration
Source§fn get_symbol(&self, glyph_id: u16) -> Option<CompactString>
fn get_symbol(&self, glyph_id: u16) -> Option<CompactString>
Returns the symbol for the given glyph ID, if it exists
Source§fn recreate_texture(&mut self, gl: &Context) -> Result<(), Error>
fn recreate_texture(&mut self, gl: &Context) -> Result<(), Error>
Recreates the GPU texture after a context loss.
This method rebuilds the texture from the retained atlas data. All glyph mappings and other CPU-side state are preserved; only the GPU texture handle is recreated.
Source§fn base_lookup_mask(&self) -> u32
fn base_lookup_mask(&self) -> u32
Returns 0x1FFF to support the full glyph encoding from beamterm-atlas.
This 13-bit mask includes the emoji flag (bit 12) so that emoji base IDs can be extracted correctly for symbol lookup and texture coordinate calculation.