Text, many performance improvements

This commit is contained in:
2026-03-20 19:23:55 -04:00
parent 39ede248cf
commit 00fe1daa0c
18 changed files with 3432 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
//! Renderer-oriented scene snapshot types.
use cosmic_text::CacheKey;
use tracing::debug;
use crate::trace_targets;
@@ -92,12 +93,16 @@ pub struct GlyphInstance {
pub glyph: String,
pub position: Point,
pub advance: f32,
pub cache_key: Option<CacheKey>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct PreparedText {
pub text: String,
pub origin: Point,
pub bounds: Option<UiSize>,
pub font_size: f32,
pub line_height: f32,
pub color: Color,
pub glyphs: Vec<GlyphInstance>,
}
@@ -118,13 +123,17 @@ impl PreparedText {
glyph: ch.to_string(),
position: Point::new(x, origin.y),
advance,
cache_key: None,
});
x += advance;
}
Self {
text,
origin,
bounds: None,
font_size,
line_height: font_size,
color,
glyphs,
}