pub struct FontAtlas { /* private fields */ }Expand description
Type-erased wrapper around any Atlas implementation.
Implementations§
Source§impl FontAtlas
impl FontAtlas
Sourcepub fn new(inner: impl Atlas + 'static) -> FontAtlas
pub fn new(inner: impl Atlas + 'static) -> FontAtlas
Wraps an atlas implementation in a type-erased container.
Sourcepub fn get_glyph_id(&mut self, key: &str, style_bits: u16) -> Option<u16>
pub fn get_glyph_id(&mut self, key: &str, style_bits: u16) -> Option<u16>
Returns the styled glyph ID for the given symbol.
Sourcepub fn get_base_glyph_id(&mut self, key: &str) -> Option<u16>
pub fn get_base_glyph_id(&mut self, key: &str) -> Option<u16>
Returns the unstyled base glyph ID for the given symbol.
Sourcepub fn underline(&self) -> LineDecoration
pub fn underline(&self) -> LineDecoration
Returns underline position and thickness metadata.
Sourcepub fn strikethrough(&self) -> LineDecoration
pub fn strikethrough(&self) -> LineDecoration
Returns strikethrough position and thickness metadata.
Sourcepub fn get_symbol(&self, glyph_id: u16) -> Option<CompactString>
pub fn get_symbol(&self, glyph_id: u16) -> Option<CompactString>
Returns the symbol string for the given glyph ID.
Sourcepub fn get_ascii_char(&self, glyph_id: u16) -> Option<char>
pub fn get_ascii_char(&self, glyph_id: u16) -> Option<char>
Returns the ASCII character for the given glyph ID, if applicable.
Sourcepub fn glyph_tracker(&self) -> &GlyphTracker
pub fn glyph_tracker(&self) -> &GlyphTracker
Returns a reference to the glyph usage tracker.
Sourcepub fn glyph_count(&self) -> u32
pub fn glyph_count(&self) -> u32
Returns the total number of allocated glyphs.
Sourcepub fn recreate_texture(&mut self, gl: &Context) -> Result<(), Error>
pub fn recreate_texture(&mut self, gl: &Context) -> Result<(), Error>
Recreates the GPU texture after a context loss.
§Errors
Returns an error if GPU texture creation fails.
Sourcepub fn for_each_symbol(&self, f: &mut dyn FnMut(u16, &str))
pub fn for_each_symbol(&self, f: &mut dyn FnMut(u16, &str))
Iterates over all glyph ID to symbol mappings.
Sourcepub fn resolve_glyph_slot(
&mut self,
key: &str,
style_bits: u16,
) -> Option<GlyphSlot>
pub fn resolve_glyph_slot( &mut self, key: &str, style_bits: u16, ) -> Option<GlyphSlot>
Resolves a symbol to its glyph slot classification.
Sourcepub fn delete(&self, gl: &Context)
pub fn delete(&self, gl: &Context)
Deletes the GPU texture resources associated with this atlas.
Sourcepub fn update_pixel_ratio(
&mut self,
gl: &Context,
pixel_ratio: f32,
) -> Result<f32, Error>
pub fn update_pixel_ratio( &mut self, gl: &Context, pixel_ratio: f32, ) -> Result<f32, Error>
Updates the pixel ratio for HiDPI rendering.
Returns the effective pixel ratio to use for viewport scaling.
§Errors
Returns an error if GPU texture recreation fails during reinitialization.
Sourcepub fn cell_scale_for_dpr(&self, pixel_ratio: f32) -> f32
pub fn cell_scale_for_dpr(&self, pixel_ratio: f32) -> f32
Returns the cell scale factor for layout calculations.
Sourcepub fn texture_cell_size(&self) -> CellSize
pub fn texture_cell_size(&self) -> CellSize
Returns the texture cell size in physical pixels.