summaryrefslogtreecommitdiffstats
path: root/widget/src/toggler.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-02 03:30:06 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-02 03:30:06 +0200
commit2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5 (patch)
tree6acba55171f28af1a3c9c4e65a99ad10abc11c65 /widget/src/toggler.rs
parent57a276e16539d6aeca0619e0c5e36d0b1c1b5ef9 (diff)
parentedf3432bf5176be13437b9fd5d25b890ec9dbe69 (diff)
downloadiced-2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5.tar.gz
iced-2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5.tar.bz2
iced-2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5.zip
Merge pull request #1822 from iced-rs/basic-shaping
`text::Shaping` strategy selection
Diffstat (limited to '')
-rw-r--r--widget/src/toggler.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs
index 713a9c30..639bbb3b 100644
--- a/widget/src/toggler.rs
+++ b/widget/src/toggler.rs
@@ -43,6 +43,7 @@ where
size: f32,
text_size: Option<f32>,
text_alignment: alignment::Horizontal,
+ text_shaping: text::Shaping,
spacing: f32,
font: Option<Renderer::Font>,
style: <Renderer::Theme as StyleSheet>::Style,
@@ -80,6 +81,7 @@ where
size: Self::DEFAULT_SIZE,
text_size: None,
text_alignment: alignment::Horizontal::Left,
+ text_shaping: text::Shaping::Basic,
spacing: 0.0,
font: None,
style: Default::default(),
@@ -110,6 +112,12 @@ where
self
}
+ /// Sets the [`text::Shaping`] strategy of the [`Toggler`].
+ pub fn text_shaping(mut self, shaping: text::Shaping) -> Self {
+ self.text_shaping = shaping;
+ self
+ }
+
/// Sets the spacing between the [`Toggler`] and the text.
pub fn spacing(mut self, spacing: impl Into<Pixels>) -> Self {
self.spacing = spacing.into().0;
@@ -167,7 +175,8 @@ where
.size(
self.text_size
.unwrap_or_else(|| renderer.default_size()),
- ),
+ )
+ .shaping(self.text_shaping),
);
}
@@ -249,6 +258,7 @@ where
Default::default(),
self.text_alignment,
alignment::Vertical::Center,
+ self.text_shaping,
);
}