summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Olivier Pinon <op@impero.com>2021-12-10 22:53:00 +0100
committerLibravatar Olivier Pinon <op@impero.com>2021-12-10 23:34:02 +0100
commitd06e6bfb5111c1f2d2fd43c10a0c69870539742f (patch)
treed1c7095e32254305c53e9f03f8a3da9510d80275 /native
parenta7bcd65bb82a2640e10cbe25bf24bc003d059857 (diff)
downloadiced-d06e6bfb5111c1f2d2fd43c10a0c69870539742f.tar.gz
iced-d06e6bfb5111c1f2d2fd43c10a0c69870539742f.tar.bz2
iced-d06e6bfb5111c1f2d2fd43c10a0c69870539742f.zip
Lower text::Renderer's Font bound from Copy to Clone
Diffstat (limited to 'native')
-rw-r--r--native/src/overlay/menu.rs2
-rw-r--r--native/src/text.rs2
-rw-r--r--native/src/widget/checkbox.rs4
-rw-r--r--native/src/widget/pick_list.rs8
-rw-r--r--native/src/widget/radio.rs2
-rw-r--r--native/src/widget/text.rs6
-rw-r--r--native/src/widget/text_input.rs21
-rw-r--r--native/src/widget/toggler.rs4
8 files changed, 25 insertions, 24 deletions
diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs
index 6776a3ee..c0282aae 100644
--- a/native/src/overlay/menu.rs
+++ b/native/src/overlay/menu.rs
@@ -454,7 +454,7 @@ where
..bounds
},
size: f32::from(text_size),
- font: self.font,
+ font: self.font.clone(),
color: if is_selected {
self.style.selected_text_color
} else {
diff --git a/native/src/text.rs b/native/src/text.rs
index 8b9205e3..256a9c5a 100644
--- a/native/src/text.rs
+++ b/native/src/text.rs
@@ -57,7 +57,7 @@ impl Hit {
/// A renderer capable of measuring and drawing [`Text`].
pub trait Renderer: crate::Renderer {
/// The font type used.
- type Font: Default + Copy;
+ type Font: Default + Clone;
/// The icon font of the backend.
const ICON_FONT: Self::Font;
diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs
index 2af2d60c..5a8dbc83 100644
--- a/native/src/widget/checkbox.rs
+++ b/native/src/widget/checkbox.rs
@@ -157,7 +157,7 @@ where
)
.push(
Text::new(&self.label)
- .font(self.font)
+ .font(self.font.clone())
.width(self.width)
.size(self.text_size.unwrap_or(renderer.default_size())),
)
@@ -261,7 +261,7 @@ where
style,
label_layout,
&self.label,
- self.font,
+ self.font.clone(),
self.text_size,
self.text_color.or(Some(custom_style.text_color)),
alignment::Horizontal::Left,
diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs
index cb781a89..1f79e07a 100644
--- a/native/src/widget/pick_list.rs
+++ b/native/src/widget/pick_list.rs
@@ -174,7 +174,7 @@ where
.pad(self.padding);
let text_size = self.text_size.unwrap_or(renderer.default_size());
- let font = self.font;
+ let font = self.font.clone();
let max_width = match self.width {
Length::Shrink => {
@@ -182,7 +182,7 @@ where
let (width, _) = renderer.measure(
label,
text_size,
- font,
+ font.clone(),
Size::new(f32::INFINITY, f32::INFINITY),
);
@@ -397,7 +397,7 @@ where
size: f32::from(
self.text_size.unwrap_or(renderer.default_size()),
),
- font: self.font,
+ font: self.font.clone(),
color: is_selected
.then(|| style.text_color)
.unwrap_or(style.placeholder_color),
@@ -427,7 +427,7 @@ where
)
.width(bounds.width.round() as u16)
.padding(self.padding)
- .font(self.font)
+ .font(self.font.clone())
.style(self.style_sheet.menu());
if let Some(text_size) = self.text_size {
diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs
index 523773bd..aa7019d4 100644
--- a/native/src/widget/radio.rs
+++ b/native/src/widget/radio.rs
@@ -279,7 +279,7 @@ where
style,
label_layout,
&self.label,
- self.font,
+ self.font.clone(),
self.text_size,
self.text_color,
alignment::Horizontal::Left,
diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs
index 4dbc4a65..488b45c4 100644
--- a/native/src/widget/text.rs
+++ b/native/src/widget/text.rs
@@ -124,7 +124,7 @@ where
let bounds = limits.max();
let (width, height) =
- renderer.measure(&self.content, size, self.font, bounds);
+ renderer.measure(&self.content, size, self.font.clone(), bounds);
let size = limits.resolve(Size::new(width, height));
@@ -144,7 +144,7 @@ where
style,
layout,
&self.content,
- self.font,
+ self.font.clone(),
self.size,
self.color,
self.horizontal_alignment,
@@ -227,7 +227,7 @@ impl<Renderer: text::Renderer> Clone for Text<Renderer> {
content: self.content.clone(),
size: self.size,
color: self.color,
- font: self.font,
+ font: self.font.clone(),
width: self.width,
height: self.height,
horizontal_alignment: self.horizontal_alignment,
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index bec1db48..fb9f0834 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -219,7 +219,7 @@ where
&value,
size,
position,
- self.font,
+ self.font.clone(),
);
(
@@ -251,7 +251,7 @@ where
&value,
size,
left,
- self.font,
+ self.font.clone(),
);
let (right_position, right_offset) =
@@ -261,7 +261,7 @@ where
&value,
size,
right,
- self.font,
+ self.font.clone(),
);
let width = right_position - left_position;
@@ -300,7 +300,7 @@ where
&text
},
size,
- self.font,
+ self.font.clone(),
);
let render = |renderer: &mut Renderer| {
@@ -319,7 +319,7 @@ where
} else {
self.style_sheet.value_color()
},
- font: self.font,
+ font: self.font.clone(),
bounds: Rectangle {
y: text_bounds.center_y(),
width: f32::INFINITY,
@@ -414,7 +414,7 @@ where
find_cursor_position(
renderer,
text_layout.bounds(),
- self.font,
+ self.font.clone(),
self.size,
&value,
&self.state,
@@ -434,7 +434,7 @@ where
let position = find_cursor_position(
renderer,
text_layout.bounds(),
- self.font,
+ self.font.clone(),
self.size,
&self.value,
&self.state,
@@ -481,7 +481,7 @@ where
let position = find_cursor_position(
renderer,
text_layout.bounds(),
- self.font,
+ self.font.clone(),
self.size,
&value,
&self.state,
@@ -962,13 +962,14 @@ where
{
let size = size.unwrap_or(renderer.default_size());
- let offset = offset(renderer, text_bounds, font, size, &value, &state);
+ let offset =
+ offset(renderer, text_bounds, font.clone(), size, &value, &state);
renderer
.hit_test(
&value.to_string(),
size.into(),
- font,
+ font.clone(),
Size::INFINITY,
Point::new(x + offset, text_bounds.height / 2.0),
true,
diff --git a/native/src/widget/toggler.rs b/native/src/widget/toggler.rs
index 6cecc7e1..7eca58d2 100644
--- a/native/src/widget/toggler.rs
+++ b/native/src/widget/toggler.rs
@@ -151,7 +151,7 @@ where
row = row.push(
Text::new(label)
.horizontal_alignment(self.text_alignment)
- .font(self.font)
+ .font(self.font.clone())
.width(self.width)
.size(self.text_size.unwrap_or(renderer.default_size())),
);
@@ -229,7 +229,7 @@ where
style,
label_layout,
&label,
- self.font,
+ self.font.clone(),
self.text_size,
None,
self.text_alignment,