font_loader::system_fonts

Function query_specific

Source
pub fn query_specific(property: &mut FontProperty) -> Vec<String>
Expand description

Query the names of specifc fonts installed in the system Note that only truetype fonts are supported

Examples found in repository?
examples/list-fonts.rs (line 31)
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
fn main() {
	// Enumerate all fonts
    let sysfonts = system_fonts::query_all();
    for string in &sysfonts {
        println!("{}", string);
    }

	let mut property = system_fonts::FontPropertyBuilder::new().monospace().build();
	let sysfonts = system_fonts::query_specific(&mut property);
	for string in &sysfonts {
		println!("Monospaced font: {}", string);
	}

	let property = system_fonts::FontPropertyBuilder::new().family("Arial").build();
	let (font, _) = system_fonts::get(&property).unwrap();
	println!("{:?}", &font[..50]);
}