vizia_core/text/
text_context.rs
1use skia_safe::textlayout::{Paragraph, TypefaceFontProvider};
2use skia_safe::{textlayout::FontCollection, FontMgr};
3use vizia_storage::SparseSet;
4
5use crate::{entity::Entity, layout::BoundingBox};
6
7pub struct TextContext {
8 pub font_collection: FontCollection,
9 pub default_font_manager: FontMgr,
10 pub asset_provider: TypefaceFontProvider,
11 pub text_bounds: SparseSet<BoundingBox>,
12 pub text_paragraphs: SparseSet<Paragraph>,
13}
14
15impl TextContext {
16 #[allow(dead_code)]
17 pub(crate) fn font_collection(&self) -> &FontCollection {
18 &self.font_collection
19 }
20
21 pub(crate) fn set_text_bounds(&mut self, entity: Entity, bounds: BoundingBox) {
22 self.text_bounds.insert(entity, bounds);
23 }
24}