diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-12 23:25:54 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-12 23:46:26 +0100 |
| commit | bf59c08a0a601eeac4354c505cab15e65601c8e8 (patch) | |
| tree | 2ba3230c77960acf5d55ee34065a5028d1c45d5d /library/src/structure/heading.rs | |
| parent | d9ce194fe71076314955dd25896f64d48bccd6e5 (diff) | |
New interaction model
Diffstat (limited to 'library/src/structure/heading.rs')
| -rw-r--r-- | library/src/structure/heading.rs | 13 |
1 files changed, 7 insertions, 6 deletions
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<Content> { - 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)) } |
