getfont/
getfont.rs

1use rust_fontconfig::{FcFontCache, FcPattern};
2use std::time::Instant;
3
4fn main() {
5    let start = Instant::now();
6    let cache = FcFontCache::build();
7    let end = Instant::now();
8
9    println!("cache list: found {} fonts", cache.list().len());
10
11    let start2 = Instant::now();
12    let results = cache.query(
13        &FcPattern {
14            name: Some(String::from("Gilroy")),
15            ..Default::default()
16        },
17        &mut Vec::new(),
18    );
19    let end2 = Instant::now();
20
21    println!("built cache in: {:?}", end - start);
22    println!("queried in {:?}", end2 - start2);
23}