diff options
author | 2023-05-05 06:38:33 +0200 | |
---|---|---|
committer | 2023-05-05 06:38:33 +0200 | |
commit | 7ae549aba8b5f651a6e7b1a84ddd48288b77f50c (patch) | |
tree | 54074dd8b1fc17d63ad92d84b6d2b4415ad29df6 /widget/src/toggler.rs | |
parent | 8e8808f0e187ed6671441f5016f07bfcba426452 (diff) | |
parent | 9499a8f9e6f9971dedfae563cb133232aa3cebc2 (diff) | |
download | iced-7ae549aba8b5f651a6e7b1a84ddd48288b77f50c.tar.gz iced-7ae549aba8b5f651a6e7b1a84ddd48288b77f50c.tar.bz2 iced-7ae549aba8b5f651a6e7b1a84ddd48288b77f50c.zip |
Merge pull request #1828 from iced-rs/feature/line-height
Support configurable `LineHeight` in text widgets
Diffstat (limited to '')
-rw-r--r-- | widget/src/toggler.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs index 639bbb3b..b1ba65c9 100644 --- a/widget/src/toggler.rs +++ b/widget/src/toggler.rs @@ -42,6 +42,7 @@ where width: Length, size: f32, text_size: Option<f32>, + text_line_height: text::LineHeight, text_alignment: alignment::Horizontal, text_shaping: text::Shaping, spacing: f32, @@ -80,6 +81,7 @@ where width: Length::Fill, size: Self::DEFAULT_SIZE, text_size: None, + text_line_height: text::LineHeight::default(), text_alignment: alignment::Horizontal::Left, text_shaping: text::Shaping::Basic, spacing: 0.0, @@ -106,6 +108,15 @@ where self } + /// Sets the text [`LineHeight`] of the [`Toggler`]. + pub fn text_line_height( + mut self, + line_height: impl Into<text::LineHeight>, + ) -> Self { + self.text_line_height = line_height.into(); + self + } + /// Sets the horizontal alignment of the text of the [`Toggler`] pub fn text_alignment(mut self, alignment: alignment::Horizontal) -> Self { self.text_alignment = alignment; @@ -176,6 +187,7 @@ where self.text_size .unwrap_or_else(|| renderer.default_size()), ) + .line_height(self.text_line_height) .shaping(self.text_shaping), ); } @@ -254,6 +266,7 @@ where label_layout, label, self.text_size, + self.text_line_height, self.font, Default::default(), self.text_alignment, |