Struct Pattern

Source
#[repr(C)]
pub struct Pattern<'fc> { pub pat: *mut FcPattern, /* private fields */ }
Expand description

A safe wrapper around fontconfig’s FcPattern.

Fields§

§pat: *mut FcPattern

Raw pointer to FcPattern

Implementations§

Source§

impl<'fc> Pattern<'fc>

Source

pub fn new(fc: &Fontconfig) -> Pattern<'_>

Create a new Pattern.

Source

pub fn from_pattern(fc: &Fontconfig, pat: *mut FcPattern) -> Pattern<'_>

Create a Pattern from a raw fontconfig FcPattern pointer. The pattern is referenced.

Source

pub fn add_string(&mut self, name: &CStr, val: &CStr)

Add a key-value pair to this pattern.

See useful keys in the fontconfig reference.

Source

pub fn get_string<'a>(&'a self, name: &'a CStr) -> Option<&'a str>

Get string the value for a key from this pattern.

Source

pub fn get_int(&self, name: &CStr) -> Option<i32>

Get the integer value for a key from this pattern.

Source

pub fn print(&self)

Print this pattern to stdout with all its values.

Source

pub fn font_match(&mut self) -> Pattern<'_>

Get the best available match for this pattern, returned as a new pattern.

Source

pub fn name(&self) -> Option<&str>

Get the “fullname” (human-readable name) of this pattern.

Source

pub fn filename(&self) -> Option<&str>

Get the “file” (path on the filesystem) of this font pattern.

Source

pub fn face_index(&self) -> Option<i32>

Get the “index” (The index of the font within the file) of this pattern.

Source

pub fn slant(&self) -> Option<i32>

Get the “slant” (Italic, oblique or roman) of this pattern.

Source

pub fn weight(&self) -> Option<i32>

Get the “weight” (Light, medium, demibold, bold or black) of this pattern.

Source

pub fn width(&self) -> Option<i32>

Get the “width” (Condensed, normal or expanded) of this pattern.

Source

pub fn format(&self) -> Result<FontFormat, UnknownFontFormat>

Get the “fontformat” (“TrueType” “Type 1” “BDF” “PCF” “Type 42” “CID Type 1” “CFF” “PFR” “Windows FNT”) of this pattern.

Trait Implementations§

Source§

impl<'fc> Clone for Pattern<'fc>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'fc> Debug for Pattern<'fc>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'fc> Drop for Pattern<'fc>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'fc> Freeze for Pattern<'fc>

§

impl<'fc> RefUnwindSafe for Pattern<'fc>

§

impl<'fc> !Send for Pattern<'fc>

§

impl<'fc> !Sync for Pattern<'fc>

§

impl<'fc> Unpin for Pattern<'fc>

§

impl<'fc> UnwindSafe for Pattern<'fc>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.