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>
impl<'fc> Pattern<'fc>
sourcepub fn new(fc: &Fontconfig) -> Pattern<'_>
pub fn new(fc: &Fontconfig) -> Pattern<'_>
Create a new empty Pattern
.
sourcepub unsafe fn from_pattern(fc: &Fontconfig, pat: *mut FcPattern) -> Pattern<'_>
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.
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 of type String
to this pattern.
See useful keys in the fontconfig reference.
sourcepub fn add_integer(&mut self, name: &CStr, val: c_int)
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.
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.
sourcepub fn as_mut_ptr(&mut self) -> *mut FcPattern
pub fn as_mut_ptr(&mut self) -> *mut FcPattern
Returns an unsafe mutable pointer to the underlying FcPattern
.