use k2f_core::Pt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MathStyle {
Display,
Text,
Script,
ScriptScript,
}
impl MathStyle {
pub fn scale(self, base: Pt) -> Pt {
match self {
MathStyle::Display | MathStyle::Text => base,
MathStyle::Script => Pt(base.0 * 7 / 10),
MathStyle::ScriptScript => Pt(base.0 * 5 / 10),
}
}
pub fn script(self) -> MathStyle {
match self {
MathStyle::Display | MathStyle::Text => MathStyle::Script,
MathStyle::Script | MathStyle::ScriptScript => MathStyle::ScriptScript,
}
}
pub fn is_display(self) -> bool {
matches!(self, MathStyle::Display)
}
}