diff options
author | 2023-02-04 07:33:33 +0100 | |
---|---|---|
committer | 2023-02-24 13:28:24 +0100 | |
commit | b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb (patch) | |
tree | e100af1dd98d23b29046bc951b04b440d2aa5bc2 /native/src/overlay | |
parent | a7580e0696a1a0ba76a89db3f78bc99ba3fbb361 (diff) | |
download | iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.tar.gz iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.tar.bz2 iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.zip |
Overhaul `Font` type to allow font family selection
Diffstat (limited to 'native/src/overlay')
-rw-r--r-- | native/src/overlay/menu.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index 50f741ef..9c3a8a44 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -31,7 +31,7 @@ where width: f32, padding: Padding, text_size: Option<f32>, - font: Renderer::Font, + font: Option<Renderer::Font>, style: <Renderer::Theme as StyleSheet>::Style, } @@ -58,7 +58,7 @@ where width: 0.0, padding: Padding::ZERO, text_size: None, - font: Default::default(), + font: None, style: Default::default(), } } @@ -82,8 +82,8 @@ where } /// Sets the font of the [`Menu`]. - pub fn font(mut self, font: Renderer::Font) -> Self { - self.font = font; + pub fn font(mut self, font: impl Into<Renderer::Font>) -> Self { + self.font = Some(font.into()); self } @@ -311,7 +311,7 @@ where last_selection: &'a mut Option<T>, padding: Padding, text_size: Option<f32>, - font: Renderer::Font, + font: Option<Renderer::Font>, style: <Renderer::Theme as StyleSheet>::Style, } @@ -491,7 +491,7 @@ where ..bounds }, size: text_size, - font: self.font.clone(), + font: self.font.unwrap_or_else(|| renderer.default_font()), color: if is_selected { appearance.selected_text_color } else { |