1use crate::geom::{LogicalPosition, LogicalSize};
6
7#[derive(Debug, Default, Copy, Clone, PartialEq, PartialOrd)]
10#[repr(C)]
11pub struct ResolvedOffsets {
12 pub top: f32,
13 pub left: f32,
14 pub right: f32,
15 pub bottom: f32,
16}
17
18impl ResolvedOffsets {
19 pub const fn zero() -> Self {
20 Self {
21 top: 0.0,
22 left: 0.0,
23 right: 0.0,
24 bottom: 0.0,
25 }
26 }
27 #[must_use]
28 pub fn total_vertical(&self) -> f32 {
29 self.top + self.bottom
30 }
31 #[must_use]
32 pub fn total_horizontal(&self) -> f32 {
33 self.left + self.right
34 }
35}
36
37type GlyphIndex = u32;
39
40#[derive(Debug, Default, Copy, Clone, PartialEq, PartialOrd)]
42pub struct GlyphInstance {
43 pub index: GlyphIndex,
44 pub point: LogicalPosition,
45 pub size: LogicalSize,
46}
47
48impl GlyphInstance {
49 pub fn scale_for_dpi(&mut self, scale_factor: f32) {
50 self.point.scale_for_dpi(scale_factor);
51 self.size.scale_for_dpi(scale_factor);
52 }
53}