summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-08 16:19:28 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-08 16:19:28 +0200
commit180cb073bdb1429e566839b09d6fe86114c83673 (patch)
treee506f3a0739d9d64ec4c23fd94377ae09805f0c2
parent16bf8fc7622fbe67a7d81cbe6daad329385cc44c (diff)
downloadiced-180cb073bdb1429e566839b09d6fe86114c83673.tar.gz
iced-180cb073bdb1429e566839b09d6fe86114c83673.tar.bz2
iced-180cb073bdb1429e566839b09d6fe86114c83673.zip
Add `line_height` to `checkbox::Icon`
Diffstat (limited to '')
-rw-r--r--examples/checkbox/src/main.rs1
-rw-r--r--widget/src/checkbox.rs6
2 files changed, 6 insertions, 1 deletions
diff --git a/examples/checkbox/src/main.rs b/examples/checkbox/src/main.rs
index 5852e978..ef61a974 100644
--- a/examples/checkbox/src/main.rs
+++ b/examples/checkbox/src/main.rs
@@ -59,6 +59,7 @@ impl Application for Example {
font: ICON_FONT,
code_point: '\u{e901}',
size: None,
+ line_height: text::LineHeight::Relative(1.0),
shaping: text::Shaping::Basic,
});
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs
index c34fd0bb..7d43bb4a 100644
--- a/widget/src/checkbox.rs
+++ b/widget/src/checkbox.rs
@@ -91,6 +91,7 @@ where
font: Renderer::ICON_FONT,
code_point: Renderer::CHECKMARK_ICON,
size: None,
+ line_height: text::LineHeight::default(),
shaping: text::Shaping::Basic,
},
style: Default::default(),
@@ -279,6 +280,7 @@ where
font,
code_point,
size,
+ line_height,
shaping,
} = &self.icon;
let size = size.unwrap_or(bounds.height * 0.7);
@@ -288,7 +290,7 @@ where
content: &code_point.to_string(),
font: *font,
size,
- line_height: text::LineHeight::default(),
+ line_height: *line_height,
bounds: Rectangle {
x: bounds.center_x(),
y: bounds.center_y(),
@@ -347,6 +349,8 @@ pub struct Icon<Font> {
pub code_point: char,
/// Font size of the content.
pub size: Option<f32>,
+ /// The line height of the icon.
+ pub line_height: text::LineHeight,
/// The shaping strategy of the icon.
pub shaping: text::Shaping,
}