pub struct TextTextures { /* private fields */ }Expand description
Fonts and the texts rasterized with them, keyed by content and render size.
Implementations§
Source§impl TextTextures
impl TextTextures
Sourcepub fn add_font(
&mut self,
family: impl Into<String>,
bytes: impl Into<Arc<[u8]>>,
face_index: u32,
) -> Result<(), TextError>
pub fn add_font( &mut self, family: impl Into<String>, bytes: impl Into<Arc<[u8]>>, face_index: u32, ) -> Result<(), TextError>
Appends an OpenType font to the fallback stack and drops rasterized texts.
§Errors
Returns TextError::Raster for malformed font bytes.
Sourcepub fn font_count(&self) -> usize
pub fn font_count(&self) -> usize
Fonts in the fallback stack.
Sourcepub fn unmatched_font_families(&self) -> Vec<String>
pub fn unmatched_font_families(&self) -> Vec<String>
Requested families no registered font has, sorted
(alpha2_text::TextRasterizer::unmatched_families).
Sourcepub fn prepare(
&mut self,
renderer: &dyn TextUpload,
frame: &FrameDesc<'_>,
size: RenderSize,
) -> Result<(), TextError>
pub fn prepare( &mut self, renderer: &dyn TextUpload, frame: &FrameDesc<'_>, size: RenderSize, ) -> Result<(), TextError>
Sourcepub fn layout(&self, key: u128) -> Option<Arc<PreparedLayout>>
pub fn layout(&self, key: u128) -> Option<Arc<PreparedLayout>>
The prepared layout with key, as layout_key names it.
Sourcepub fn measure_layout(
&self,
root: &LayoutNode,
time: MediaTime,
size: RenderSize,
canvas: (u32, u32),
) -> Result<LayoutBounds, TextError>
pub fn measure_layout( &self, root: &LayoutNode, time: MediaTime, size: RenderSize, canvas: (u32, u32), ) -> Result<LayoutBounds, TextError>
Sourcepub fn prepare_at(
&mut self,
renderer: &dyn TextUpload,
project: &EngineProject,
time: MediaTime,
size: RenderSize,
) -> Result<(), EngineError>
pub fn prepare_at( &mut self, renderer: &dyn TextUpload, project: &EngineProject, time: MediaTime, size: RenderSize, ) -> Result<(), EngineError>
Self::prepare for project at time; skips evaluation when the project draws no text
(crate::EngineProject::draws_text).
§Errors
Returns crate::EngineError::Evaluate or
crate::EngineError::Text.
Sourcepub fn measure(
&self,
text: &str,
style: &TextStyle,
size: RenderSize,
) -> Result<TextBounds, TextError>
pub fn measure( &self, text: &str, style: &TextStyle, size: RenderSize, ) -> Result<TextBounds, TextError>
crate::measure_text with these fonts.
§Errors
Returns TextError::Raster as Self::prepare would for the text.
Sourcepub fn get(&self, key: u64) -> Option<TextTexture<'_>>
pub fn get(&self, key: u64) -> Option<TextTexture<'_>>
The prepared text with key, as crate::text_key names it.
Trait Implementations§
Source§impl Debug for TextTextures
impl Debug for TextTextures
Auto Trait Implementations§
impl !Freeze for TextTextures
impl !RefUnwindSafe for TextTextures
impl !UnwindSafe for TextTextures
impl Send for TextTextures
impl Sync for TextTextures
impl Unpin for TextTextures
impl UnsafeUnpin for TextTextures
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more