improve the Pattern::add_string ergonomics
juhp opened this issue · comments
I feel it would be nice to hide the CStr
's from the API here:
pub fn add_string(&mut self, name: &CStr, val: &CStr)
and have a type for the different kinds of key values,
which could then be safely converted internally to an FcPattern.
I am imagining a safe type something like
pub enum PatternKeyValue =
Family: &str,
Style: &str,
:
Lang: &str,
Charset: u32,
:
Variable: bool;
:
Any thoughts?
Sounds reasonable. Like a more general version of find
, which takes care of the c strings if you're only matching on family and style:
fontconfig-rs/fontconfig/src/lib.rs
Line 142 in da4c674