#[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>
impl<'fc> Pattern<'fc>
Sourcepub fn new(fc: &Fontconfig) -> Pattern<'_>
pub fn new(fc: &Fontconfig) -> Pattern<'_>
Create a new Pattern
.
Sourcepub fn from_pattern(fc: &Fontconfig, pat: *mut FcPattern) -> Pattern<'_>
pub fn from_pattern(fc: &Fontconfig, pat: *mut FcPattern) -> Pattern<'_>
Create a Pattern
from a raw fontconfig FcPattern pointer. The pattern is referenced.
Sourcepub fn add_string(&mut self, name: &CStr, val: &CStr)
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.
Sourcepub fn get_string<'a>(&'a self, name: &'a CStr) -> Option<&'a str>
pub fn get_string<'a>(&'a self, name: &'a CStr) -> Option<&'a str>
Get string the value for a key from this pattern.
Sourcepub fn get_int(&self, name: &CStr) -> Option<i32>
pub fn get_int(&self, name: &CStr) -> Option<i32>
Get the integer value for a key from this pattern.
Sourcepub fn font_match(&mut self) -> Pattern<'_>
pub fn font_match(&mut self) -> Pattern<'_>
Get the best available match for this pattern, returned as a new pattern.
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 format(&self) -> Result<FontFormat, UnknownFontFormat>
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.