Skip to content

Commit f08b655

Browse files
committed
Revert "Remove unused fields from FontMetrics"
This reverts commit a46ac39. Those functions were part of the public API, restored.
1 parent a46ac39 commit f08b655

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/text/font.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub struct FontMetrics {
3636
bold: bool,
3737
oblique: bool,
3838
variable: bool,
39+
weight: u16,
40+
width: u16,
3941
}
4042

4143
impl FontMetrics {
@@ -78,6 +80,14 @@ impl FontMetrics {
7880
pub fn variable(&self) -> bool {
7981
self.variable
8082
}
83+
84+
pub fn weight(&self) -> u16 {
85+
self.weight
86+
}
87+
88+
pub fn width(&self) -> u16 {
89+
self.width
90+
}
8191
}
8292

8393
pub(crate) struct Font {
@@ -103,6 +113,8 @@ impl Font {
103113
bold: ttf_font.is_bold(),
104114
oblique: ttf_font.is_oblique(),
105115
variable: ttf_font.is_variable(),
116+
weight: ttf_font.width().to_number(),
117+
width: ttf_font.weight().to_number(),
106118
};
107119

108120
Ok(Self {

0 commit comments

Comments
 (0)