From bf59c08a0a601eeac4354c505cab15e65601c8e8 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 12 Nov 2022 23:25:54 +0100 Subject: New interaction model --- library/src/structure/heading.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'library/src/structure') diff --git a/library/src/structure/heading.rs b/library/src/structure/heading.rs index 87b522f7..e069e3a9 100644 --- a/library/src/structure/heading.rs +++ b/library/src/structure/heading.rs @@ -50,20 +50,21 @@ impl Finalize for HeadingNode { _: StyleChain, realized: Content, ) -> SourceResult { - let size = Em::new(match self.level.get() { + let scale = match self.level.get() { 1 => 1.4, 2 => 1.2, _ => 1.0, - }); + }; - let above = Em::new(if self.level.get() == 1 { 1.8 } else { 1.44 }); - let below = Em::new(0.66); + let size = Em::new(scale); + let above = Em::new(if self.level.get() == 1 { 1.8 } else { 1.44 }) / scale; + let below = Em::new(0.66) / scale; let mut map = StyleMap::new(); map.set(TextNode::SIZE, TextSize(size.into())); map.set(TextNode::WEIGHT, FontWeight::BOLD); - map.set(BlockNode::ABOVE, VNode::strong(above.into())); - map.set(BlockNode::BELOW, VNode::strong(below.into())); + map.set(BlockNode::ABOVE, VNode::block_around(above.into())); + map.set(BlockNode::BELOW, VNode::block_around(below.into())); Ok(realized.styled_with_map(map)) } -- cgit v1.2.3