diff options
author | 2023-04-19 02:00:45 +0200 | |
---|---|---|
committer | 2023-05-02 01:02:32 +0200 | |
commit | 4bd290afe7d81d9aaf7467b3ce91491f6600261a (patch) | |
tree | 906bfe10f6118c86429c3bb83a8ce742dccb170a /widget/src/overlay | |
parent | 33b5a900197e2798a393d6d9a0834039666eddbb (diff) | |
download | iced-4bd290afe7d81d9aaf7467b3ce91491f6600261a.tar.gz iced-4bd290afe7d81d9aaf7467b3ce91491f6600261a.tar.bz2 iced-4bd290afe7d81d9aaf7467b3ce91491f6600261a.zip |
Introduce `text::Shaping` enum and replace magic boolean
Diffstat (limited to 'widget/src/overlay')
-rw-r--r-- | widget/src/overlay/menu.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs index c904730d..7de3cbae 100644 --- a/widget/src/overlay/menu.rs +++ b/widget/src/overlay/menu.rs @@ -31,6 +31,7 @@ where width: f32, padding: Padding, text_size: Option<f32>, + text_shaping: text::Shaping, font: Option<Renderer::Font>, style: <Renderer::Theme as StyleSheet>::Style, } @@ -58,6 +59,7 @@ where width: 0.0, padding: Padding::ZERO, text_size: None, + text_shaping: text::Shaping::Basic, font: None, style: Default::default(), } @@ -81,6 +83,12 @@ where self } + /// Sets the [`text::Shaping`] strategy of the [`Menu`]. + pub fn text_shaping(mut self, shaping: text::Shaping) -> Self { + self.text_shaping = shaping; + self + } + /// Sets the font of the [`Menu`]. pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self { self.font = Some(font.into()); @@ -168,6 +176,7 @@ where padding, font, text_size, + text_shaping, style, } = menu; @@ -177,6 +186,7 @@ where last_selection, font, text_size, + text_shaping, padding, style: style.clone(), })); @@ -311,6 +321,7 @@ where last_selection: &'a mut Option<T>, padding: Padding, text_size: Option<f32>, + text_shaping: text::Shaping, font: Option<Renderer::Font>, style: <Renderer::Theme as StyleSheet>::Style, } @@ -500,7 +511,7 @@ where }, horizontal_alignment: alignment::Horizontal::Left, vertical_alignment: alignment::Vertical::Center, - advanced_shape: false, + shaping: self.text_shaping, }); } } |