summaryrefslogtreecommitdiffstats
path: root/widget/src/radio.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/radio.rs')
-rw-r--r--widget/src/radio.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/widget/src/radio.rs b/widget/src/radio.rs
index c3229aed..f62f4703 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_shaping: text::Shaping,
font: Option<Renderer::Font>,
style: <Renderer::Theme as StyleSheet>::Style,
}
@@ -123,6 +124,7 @@ where
size: Self::DEFAULT_SIZE,
spacing: Self::DEFAULT_SPACING, //15
text_size: None,
+ text_shaping: text::Shaping::Basic,
font: None,
style: Default::default(),
}
@@ -152,6 +154,12 @@ where
self
}
+ /// Sets the [`text::Shaping`] strategy of the [`Radio`] button.
+ pub fn text_shaping(mut self, shaping: text::Shaping) -> Self {
+ self.text_shaping = shaping;
+ self
+ }
+
/// Sets the text font of the [`Radio`] button.
pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self {
self.font = Some(font.into());
@@ -192,9 +200,15 @@ where
.spacing(self.spacing)
.align_items(Alignment::Center)
.push(Row::new().width(self.size).height(self.size))
- .push(Text::new(&self.label).width(self.width).size(
- self.text_size.unwrap_or_else(|| renderer.default_size()),
- ))
+ .push(
+ Text::new(&self.label)
+ .width(self.width)
+ .size(
+ self.text_size
+ .unwrap_or_else(|| renderer.default_size()),
+ )
+ .shaping(self.text_shaping),
+ )
.layout(renderer, limits)
}
@@ -309,6 +323,7 @@ where
},
alignment::Horizontal::Left,
alignment::Vertical::Center,
+ self.text_shaping,
);
}
}