1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use rusttype::PositionedGlyph;

use crate::geometry::{Orientation, Rectangle};

#[derive(Clone, Debug)]
pub struct GlyphData<'font> {
    pub width: u32,
    pub height: u32,
    pub glyphs: Vec<PositionedGlyph<'font>>,
}

impl<'font> GlyphData<'font> {
    pub fn bounding_box(&self, orientation: &Orientation) -> Rectangle {
        match orientation {
            Orientation::Horizontal => Rectangle::new(0, 0, self.width, self.height),
            Orientation::Vertical => Rectangle::new(0, 0, self.height, self.width),
        }
    }
}