FontConfig

Struct FontConfig 

Source
pub struct FontConfig { /* private fields */ }
Expand description

Handle obtained after Fontconfig has been initialised.

Implementations§

Source§

impl FontConfig

Source

pub fn substitute(&mut self, pat: &mut Pattern, kind: MatchKind)

Create a configuration Set configuration as default.

Sets the current default configuration to config. Implicitly calls FcConfigBuildFonts if necessary, and FcConfigReference() to inrease the reference count in config since 2.12.0, returning FcFalse if that call fails. Execute substitutions

Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns false if the substitution cannot be performed (due to allocation failure). Otherwise returns true.

Source

pub fn fontset_match( &mut self, sets: &mut [FontSet<'_>], pat: &mut Pattern, ) -> OwnedPattern

Return the best font from a set of font sets

Finds the font in sets most closely matching pattern and returns the result of FcFontRenderPrepare for that font and the provided pattern. This function should be called only after FcConfigSubstitute and FcDefaultSubstitute have been called for pattern; otherwise the results will not be correct. If config is NULL, the current configuration is used. Returns NULL if an error occurs during this process.

Source

pub fn find(&mut self, family: String, style: Option<String>) -> Option<Font>

Find a font of the given family (e.g. Dejavu Sans, FreeSerif), optionally filtering by style. Both fields are case-insensitive.

Trait Implementations§

Source§

impl Default for FontConfig

Source§

fn default() -> Self

Initialise fontconfig and returns the default config.

PANIC : If fontconfig fails to initialise

Source§

impl Drop for FontConfig

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.