pub struct FontAsset {
pub name: String,
pub bytes: Arc<[u8]>,
pub face_index: u32,
pub digest: [u8; 32],
}Expand description
Explicit immutable font bytes.
Fields§
§name: StringStable logical family/name used by templates.
bytes: Arc<[u8]>TrueType/OpenType bytes.
face_index: u32Face index for collections.
digest: [u8; 32]SHA-256 digest used by fingerprints.
Implementations§
Source§impl FontAsset
impl FontAsset
Sourcepub fn new(
name: impl Into<String>,
bytes: Vec<u8>,
face_index: u32,
) -> Result<Self>
pub fn new( name: impl Into<String>, bytes: Vec<u8>, face_index: u32, ) -> Result<Self>
Validates font bytes and creates an asset.
Examples found in repository?
More examples
Sourcepub fn covers(&self, text: &str) -> bool
pub fn covers(&self, text: &str) -> bool
Returns whether this font maps every scalar in a grapheme cluster.
Sourcepub fn units_per_em(&self) -> Result<u16>
pub fn units_per_em(&self) -> Result<u16>
Returns units per em.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FontAsset
impl RefUnwindSafe for FontAsset
impl Send for FontAsset
impl Sync for FontAsset
impl Unpin for FontAsset
impl UnsafeUnpin for FontAsset
impl UnwindSafe for FontAsset
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.