use super::fonts::FaceId;
use crate::word::fmt::model::Rgb;
#[derive(Debug, Clone, Default)]
pub struct Page {
pub width: f32,
pub height: f32,
pub items: Vec<Item>,
}
#[derive(Debug, Clone)]
pub enum Item {
Text(TextRun),
Rect {
x: f32,
y: f32,
width: f32,
height: f32,
color: Rgb,
},
Line {
x1: f32,
y1: f32,
x2: f32,
y2: f32,
width: f32,
color: Rgb,
dash: Option<f32>,
},
Image {
index: usize,
x: f32,
y: f32,
width: f32,
height: f32,
crop: [f32; 4],
},
Link {
x: f32,
y: f32,
width: f32,
height: f32,
target: String,
},
}
#[derive(Debug, Clone)]
pub struct TextRun {
pub face: FaceId,
pub size: f32,
pub x: f32,
pub y: f32,
pub color: Rgb,
pub glyphs: Vec<Glyph>,
pub text: String,
pub fake_bold: bool,
pub fake_italic: bool,
pub scale: f32,
}
#[derive(Debug, Clone, Copy)]
pub struct Glyph {
pub id: u16,
pub x: f32,
pub advance: f32,
pub dx: f32,
pub dy: f32,
pub text: (usize, usize),
}
#[derive(Debug, Clone)]
pub struct Destination {
pub name: String,
pub page: usize,
pub y: f32,
}