summaryrefslogtreecommitdiff
path: root/src/exec/context.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-29 13:21:25 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-29 13:28:19 +0200
commit2c6127dea611944abb09a0d38375ad7cf9baced0 (patch)
tree6572d169d4ce26edc38a880860ebae2f49639fb8 /src/exec/context.rs
parent7d15dc634b3be1b6e284bb6b2450e3736d3e6e8d (diff)
Refactor state
Diffstat (limited to 'src/exec/context.rs')
-rw-r--r--src/exec/context.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/exec/context.rs b/src/exec/context.rs
index 3a3eb702..4d351692 100644
--- a/src/exec/context.rs
+++ b/src/exec/context.rs
@@ -3,13 +3,13 @@ use std::rc::Rc;
use super::{Exec, ExecWithMap, State};
use crate::diag::{Diag, DiagSet, Pass};
-use crate::util::EcoString;
use crate::eval::{ExprMap, Template};
use crate::geom::{Align, Dir, Gen, GenAxis, Length, Linear, Sides, Size};
use crate::layout::{
LayoutNode, LayoutTree, PadNode, PageRun, ParChild, ParNode, StackChild, StackNode,
};
use crate::syntax::{Span, SyntaxTree};
+use crate::util::EcoString;
use crate::Context;
/// The context for execution.
@@ -76,10 +76,10 @@ impl ExecContext {
/// Push text, but in monospace.
pub fn push_monospace_text(&mut self, text: impl Into<EcoString>) {
- let prev = Rc::clone(&self.state.text);
- self.state.text_mut().monospace = true;
+ let prev = Rc::clone(&self.state.font);
+ self.state.font_mut().monospace = true;
self.push_text(text);
- self.state.text = prev;
+ self.state.font = prev;
}
/// Push a word space into the active paragraph.
@@ -121,7 +121,7 @@ impl ExecContext {
/// Apply a forced paragraph break.
pub fn parbreak(&mut self) {
- let amount = self.state.text.par_spacing();
+ let amount = self.state.par_spacing();
self.stack.finish_par(&self.state);
self.stack.push_soft(StackChild::Spacing(amount));
}
@@ -148,7 +148,7 @@ impl ExecContext {
ParChild::Text(
text.into(),
self.state.aligns.cross,
- Rc::clone(&self.state.text),
+ Rc::clone(&self.state.font),
)
}
}
@@ -187,7 +187,7 @@ struct StackBuilder {
impl StackBuilder {
fn new(state: &State) -> Self {
Self {
- dirs: Gen::new(state.dir, Dir::TTB),
+ dirs: state.dirs,
children: vec![],
last: Last::None,
par: ParBuilder::new(state),
@@ -237,8 +237,8 @@ impl ParBuilder {
fn new(state: &State) -> Self {
Self {
aligns: state.aligns,
- dir: state.dir,
- line_spacing: state.text.line_spacing(),
+ dir: state.dirs.cross,
+ line_spacing: state.line_spacing(),
children: vec![],
last: Last::None,
}