From 76fc4cca62f5b955200b2c62cc85b69eea491ece Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 25 Mar 2021 21:32:33 +0100 Subject: =?UTF-8?q?Refactor=20alignments=20&=20directions=20=F0=9F=93=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adds lang function - Refactors execution context - Adds StackChild and ParChild enums --- src/exec/state.rs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/exec/state.rs') 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, } 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 { -- cgit v1.2.3