pub struct SoftwareTextFontSet { /* private fields */ }Expand description
The faces that text resolves against, with the choice of the default face.
Implementations§
Source§impl SoftwareTextFontSet
impl SoftwareTextFontSet
Sourcepub fn from_font(font: SoftwareTextFont) -> Self
pub fn from_font(font: SoftwareTextFont) -> Self
A set holding only font.
Sourcepub fn from_faces(fonts: Vec<SoftwareTextFont>) -> Self
pub fn from_faces(fonts: Vec<SoftwareTextFont>) -> Self
Build a set from already-parsed faces, keeping the default-face choice and the registered-family index in one place.
Sourcepub fn with_installed_faces(&self) -> Option<Self>
pub fn with_installed_faces(&self) -> Option<Self>
This set with the faces installed through
install_font_file after
its own, or None while no face was installed since it was built.
Installed faces only join the end, so every face keeps its index and a style resolves to the face it resolved to before; the installed faces cover the characters the set’s own faces lack.
Sourcepub fn from_fonts_or_default(fonts: &[&'static [u8]]) -> Self
pub fn from_fonts_or_default(fonts: &[&'static [u8]]) -> Self
Parses each of fonts and keeps those that parse. When none parses, the set holds the
embedded default font if the build has it, and is empty otherwise.
Sourcepub fn default_font(&self) -> Option<&SoftwareTextFont>
pub fn default_font(&self) -> Option<&SoftwareTextFont>
The face that serves text with no family preference, or None for an empty set.
Sourcepub fn faces(&self) -> &[SoftwareTextFont]
pub fn faces(&self) -> &[SoftwareTextFont]
Every face in the set, in registration order.
Sourcepub fn has_registered_family(&self, family: &FontFamily) -> bool
pub fn has_registered_family(&self, family: &FontFamily) -> bool
Whether any face in the set was registered under family.
Sourcepub fn resolve(&self, style: &TextStyle) -> Option<&SoftwareTextFont>
pub fn resolve(&self, style: &TextStyle) -> Option<&SoftwareTextFont>
Resolves the family and style, then uses Compose’s directional CSS weight matching: lighter first below 400, heavier first above 500, and weights up to 500 before lighter or heavier alternatives in the 400–500 interval.