summaryrefslogtreecommitdiffstats
path: root/widget/src/overlay
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/overlay
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/overlay/menu.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs
index c322c8ba..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,6 +511,7 @@ where
},
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Center,
+ shaping: self.text_shaping,
});
}
}