OwnedPattern

Struct OwnedPattern 

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

A type representing an owned fontconfig’s sys::FcPattern.

Implementations§

Source§

impl OwnedPattern

Source

pub fn new() -> OwnedPattern

Create a new empty OwnedPattern.

Methods from Deref<Target = Pattern>§

Source

pub fn del(&mut self, name: &CStr) -> bool

Delete a property from a pattern

Source

pub fn print(&self)

Print this pattern to stdout with all its values.

Source

pub fn filter(&self, os: Option<&mut ObjectSet>) -> Option<OwnedPattern>

Filter the objects of pattern

Returns a new pattern that only has those objects from self that are in os. If os is None, a duplicate of self is returned.

Source

pub fn format(&self, fmt: &CStr) -> Option<FcStr>

Format a pattern into a string according to a format specifier

See: pattern-format

Source

pub fn default_substitute(&mut self)

Perform default substitutions in a pattern

Supplies default values for underspecified font patterns:

  • Patterns without a specified style or weight are set to Medium
  • Patterns without a specified style or slant are set to Roman
  • Patterns without a specified pixel size are given one computed from any specified point size (default 12), dpi (default 75) and scale (default 1).
Source

pub fn font_match(&mut self, config: &mut FontConfig) -> OwnedPattern

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

Finds the font in sets most closely matching pattern and returns the result of Pattern::render_prepare for that font and the provided pattern.
This function should be called only after FontConfig::substitute and Pattern::default_substitute have been called for the pattern.
otherwise the results will not be correct.

Source

pub fn font_list( &self, config: &mut FontConfig, os: Option<&mut ObjectSet>, ) -> FontSet<'_>

List fonts

Selects fonts matching self, creates patterns from those fonts containing only the objects in os and returns the set of unique such patterns.

Source

pub fn font_sort( &mut self, config: &mut FontConfig, trim: bool, ) -> Result<FontSet<'static>, Error>

Get the list of fonts sorted by closeness to self.

If trim is true, elements in the list which don’t include Unicode coverage not provided by earlier elements in the list are elided.
This function should be called only after FontConfig::substitute and Pattern::default_substitute have been called for this pattern;
otherwise the results will not be correct.

Source

pub fn font_sort_with_charset( &mut self, config: &mut FontConfig, trim: bool, ) -> Option<(FontSet<'_>, OwnedCharSet)>

Get the list of fonts sorted by closeness to self.

If trim is true, elements in the list which don’t include Unicode coverage not provided by earlier elements in the list are elided.
The union of Unicode coverage of all of the fonts is returned in CharSet.
This function should be called only after FontConfig::substitute and Pattern::default_substitute have been called for this pattern;
otherwise the results will not be correct.

Source

pub fn render_prepare( &mut self, config: &mut FontConfig, font: &mut Self, ) -> OwnedPattern

Prepare pattern for loading font file.

Creates a new pattern consisting of elements of font not appearing in pat, elements of pat not appearing in font and the best matching value from pat for elements appearing in both.
The result is passed to [FontConfig::substitute_with_pat] with kind crate::MatchKind::Font and then returned.

Source

pub fn charset(&self) -> Option<&CharSet>

Get character map

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 fontformat(&self) -> Result<FontFormat, Error>

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

Source

pub fn hash(&self) -> u32

Source

pub fn lang_set(&self) -> Option<LangSet>

Get the languages set of this pattern.

Source

pub fn matrix(&mut self) -> Option<&Matrix>

Get the matrix from this pattern.

Source

pub fn get<'a, 'pat, V>( &'pat self, name: &'a Property<'pat, V>, index: usize, ) -> Option<V::Returns>
where V: PropertyType<'pat>,

Source

pub fn add<'a, 'pat, V>( &'pat mut self, name: &'a Property<'pat, V>, value: V, ) -> bool
where V: PropertyType<'pat>,

Trait Implementations§

Source§

impl AsMut<Pattern> for OwnedPattern

Source§

fn as_mut(&mut self) -> &mut Pattern

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<Pattern> for OwnedPattern

Source§

fn as_ref(&self) -> &Pattern

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<Pattern> for OwnedPattern

Source§

fn borrow(&self) -> &Pattern

Immutably borrows from an owned value. Read more
Source§

impl BorrowMut<Pattern> for OwnedPattern

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl Clone for OwnedPattern

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 Default for OwnedPattern

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for OwnedPattern

Source§

type Target = Pattern

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for OwnedPattern

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for OwnedPattern

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FromStr for OwnedPattern

Source§

fn from_str(s: &str) -> Result<Self, Error>

Converts name from the standard text format described above into a pattern.

Source§

type Err = Error

The associated error which can be returned from parsing.

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.