diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-12-09 13:42:52 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-12-09 13:42:52 +0100 |
| commit | fe21c4d399d291e75165b664762f0aa8bdc4724a (patch) | |
| tree | a3ec954df6e66f6504f4416b37600cedf95dd7e1 /src/library/flow.rs | |
| parent | 40b87d4066fe85cb3fde6cf84cd60d748273ae25 (diff) | |
Set Rules Episode III: Revenge of the packer
Diffstat (limited to 'src/library/flow.rs')
| -rw-r--r-- | src/library/flow.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/library/flow.rs b/src/library/flow.rs index dddd38a4..41760e51 100644 --- a/src/library/flow.rs +++ b/src/library/flow.rs @@ -1,7 +1,7 @@ use std::fmt::{self, Debug, Formatter}; use super::prelude::*; -use super::{AlignNode, PlacedNode, Spacing}; +use super::{AlignNode, ParNode, PlacedNode, Spacing}; /// `flow`: A vertical flow of paragraphs and other layout nodes. pub fn flow(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { @@ -158,6 +158,13 @@ impl<'a> FlowLayouter<'a> { /// Layout a node. fn layout_node(&mut self, ctx: &mut LayoutContext, node: &PackedNode) { + // Add paragraph spacing. + // TODO(set): Handle edge cases. + if !self.items.is_empty() { + let spacing = node.styles.chain(&ctx.styles).get(ParNode::SPACING); + self.layout_absolute(spacing.into()); + } + if let Some(placed) = node.downcast::<PlacedNode>() { let frame = node.layout(ctx, &self.regions).remove(0); if placed.out_of_flow() { |
