pub struct FontConfig { /* private fields */ }Expand description
Maps font family names to font file paths.
Font names are stored in lowercase for case-insensitive lookup.
Implementations§
Source§impl FontConfig
impl FontConfig
Sourcepub fn add_mapping(&mut self, name: &str, path: PathBuf)
pub fn add_mapping(&mut self, name: &str, path: PathBuf)
Add a font mapping: name (case-insensitive) → path.
Sourcepub fn find_font(&self, family: &str) -> Option<&PathBuf>
pub fn find_font(&self, family: &str) -> Option<&PathBuf>
Look up a font file path by family name (case-insensitive).
Returns None if no mapping exists for family.
Sourcepub fn with_system_fonts() -> Self
pub fn with_system_fonts() -> Self
Build a FontConfig by scanning standard system font directories
and registering every TTF/OTF file found there.
Font names are extracted from the font file metadata using ttf-parser.
If a file cannot be parsed its name is derived from the file stem instead.
Trait Implementations§
Source§impl Debug for FontConfig
impl Debug for FontConfig
Source§impl Default for FontConfig
impl Default for FontConfig
Source§fn default() -> FontConfig
fn default() -> FontConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FontConfig
impl RefUnwindSafe for FontConfig
impl Send for FontConfig
impl Sync for FontConfig
impl Unpin for FontConfig
impl UnsafeUnpin for FontConfig
impl UnwindSafe for FontConfig
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> 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<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().