Struct fontconfig::Pattern

source ·
#[repr(C)]
pub struct Pattern<'fc> { /* private fields */ }
Expand description

A safe wrapper around fontconfig’s FcPattern.

Implementations§

source§

impl<'fc> Pattern<'fc>

source

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

Create a new empty Pattern.

source

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

Create a Pattern from a raw fontconfig FcPattern pointer.

The pattern is referenced.

Safety: The pattern pointer must be valid/non-null.

source

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

Add a key-value pair of type String to this pattern.

See useful keys in the fontconfig reference.

source

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

Add a key-value pair of type Int 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.

source

pub fn as_ptr(&self) -> *const FcPattern

Returns a raw pointer to underlying FcPattern.

source

pub fn as_mut_ptr(&mut self) -> *mut FcPattern

Returns an unsafe mutable pointer to the underlying FcPattern.

source§

impl Pattern<'_>

source

pub fn lang_set(&self) -> Option<StrList<'_>>

Get the languages set of this pattern.

Trait Implementations§

source§

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

source§

fn clone(&self) -> Self

Returns a copy 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> 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> 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,

§

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>,

§

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>,

§

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.