pub struct FontData {
pub font: Cow<'static, [u8]>,
pub index: u32,
pub tweak: FontTweak,
}Expand description
A .ttf or .otf file and a font face index.
Fields§
§font: Cow<'static, [u8]>The content of a .ttf or .otf file.
index: u32Which font face in the file to use.
When in doubt, use 0.
tweak: FontTweakExtra scale and vertical tweak to apply to all text of this font.
Implementations§
Source§impl FontData
impl FontData
pub fn from_static(font: &'static [u8]) -> FontData
pub fn from_owned(font: Vec<u8>) -> FontData
pub fn tweak(self, tweak: FontTweak) -> FontData
Sourcepub fn variation_axes(&self) -> Vec<FontVariationAxis>
pub fn variation_axes(&self) -> Vec<FontVariationAxis>
The variation axes of this font, e.g. wght (weight) and wdth (width).
Use this to discover which axes a variable font supports, and their valid
ranges, so a UI can offer the right knobs instead of making the user guess
tags and values for FontTweak::coords.
Returns an empty list for non-variable (static) fonts, or if the font data fails to parse.
Trait Implementations§
impl StructuralPartialEq for FontData
Auto Trait Implementations§
impl Freeze for FontData
impl RefUnwindSafe for FontData
impl Send for FontData
impl Sync for FontData
impl Unpin for FontData
impl UnsafeUnpin for FontData
impl UnwindSafe for FontData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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