diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-08 15:08:26 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-08 15:45:14 +0200 |
| commit | 712c00ecb72b67da2c0788e5d3eb4dcc6366b2a7 (patch) | |
| tree | f5d7ef4341a4728c980d020cc173fa6bb70feaff /src/library/structure/heading.rs | |
| parent | 977ac77e6a3298be2644a8231e93acbef9f7f396 (diff) | |
Em units
Diffstat (limited to 'src/library/structure/heading.rs')
| -rw-r--r-- | src/library/structure/heading.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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<Smart<Paint>> = Leveled::Value(Smart::Auto); /// The size of text in the heading. #[property(referenced)] - pub const SIZE: Leveled<FontSize> = Leveled::Mapping(|level| { + pub const SIZE: Leveled<TextSize> = 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<bool> = Leveled::Value(false); /// The extra padding above the heading. #[property(referenced)] - pub const ABOVE: Leveled<Length> = Leveled::Value(Length::zero()); + pub const ABOVE: Leveled<RawLength> = Leveled::Value(Length::zero().into()); /// The extra padding below the heading. #[property(referenced)] - pub const BELOW: Leveled<Length> = Leveled::Value(Length::zero()); + pub const BELOW: Leveled<RawLength> = Leveled::Value(Length::zero().into()); /// Whether the heading is block-level. #[property(referenced)] pub const BLOCK: Leveled<bool> = 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); |
