pub struct SoftwareTextFont { /* private fields */ }Implementations§
Source§impl SoftwareTextFont
impl SoftwareTextFont
pub fn from_bytes( bytes: impl Into<Vec<u8>>, ) -> Result<Self, SoftwareTextFontError>
Sourcepub fn from_registered_bytes(
family: &FontFamily,
weight: FontWeight,
style: FontStyle,
bytes: impl Into<Vec<u8>>,
) -> Result<Self, SoftwareTextFontError>
pub fn from_registered_bytes( family: &FontFamily, weight: FontWeight, style: FontStyle, bytes: impl Into<Vec<u8>>, ) -> Result<Self, SoftwareTextFontError>
Parse bytes as a face an app registered under family, declaring
weight and style for it.
The declaration wins over the face’s own OS/2 values, the way a
Compose Font(resId, FontWeight.Medium) entry does, and a variable face
is instanced on its wght/ital axes so one file can back a whole
family. That last part is what makes Android’s sans-serif reachable:
the platform ships a single variable Roboto-Regular.ttf and describes
every weight of the family as an axis position on it.
Sourcepub fn from_registered_bytes_with_variations(
family: &FontFamily,
weight: FontWeight,
style: FontStyle,
bytes: impl Into<Vec<u8>>,
variations: &[([u8; 4], f32)],
) -> Result<Self, SoftwareTextFontError>
pub fn from_registered_bytes_with_variations( family: &FontFamily, weight: FontWeight, style: FontStyle, bytes: impl Into<Vec<u8>>, variations: &[([u8; 4], f32)], ) -> Result<Self, SoftwareTextFontError>
Register a face with explicit OpenType axis coordinates shared by measurement, kerning, and rasterization. Coordinates override the declared weight/style axes; repeated tags use the last value. Unknown, nonfinite, or out-of-range values fail.
pub fn family_names(&self) -> &[String]
Sourcepub fn registered_family(&self) -> Option<FontFamilyKey>
pub fn registered_family(&self) -> Option<FontFamilyKey>
The family an app registered this face under, if any.
pub fn weight(&self) -> FontWeight
pub fn style(&self) -> FontStyle
Sourcepub fn content_hash(&self) -> u64
pub fn content_hash(&self) -> u64
Stable hash of the font binary — cache-key component wherever rasterized output depends on which font served the run.
Trait Implementations§
Source§impl Clone for SoftwareTextFont
impl Clone for SoftwareTextFont
Source§fn clone(&self) -> SoftwareTextFont
fn clone(&self) -> SoftwareTextFont
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more