pub struct FontFace { /* private fields */ }Expand description
Immutable font bytes and collection face index, shared across scene snapshots.
Loading never performs font discovery or I/O. Layout reparses the retained bytes; parser allocations and caller input are not a hard RSS budget.
Implementations§
Source§impl FontFace
impl FontFace
Sourcepub fn from_bytes(
bytes: Vec<u8>,
face_index: u32,
) -> Result<Self, ValidationError>
pub fn from_bytes( bytes: Vec<u8>, face_index: u32, ) -> Result<Self, ValidationError>
Validates an OpenType/TrueType face before retaining its bytes. Invalid data or face indices fail without constructing a resource.
Sourcepub fn byte_len(&self) -> usize
pub fn byte_len(&self) -> usize
Retained source payload, excluding allocation overhead and parser scratch.
Sourcepub fn library(&self) -> Result<FontLibrary, ValidationError>
pub fn library(&self) -> Result<FontLibrary, ValidationError>
Creates an explicit paragraph font snapshot without system discovery.
Trait Implementations§
Source§impl Asset for FontFace
Available on crate feature text only.
impl Asset for FontFace
Available on crate feature
text only.Source§const KIND: &'static str = "font"
const KIND: &'static str = "font"
Human-readable resource category retained by load diagnostics.
Source§fn decode(bytes: &[u8], _: &LoadContext) -> Result<Self>
fn decode(bytes: &[u8], _: &LoadContext) -> Result<Self>
Decodes bounded input without requiring a rendering device.
Implementations must be deterministic for these bytes/context; recursive
resource dependency graphs are not a supported decoder contract.
Source§fn retained_bytes(&self) -> usize
fn retained_bytes(&self) -> usize
Logical decoded payload charge; custom heap-owning assets should override.
At least the encoded input length is charged regardless of this value.
Auto Trait Implementations§
impl Forget for FontFace
impl Freeze for FontFace
impl RefUnwindSafe for FontFace
impl Send for FontFace
impl Sync for FontFace
impl Unpin for FontFace
impl UnsafeUnpin for FontFace
impl UnwindSafe for FontFace
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