summaryrefslogtreecommitdiffstats
path: root/widget/src/text_input.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-19 01:19:56 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-02 01:02:13 +0200
commit33b5a900197e2798a393d6d9a0834039666eddbb (patch)
treeb4ce1f77dc50d3733a2c9252d57674c3592a0c3c /widget/src/text_input.rs
parent57a276e16539d6aeca0619e0c5e36d0b1c1b5ef9 (diff)
downloadiced-33b5a900197e2798a393d6d9a0834039666eddbb.tar.gz
iced-33b5a900197e2798a393d6d9a0834039666eddbb.tar.bz2
iced-33b5a900197e2798a393d6d9a0834039666eddbb.zip
Make basic text shaping the default shaping strategy
Diffstat (limited to 'widget/src/text_input.rs')
-rw-r--r--widget/src/text_input.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index 9db382f7..abf858ca 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -463,6 +463,7 @@ where
&icon.code_point.to_string(),
icon.size.unwrap_or_else(|| renderer.default_size()),
icon.font,
+ true,
);
let mut text_node = layout::Node::new(
@@ -975,6 +976,7 @@ pub fn draw<Renderer>(
bounds: icon_layout.bounds(),
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
+ advanced_shape: true,
});
}
@@ -1079,6 +1081,7 @@ pub fn draw<Renderer>(
if text.is_empty() { placeholder } else { &text },
size,
font,
+ true,
);
let render = |renderer: &mut Renderer| {
@@ -1106,6 +1109,7 @@ pub fn draw<Renderer>(
size,
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Center,
+ advanced_shape: true,
});
};
@@ -1311,7 +1315,7 @@ where
let text_before_cursor = value.until(cursor_index).to_string();
let text_value_width =
- renderer.measure_width(&text_before_cursor, size, font);
+ renderer.measure_width(&text_before_cursor, size, font, true);
let offset = ((text_value_width + 5.0) - text_bounds.width).max(0.0);
@@ -1346,6 +1350,7 @@ where
Size::INFINITY,
Point::new(x + offset, text_bounds.height / 2.0),
true,
+ true,
)
.map(text::Hit::cursor)?;