We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a46ac39 commit f08b655Copy full SHA for f08b655
src/text/font.rs
@@ -36,6 +36,8 @@ pub struct FontMetrics {
36
bold: bool,
37
oblique: bool,
38
variable: bool,
39
+ weight: u16,
40
+ width: u16,
41
}
42
43
impl FontMetrics {
@@ -78,6 +80,14 @@ impl FontMetrics {
78
80
pub fn variable(&self) -> bool {
79
81
self.variable
82
83
+
84
+ pub fn weight(&self) -> u16 {
85
+ self.weight
86
+ }
87
88
+ pub fn width(&self) -> u16 {
89
+ self.width
90
91
92
93
pub(crate) struct Font {
@@ -103,6 +113,8 @@ impl Font {
103
113
bold: ttf_font.is_bold(),
104
114
oblique: ttf_font.is_oblique(),
105
115
variable: ttf_font.is_variable(),
116
+ weight: ttf_font.width().to_number(),
117
+ width: ttf_font.weight().to_number(),
106
118
};
107
119
108
120
Ok(Self {
0 commit comments