diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
| commit | 76fc4cca62f5b955200b2c62cc85b69eea491ece (patch) | |
| tree | 5b8492268c996cf23b13e26c7a4356fbd156286d /src/exec/state.rs | |
| parent | e8057a53856dc09594c9e5861f1cd328531616e0 (diff) | |
Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
Diffstat (limited to 'src/exec/state.rs')
| -rw-r--r-- | src/exec/state.rs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/exec/state.rs b/src/exec/state.rs index 7957f312..c579bc4e 100644 --- a/src/exec/state.rs +++ b/src/exec/state.rs @@ -12,30 +12,43 @@ use crate::paper::{Paper, PaperClass, PAPER_A4}; /// The evaluation state. #[derive(Debug, Clone, PartialEq)] pub struct State { - /// The current directions along which layouts are placed in their parents. - pub dirs: LayoutDirs, - /// The current alignments of layouts in their parents. - pub aligns: LayoutAligns, + /// The current language-related settings. + pub lang: LangState, /// The current page settings. pub page: PageState, /// The current paragraph settings. pub par: ParState, /// The current font settings. pub font: FontState, + /// The current alignments of layouts in their parents. + pub aligns: Gen<Align>, } impl Default for State { fn default() -> Self { Self { - dirs: LayoutDirs::new(Dir::TTB, Dir::LTR), - aligns: LayoutAligns::new(Align::Start, Align::Start), + lang: LangState::default(), page: PageState::default(), par: ParState::default(), font: FontState::default(), + aligns: Gen::new(Align::Start, Align::Start), } } } +/// Defines language properties. +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct LangState { + /// The direction for text and other inline objects. + pub dir: Dir, +} + +impl Default for LangState { + fn default() -> Self { + Self { dir: Dir::LTR } + } +} + /// Defines page properties. #[derive(Debug, Copy, Clone, PartialEq)] pub struct PageState { |
