diff options
Diffstat (limited to 'src/library/layout')
| -rw-r--r-- | src/library/layout/align.rs | 4 | ||||
| -rw-r--r-- | src/library/layout/columns.rs | 4 | ||||
| -rw-r--r-- | src/library/layout/page.rs | 7 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/library/layout/align.rs b/src/library/layout/align.rs index 699a908c..2a4d039e 100644 --- a/src/library/layout/align.rs +++ b/src/library/layout/align.rs @@ -1,5 +1,5 @@ use crate::library::prelude::*; -use crate::library::text::ParNode; +use crate::library::text::{HorizontalAlign, ParNode}; /// Align a node along the layouting axes. #[derive(Debug, Hash)] @@ -33,7 +33,7 @@ impl Layout for AlignNode { // Align paragraphs inside the child. let mut passed = StyleMap::new(); if let Some(align) = self.aligns.x { - passed.set(ParNode::ALIGN, align); + passed.set(ParNode::ALIGN, HorizontalAlign(align)); } // Layout the child. diff --git a/src/library/layout/columns.rs b/src/library/layout/columns.rs index 3ef66b40..4963043e 100644 --- a/src/library/layout/columns.rs +++ b/src/library/layout/columns.rs @@ -1,5 +1,5 @@ use crate::library::prelude::*; -use crate::library::text::ParNode; +use crate::library::text::TextNode; /// Separate a region into multiple equally sized columns. #[derive(Debug, Hash)] @@ -59,7 +59,7 @@ impl Layout for ColumnsNode { // Layout the children. let mut frames = self.child.layout(ctx, &pod, styles)?.into_iter(); - let dir = styles.get(ParNode::DIR); + let dir = styles.get(TextNode::DIR); let total_regions = (frames.len() as f32 / columns as f32).ceil() as usize; let mut finished = vec![]; diff --git a/src/library/layout/page.rs b/src/library/layout/page.rs index 7aa53b23..13583f09 100644 --- a/src/library/layout/page.rs +++ b/src/library/layout/page.rs @@ -17,6 +17,7 @@ impl PageNode { pub const HEIGHT: Smart<RawLength> = Smart::Custom(Paper::A4.height().into()); /// Whether the page is flipped into landscape orientation. pub const FLIPPED: bool = false; + /// The left margin. pub const LEFT: Smart<Relative<RawLength>> = Smart::Auto; /// The right margin. @@ -25,10 +26,12 @@ impl PageNode { pub const TOP: Smart<Relative<RawLength>> = Smart::Auto; /// The bottom margin. pub const BOTTOM: Smart<Relative<RawLength>> = Smart::Auto; - /// The page's background color. - pub const FILL: Option<Paint> = None; + /// How many columns the page has. pub const COLUMNS: NonZeroUsize = NonZeroUsize::new(1).unwrap(); + /// The page's background color. + pub const FILL: Option<Paint> = None; + /// The page's header. #[property(referenced)] pub const HEADER: Marginal = Marginal::None; |
