From 712c00ecb72b67da2c0788e5d3eb4dcc6366b2a7 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 8 Apr 2022 15:08:26 +0200 Subject: Em units --- src/library/structure/heading.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/library/structure/heading.rs') diff --git a/src/library/structure/heading.rs b/src/library/structure/heading.rs index 8b143865..dcf87f90 100644 --- a/src/library/structure/heading.rs +++ b/src/library/structure/heading.rs @@ -1,5 +1,5 @@ use crate::library::prelude::*; -use crate::library::text::{FontFamily, FontSize, TextNode, Toggle}; +use crate::library::text::{FontFamily, TextNode, TextSize, Toggle}; /// A section heading. #[derive(Debug, Hash)] @@ -21,9 +21,9 @@ impl HeadingNode { pub const FILL: Leveled> = Leveled::Value(Smart::Auto); /// The size of text in the heading. #[property(referenced)] - pub const SIZE: Leveled = Leveled::Mapping(|level| { + pub const SIZE: Leveled = Leveled::Mapping(|level| { let upscale = (1.6 - 0.1 * level as f64).max(0.75); - FontSize(Ratio::new(upscale).into()) + TextSize(Em::new(upscale).into()) }); /// Whether text in the heading is strengthend. #[property(referenced)] @@ -36,10 +36,10 @@ impl HeadingNode { pub const UNDERLINE: Leveled = Leveled::Value(false); /// The extra padding above the heading. #[property(referenced)] - pub const ABOVE: Leveled = Leveled::Value(Length::zero()); + pub const ABOVE: Leveled = Leveled::Value(Length::zero().into()); /// The extra padding below the heading. #[property(referenced)] - pub const BELOW: Leveled = Leveled::Value(Length::zero()); + pub const BELOW: Leveled = Leveled::Value(Length::zero().into()); /// Whether the heading is block-level. #[property(referenced)] pub const BLOCK: Leveled = Leveled::Value(true); @@ -95,14 +95,14 @@ impl Show for HeadingNode { let above = resolve!(Self::ABOVE); if !above.is_zero() { - seq.push(Content::Vertical(above.into())); + seq.push(Content::Vertical(above.resolve(styles).into())); } seq.push(body); let below = resolve!(Self::BELOW); if !below.is_zero() { - seq.push(Content::Vertical(below.into())); + seq.push(Content::Vertical(below.resolve(styles).into())); } let mut content = Content::sequence(seq).styled_with_map(map); -- cgit v1.2.3