use ratex_font::{get_global_metrics, MathConstants};
use ratex_types::color::Color;
use ratex_types::math_style::MathStyle;
#[derive(Debug, Clone)]
pub struct LayoutOptions {
pub style: MathStyle,
pub color: Color,
pub align_relation_spacing: Option<f64>,
pub leftright_delim_height: Option<f64>,
}
impl Default for LayoutOptions {
fn default() -> Self {
Self {
style: MathStyle::Display,
color: Color::BLACK,
align_relation_spacing: None,
leftright_delim_height: None,
}
}
}
impl LayoutOptions {
pub fn metrics(&self) -> &'static MathConstants {
get_global_metrics(self.style.size_index())
}
pub fn size_multiplier(&self) -> f64 {
self.style.size_multiplier()
}
pub fn with_style(&self, style: MathStyle) -> Self {
Self {
style,
color: self.color,
align_relation_spacing: self.align_relation_spacing,
leftright_delim_height: self.leftright_delim_height,
}
}
pub fn with_color(&self, color: Color) -> Self {
Self {
style: self.style,
color,
align_relation_spacing: self.align_relation_spacing,
leftright_delim_height: self.leftright_delim_height,
}
}
}