use nalgebra_glm::Vec4;
#[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum TextAlignment {
Left,
Center,
Right,
}
#[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum VerticalAlignment {
Top,
Middle,
Bottom,
Baseline,
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct TextProperties {
pub font_size: f32,
pub color: Vec4,
pub alignment: TextAlignment,
pub vertical_alignment: VerticalAlignment,
pub line_height: f32,
pub letter_spacing: f32,
pub outline_width: f32,
pub outline_color: Vec4,
pub smoothing: f32,
pub monospace_width: Option<f32>,
pub anchor_character: Option<usize>,
}
impl Default for TextProperties {
fn default() -> Self {
Self {
font_size: 16.0,
color: Vec4::new(1.0, 1.0, 1.0, 1.0),
alignment: TextAlignment::Left,
vertical_alignment: VerticalAlignment::Baseline,
line_height: 1.2,
letter_spacing: 0.0,
outline_width: 0.0,
outline_color: Vec4::new(0.0, 0.0, 0.0, 1.0),
smoothing: 0.003,
monospace_width: None,
anchor_character: None,
}
}
}