summaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/context.rs4
-rw-r--r--src/eval/mod.rs4
-rw-r--r--src/eval/state.rs6
3 files changed, 10 insertions, 4 deletions
diff --git a/src/eval/context.rs b/src/eval/context.rs
index 64a8fbbe..1e09aaaf 100644
--- a/src/eval/context.rs
+++ b/src/eval/context.rs
@@ -95,6 +95,7 @@ impl EvalContext {
pub fn start_page_group(&mut self, softness: Softness) {
self.start_group(PageGroup {
size: self.state.page.size,
+ expand: self.state.page.expand,
padding: self.state.page.margins(),
dirs: self.state.dirs,
align: self.state.align,
@@ -124,7 +125,7 @@ impl EvalContext {
child: NodeStack {
dirs: group.dirs,
align: group.align,
- expansion: Gen::uniform(Expansion::Fill),
+ expand: group.expand,
children,
}
.into(),
@@ -281,6 +282,7 @@ pub enum Softness {
#[derive(Debug)]
struct PageGroup {
size: Size,
+ expand: Spec<Expansion>,
padding: Sides<Linear>,
dirs: LayoutDirs,
align: ChildAlign,
diff --git a/src/eval/mod.rs b/src/eval/mod.rs
index 0e6fa79f..9abc1074 100644
--- a/src/eval/mod.rs
+++ b/src/eval/mod.rs
@@ -19,7 +19,7 @@ use std::rc::Rc;
use crate::color::Color;
use crate::diag::Pass;
use crate::env::SharedEnv;
-use crate::geom::{Angle, Gen, Length, Relative};
+use crate::geom::{Angle, Length, Relative, Spec};
use crate::layout::{self, Expansion, NodeSpacing, NodeStack};
use crate::syntax::*;
@@ -137,7 +137,7 @@ impl Eval for Spanned<&NodeRaw> {
ctx.push(NodeStack {
dirs: ctx.state.dirs,
align: ctx.state.align,
- expansion: Gen::uniform(Expansion::Fit),
+ expand: Spec::uniform(Expansion::Fit),
children,
});
diff --git a/src/eval/state.rs b/src/eval/state.rs
index 2a8ee2f0..ce6bd009 100644
--- a/src/eval/state.rs
+++ b/src/eval/state.rs
@@ -4,8 +4,9 @@ use fontdock::{fallback, FallbackTree, FontStretch, FontStyle, FontVariant, Font
use super::Scope;
use crate::geom::{
- Align, ChildAlign, Dir, LayoutDirs, Length, Linear, Relative, Sides, Size,
+ Align, ChildAlign, Dir, LayoutDirs, Length, Linear, Relative, Sides, Size, Spec,
};
+use crate::layout::Expansion;
use crate::paper::{Paper, PaperClass, PAPER_A4};
/// The evaluation state.
@@ -45,6 +46,8 @@ pub struct StatePage {
pub class: PaperClass,
/// The width and height of the page.
pub size: Size,
+ /// Whether the expand the pages to the `size` or to fit the content.
+ pub expand: Spec<Expansion>,
/// The amount of white space in the order [left, top, right, bottom]. If a
/// side is set to `None`, the default for the paper class is used.
pub margins: Sides<Option<Linear>>,
@@ -56,6 +59,7 @@ impl StatePage {
Self {
class: paper.class,
size: paper.size(),
+ expand: Spec::uniform(Expansion::Fill),
margins: Sides::uniform(None),
}
}