pub struct DFont {
pub backing: Vec<u8>,
pub location: Vec<VariationSetting>,
pub normalized_location: Location,
pub codepoints: HashSet<u32>,
}Expand description
A representation of everything we need to know about a font for diffenator purposes
Fields§
§backing: Vec<u8>The font binary data
location: Vec<VariationSetting>The location of the font we are interested in diffing
normalized_location: LocationThe normalized location of the font
codepoints: HashSet<u32>The set of encoded codepoints in the font
Implementations§
Source§impl DFont
impl DFont
Sourcepub fn normalize_location(&mut self)
pub fn normalize_location(&mut self)
Normalize the location
This method must be called after the location is changed. (It’s that or getters and setters, and nobody wants that.)
Sourcepub fn set_location(&mut self, variations: &str) -> Result<(), String>
pub fn set_location(&mut self, variations: &str) -> Result<(), String>
Set the location of the font given a user-specified location string
Sourcepub fn set_instance(&mut self, instance: &str) -> Result<(), String>
pub fn set_instance(&mut self, instance: &str) -> Result<(), String>
Set the location of the font to a given named instance
pub fn fontref(&self) -> FontRef<'_>
pub fn family_name(&self) -> String
pub fn style_name(&self) -> String
Sourcepub fn axis_info(&self) -> HashMap<String, (f32, f32, f32)>
pub fn axis_info(&self) -> HashMap<String, (f32, f32, f32)>
The axes of the font
Returns a map from axis tag to (min, default, max) values
Sourcepub fn supported_scripts(&self) -> HashSet<String>
pub fn supported_scripts(&self) -> HashSet<String>
Returns a list of scripts where the font has at least one encoded character from that script.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DFont
impl RefUnwindSafe for DFont
impl Send for DFont
impl Sync for DFont
impl Unpin for DFont
impl UnsafeUnpin for DFont
impl UnwindSafe for DFont
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<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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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.