Rename the crate, binary, core crate, font families, env vars, and internal commands from texcraft/tex-engine to texrra. Serve the separately versioned texrra-web frontend from TEXRRA_WEB_DIR, ../web, or ./web instead of embedding index.html. Add starred section heading support and an arXiv template conformance fixture.
78 lines
1.9 KiB
Rust
78 lines
1.9 KiB
Rust
use common::{Glue, GlueOrder, Scaled};
|
|
|
|
/// TeX glue with stretch and shrink orders stored as engine values.
|
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
|
pub struct TeXGlue {
|
|
pub width: Scaled,
|
|
pub stretch: Scaled,
|
|
pub stretch_order: TeXGlueOrder,
|
|
pub shrink: Scaled,
|
|
pub shrink_order: TeXGlueOrder,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
|
pub enum TeXGlueOrder {
|
|
#[default]
|
|
Normal,
|
|
Fil,
|
|
Fill,
|
|
Filll,
|
|
}
|
|
|
|
impl TeXGlueOrder {
|
|
pub const fn index(self) -> usize {
|
|
match self {
|
|
Self::Normal => 0,
|
|
Self::Fil => 1,
|
|
Self::Fill => 2,
|
|
Self::Filll => 3,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<Glue> for TeXGlue {
|
|
fn from(glue: Glue) -> Self {
|
|
Self {
|
|
width: glue.width,
|
|
stretch: glue.stretch,
|
|
stretch_order: glue.stretch_order.into(),
|
|
shrink: glue.shrink,
|
|
shrink_order: glue.shrink_order.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<TeXGlue> for Glue {
|
|
fn from(glue: TeXGlue) -> Self {
|
|
Self {
|
|
width: glue.width,
|
|
stretch: glue.stretch,
|
|
stretch_order: glue.stretch_order.into(),
|
|
shrink: glue.shrink,
|
|
shrink_order: glue.shrink_order.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<GlueOrder> for TeXGlueOrder {
|
|
fn from(order: GlueOrder) -> Self {
|
|
match order {
|
|
GlueOrder::Normal => Self::Normal,
|
|
GlueOrder::Fil => Self::Fil,
|
|
GlueOrder::Fill => Self::Fill,
|
|
GlueOrder::Filll => Self::Filll,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<TeXGlueOrder> for GlueOrder {
|
|
fn from(order: TeXGlueOrder) -> Self {
|
|
match order {
|
|
TeXGlueOrder::Normal => Self::Normal,
|
|
TeXGlueOrder::Fil => Self::Fil,
|
|
TeXGlueOrder::Fill => Self::Fill,
|
|
TeXGlueOrder::Filll => Self::Filll,
|
|
}
|
|
}
|
|
}
|