pub struct FontAtlasData { /* private fields */ }Expand description
Font atlas data for GPU-accelerated terminal rendering.
Contains a pre-rasterized font atlas stored as a 2D texture array, where each layer holds 32 glyphs in a 1×32 grid. The atlas includes multiple font styles (normal, bold, italic, bold+italic) and full Unicode support including emoji.
Implementations§
Source§impl FontAtlasData
impl FontAtlasData
Sourcepub const PADDING: i32 = 1
pub const PADDING: i32 = 1
Padding in pixels around each glyph cell to prevent texture bleeding.
Sourcepub const CELLS_PER_SLICE: i32 = 32
pub const CELLS_PER_SLICE: i32 = 32
Number of glyph cells per texture layer.
Sourcepub fn new(
font_name: CompactString,
font_size: f32,
max_halfwidth_base_glyph_id: u16,
texture_dimensions: (i32, i32, i32),
cell_size: CellSize,
underline: LineDecoration,
strikethrough: LineDecoration,
glyphs: Vec<Glyph>,
texture_data: Vec<u8>,
) -> Self
pub fn new( font_name: CompactString, font_size: f32, max_halfwidth_base_glyph_id: u16, texture_dimensions: (i32, i32, i32), cell_size: CellSize, underline: LineDecoration, strikethrough: LineDecoration, glyphs: Vec<Glyph>, texture_data: Vec<u8>, ) -> Self
Creates a new font atlas with the given parameters.
Sourcepub fn max_halfwidth_base_glyph_id(&self) -> u16
pub fn max_halfwidth_base_glyph_id(&self) -> u16
Returns the maximum halfwidth base glyph ID.
Fullwidth glyphs are assigned IDs starting from this value.
Sourcepub fn texture_dimensions(&self) -> (i32, i32, i32)
pub fn texture_dimensions(&self) -> (i32, i32, i32)
Returns the texture dimensions as (width, height, layers).
Sourcepub fn underline(&self) -> LineDecoration
pub fn underline(&self) -> LineDecoration
Returns the underline decoration configuration.
Sourcepub fn strikethrough(&self) -> LineDecoration
pub fn strikethrough(&self) -> LineDecoration
Returns the strikethrough decoration configuration.
Sourcepub fn texture_data(&self) -> &[u8] ⓘ
pub fn texture_data(&self) -> &[u8] ⓘ
Returns the raw texture data.
Sourcepub fn into_glyphs(self) -> Vec<Glyph>
pub fn into_glyphs(self) -> Vec<Glyph>
Consumes the atlas and returns its glyphs.
Sourcepub fn from_binary(serialized: &[u8]) -> Result<Self, SerializationError>
pub fn from_binary(serialized: &[u8]) -> Result<Self, SerializationError>
Deserializes a font atlas from binary format.
§Arguments
serialized- Binary data containing the serialized font atlas
§Errors
Returns SerializationError if the binary data is malformed or cannot be deserialized.
§Returns
The deserialized font atlas or an error if deserialization fails
Sourcepub fn to_binary(&self) -> Result<Vec<u8>, SerializationError>
pub fn to_binary(&self) -> Result<Vec<u8>, SerializationError>
Serializes the font atlas to binary format.
§Errors
Returns SerializationError if serialization fails (e.g., a string field exceeds 255 bytes).
§Returns
A byte vector containing the serialized font atlas data, or an error if serialization fails (e.g., a string field exceeds 255 bytes)
Trait Implementations§
Source§impl Clone for FontAtlasData
impl Clone for FontAtlasData
Source§fn clone(&self) -> FontAtlasData
fn clone(&self) -> FontAtlasData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more