1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
use crate::x11api::{XDisplay, query_xrdb};
pub struct Xft {
pub dpi: Option<i32>,
}
impl Xft {
pub fn new() -> Self {
let display = XDisplay::new()
.expect("Failed to acquire X display!");
let dpi = query_xrdb(*display, "Xft", "dpi")
.and_then(|s| s.parse::<i32>().ok());
Xft { dpi, }
}
}
#[derive(Clone, Debug)]
pub struct FontName {
pub family: String,
pub style: String,
pub slant: Slant,
pub weight: Weight,
pub size: f64,
pub pixelsize: f64,
pub encoding: String,
pub spacing: Spacing,
pub foundry: String,
pub core: bool,
pub antialias: bool,
pub xlfd: String,
pub file: String,
pub index: i32,
pub rasterizer: String,
pub outline: bool,
pub scalable: bool,
pub rgba: Rgba,
pub scale: f64,
pub render: bool,
pub minspace: bool,
}
#[derive(Copy, Clone, Debug)]
pub enum Weight {
Light,
Medium,
Demibold,
Bold,
Black,
}
#[derive(Copy, Clone, Debug)]
pub enum Slant {
Roman,
Italic,
Oblique,
}
#[derive(Copy, Clone, Debug)]
pub enum Spacing {
Proportional,
Mono,
Charcell,
}
#[derive(Copy, Clone, Debug)]
pub enum Rgba {
Rgb,
Bgr,
Vrgb,
Vbgr,
}