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
use crate::bind;
use super::Font;
pub trait MetricExt {
fn height(&self) -> u32;
fn ascent(&self) -> u32;
fn descent(&self) -> u32;
fn line_skip(&self) -> u32;
}
impl MetricExt for Font<'_> {
fn height(&self) -> u32 {
unsafe { bind::TTF_FontHeight(self.ptr.as_ptr()) as _ }
}
fn ascent(&self) -> u32 {
unsafe { bind::TTF_FontAscent(self.ptr.as_ptr()) as _ }
}
fn descent(&self) -> u32 {
unsafe { bind::TTF_FontDescent(self.ptr.as_ptr()) as _ }
}
fn line_skip(&self) -> u32 {
unsafe { bind::TTF_FontLineSkip(self.ptr.as_ptr()) as _ }
}
}