summaryrefslogtreecommitdiffstats
path: root/widget/src/radio.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-04 13:00:16 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-04 18:39:31 +0200
commit9499a8f9e6f9971dedfae563cb133232aa3cebc2 (patch)
tree54074dd8b1fc17d63ad92d84b6d2b4415ad29df6 /widget/src/radio.rs
parent8e8808f0e187ed6671441f5016f07bfcba426452 (diff)
downloadiced-9499a8f9e6f9971dedfae563cb133232aa3cebc2.tar.gz
iced-9499a8f9e6f9971dedfae563cb133232aa3cebc2.tar.bz2
iced-9499a8f9e6f9971dedfae563cb133232aa3cebc2.zip
Support configurable `LineHeight` in text widgets
Diffstat (limited to 'widget/src/radio.rs')
-rw-r--r--widget/src/radio.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/widget/src/radio.rs b/widget/src/radio.rs
index f62f4703..9dad1e22 100644
--- a/widget/src/radio.rs
+++ b/widget/src/radio.rs
@@ -81,6 +81,7 @@ where
size: f32,
spacing: f32,
text_size: Option<f32>,
+ text_line_height: text::LineHeight,
text_shaping: text::Shaping,
font: Option<Renderer::Font>,
style: <Renderer::Theme as StyleSheet>::Style,
@@ -124,6 +125,7 @@ where
size: Self::DEFAULT_SIZE,
spacing: Self::DEFAULT_SPACING, //15
text_size: None,
+ text_line_height: text::LineHeight::default(),
text_shaping: text::Shaping::Basic,
font: None,
style: Default::default(),
@@ -154,6 +156,15 @@ where
self
}
+ /// Sets the text [`LineHeight`] of the [`Radio`] button.
+ pub fn text_line_height(
+ mut self,
+ line_height: impl Into<text::LineHeight>,
+ ) -> Self {
+ self.text_line_height = line_height.into();
+ self
+ }
+
/// Sets the [`text::Shaping`] strategy of the [`Radio`] button.
pub fn text_shaping(mut self, shaping: text::Shaping) -> Self {
self.text_shaping = shaping;
@@ -207,6 +218,7 @@ where
self.text_size
.unwrap_or_else(|| renderer.default_size()),
)
+ .line_height(self.text_line_height)
.shaping(self.text_shaping),
)
.layout(renderer, limits)
@@ -317,6 +329,7 @@ where
label_layout,
&self.label,
self.text_size,
+ self.text_line_height,
self.font,
crate::text::Appearance {
color: custom_style.text_color,