diff options
author | 2023-05-02 03:30:06 +0200 | |
---|---|---|
committer | 2023-05-02 03:30:06 +0200 | |
commit | 2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5 (patch) | |
tree | 6acba55171f28af1a3c9c4e65a99ad10abc11c65 /widget/src/text_input.rs | |
parent | 57a276e16539d6aeca0619e0c5e36d0b1c1b5ef9 (diff) | |
parent | edf3432bf5176be13437b9fd5d25b890ec9dbe69 (diff) | |
download | iced-2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5.tar.gz iced-2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5.tar.bz2 iced-2d7d9a130ece3fb6fa4cd52f9b32b4abd7887cf5.zip |
Merge pull request #1822 from iced-rs/basic-shaping
`text::Shaping` strategy selection
Diffstat (limited to 'widget/src/text_input.rs')
-rw-r--r-- | widget/src/text_input.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index 9db382f7..32d0b1f8 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, + text::Shaping::Advanced, ); 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, + shaping: text::Shaping::Advanced, }); } @@ -1079,6 +1081,7 @@ pub fn draw<Renderer>( if text.is_empty() { placeholder } else { &text }, size, font, + text::Shaping::Advanced, ); let render = |renderer: &mut Renderer| { @@ -1106,6 +1109,7 @@ pub fn draw<Renderer>( size, horizontal_alignment: alignment::Horizontal::Left, vertical_alignment: alignment::Vertical::Center, + shaping: text::Shaping::Advanced, }); }; @@ -1310,8 +1314,12 @@ where { let text_before_cursor = value.until(cursor_index).to_string(); - let text_value_width = - renderer.measure_width(&text_before_cursor, size, font); + let text_value_width = renderer.measure_width( + &text_before_cursor, + size, + font, + text::Shaping::Advanced, + ); let offset = ((text_value_width + 5.0) - text_bounds.width).max(0.0); @@ -1344,6 +1352,7 @@ where size, font, Size::INFINITY, + text::Shaping::Advanced, Point::new(x + offset, text_bounds.height / 2.0), true, ) |