pub struct OwnedPattern { /* private fields */ }Expand description
A type representing an owned fontconfig’s sys::FcPattern.
Implementations§
Source§impl OwnedPattern
impl OwnedPattern
Sourcepub fn new() -> OwnedPattern
pub fn new() -> OwnedPattern
Create a new empty OwnedPattern.
Methods from Deref<Target = Pattern>§
Sourcepub fn filter(&self, os: Option<&mut ObjectSet>) -> Option<OwnedPattern>
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.
Sourcepub fn format(&self, fmt: &CStr) -> Option<FcStr>
pub fn format(&self, fmt: &CStr) -> Option<FcStr>
Format a pattern into a string according to a format specifier
See: pattern-format
Sourcepub fn default_substitute(&mut self)
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).
Sourcepub fn font_match(&mut self, config: &mut FontConfig) -> OwnedPattern
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.
Sourcepub fn font_list(
&self,
config: &mut FontConfig,
os: Option<&mut ObjectSet>,
) -> FontSet<'_>
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.
Sourcepub fn font_sort(
&mut self,
config: &mut FontConfig,
trim: bool,
) -> Result<FontSet<'static>, Error>
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.
Sourcepub fn font_sort_with_charset(
&mut self,
config: &mut FontConfig,
trim: bool,
) -> Option<(FontSet<'_>, OwnedCharSet)>
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.
Sourcepub fn render_prepare(
&mut self,
config: &mut FontConfig,
font: &mut Self,
) -> OwnedPattern
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.
Sourcepub fn filename(&self) -> Option<&str>
pub fn filename(&self) -> Option<&str>
Get the “file” (path on the filesystem) of this font pattern.
Sourcepub fn face_index(&self) -> Option<i32>
pub fn face_index(&self) -> Option<i32>
Get the “index” (The index of the font within the file) of this pattern.
Sourcepub fn weight(&self) -> Option<i32>
pub fn weight(&self) -> Option<i32>
Get the “weight” (Light, medium, demibold, bold or black) of this pattern.
Sourcepub fn width(&self) -> Option<i32>
pub fn width(&self) -> Option<i32>
Get the “width” (Condensed, normal or expanded) of this pattern.
Sourcepub fn fontformat(&self) -> Result<FontFormat, Error>
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.