summaryrefslogtreecommitdiffstats
path: root/native/src/widget/radio.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-04 07:33:33 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-24 13:28:24 +0100
commitb29de28d1f0f608f8029c93d154cfd1b0f8b8cbb (patch)
treee100af1dd98d23b29046bc951b04b440d2aa5bc2 /native/src/widget/radio.rs
parenta7580e0696a1a0ba76a89db3f78bc99ba3fbb361 (diff)
downloadiced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.tar.gz
iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.tar.bz2
iced-b29de28d1f0f608f8029c93d154cfd1b0f8b8cbb.zip
Overhaul `Font` type to allow font family selection
Diffstat (limited to '')
-rw-r--r--native/src/widget/radio.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs
index 9daddfbc..bd803910 100644
--- a/native/src/widget/radio.rs
+++ b/native/src/widget/radio.rs
@@ -53,7 +53,7 @@ where
size: f32,
spacing: f32,
text_size: Option<f32>,
- font: Renderer::Font,
+ font: Option<Renderer::Font>,
style: <Renderer::Theme as StyleSheet>::Style,
}
@@ -95,7 +95,7 @@ where
size: Self::DEFAULT_SIZE,
spacing: Self::DEFAULT_SPACING, //15
text_size: None,
- font: Default::default(),
+ font: None,
style: Default::default(),
}
}
@@ -125,8 +125,8 @@ where
}
/// Sets the text font of the [`Radio`] button.
- 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
}
@@ -268,6 +268,7 @@ where
{
let label_layout = children.next().unwrap();
+ let font = self.font.unwrap_or(renderer.default_font());
widget::text::draw(
renderer,
@@ -275,7 +276,7 @@ where
label_layout,
&self.label,
self.text_size,
- self.font.clone(),
+ font,
widget::text::Appearance {
color: custom_style.text_color,
},