pub struct TextPreparationSession<'font> { /* private fields */ }Expand description
Reusable CPU shaping state borrowed from one application font registration.
Create with TextFont::shaping_session, then use
super::ScreenTextVisual::new_with_session or
super::ScreenTextVisual::set_text_with_session. Each successful changed
label owns new UTF-8/glyph storage so old clones and published frames remain
immutable. Only parsed shaping state and one property-matched plan are reused;
this does not promise allocation-free changing labels.
The font, logical size, direction and work limits cannot change in a session. Raster DPI is 1.0 for canonical labels. Desktop DPI rebuilds are separate. This object does not own the font, create a GPU resource, or use global state.
Implementations§
Source§impl<'font> TextPreparationSession<'font>
impl<'font> TextPreparationSession<'font>
Sourcepub const fn font(&self) -> &TextFont
pub const fn font(&self) -> &TextFont
Returns the exact borrowed application registration, not just its source bytes.
Sourcepub fn allocation_bytes(&self) -> usize
pub fn allocation_bytes(&self) -> usize
Returns Engine-owned scratch capacity bytes, excluding returned labels, source font, and dependency-owned parsed face/plan/buffer allocations.
Sourcepub fn cached_plan_count(&self) -> usize
pub fn cached_plan_count(&self) -> usize
Returns the number of retained property-matched plans, always zero or one.
Sourcepub fn clear_scratch(&mut self)
pub fn clear_scratch(&mut self)
Releases shaping scratch and the cached plan without invalidating labels. The borrowed parsed font face remains available for subsequent work.
Auto Trait Implementations§
impl<'font> !RefUnwindSafe for TextPreparationSession<'font>
impl<'font> !UnwindSafe for TextPreparationSession<'font>
impl<'font> Freeze for TextPreparationSession<'font>
impl<'font> Send for TextPreparationSession<'font>
impl<'font> Sync for TextPreparationSession<'font>
impl<'font> Unpin for TextPreparationSession<'font>
impl<'font> UnsafeUnpin for TextPreparationSession<'font>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.