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]) -> Self
pub fn from_owned(font: Vec<u8>) -> Self
pub fn tweak(self, tweak: FontTweak) -> Self
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