zenthra-text 0.2.0

Typography, font shaping, and text layout for the Zenthra UI framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::types::glyph::{GlyphKey, AtlasEntry};

/// A trait for managing the GPU texture atlas where glyphs are stored.
pub trait Atlas: Send + Sync {
    /// Returns the UV metadata for a glyph, inserting it if not already present.
    fn get_or_insert(&mut self, key: GlyphKey, glyph: &crate::types::glyph::RasterizedGlyph) -> AtlasEntry;


    /// Returns a reference to the underlying WGPU texture.
    fn texture(&self) -> &wgpu::Texture;

    /// Flushes any pending data to the GPU queue.
    fn flush(&mut self, queue: &wgpu::Queue);

    /// Clears the atlas (e.g., when the texture is full or the scale changes).
    fn clear(&mut self);
}