diff options
| author | 2023-04-19 02:00:45 +0200 | |
|---|---|---|
| committer | 2023-05-02 01:02:32 +0200 | |
| commit | 4bd290afe7d81d9aaf7467b3ce91491f6600261a (patch) | |
| tree | 906bfe10f6118c86429c3bb83a8ce742dccb170a /widget/src/text_input.rs | |
| parent | 33b5a900197e2798a393d6d9a0834039666eddbb (diff) | |
| download | iced-4bd290afe7d81d9aaf7467b3ce91491f6600261a.tar.gz iced-4bd290afe7d81d9aaf7467b3ce91491f6600261a.tar.bz2 iced-4bd290afe7d81d9aaf7467b3ce91491f6600261a.zip | |
Introduce `text::Shaping` enum and replace magic boolean
Diffstat (limited to 'widget/src/text_input.rs')
| -rw-r--r-- | widget/src/text_input.rs | 18 | 
1 files changed, 11 insertions, 7 deletions
| diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index abf858ca..32d0b1f8 100644 --- a/widget/src/text_input.rs +++ b/widget/src/text_input.rs @@ -463,7 +463,7 @@ where              &icon.code_point.to_string(),              icon.size.unwrap_or_else(|| renderer.default_size()),              icon.font, -            true, +            text::Shaping::Advanced,          );          let mut text_node = layout::Node::new( @@ -976,7 +976,7 @@ pub fn draw<Renderer>(              bounds: icon_layout.bounds(),              horizontal_alignment: alignment::Horizontal::Left,              vertical_alignment: alignment::Vertical::Top, -            advanced_shape: true, +            shaping: text::Shaping::Advanced,          });      } @@ -1081,7 +1081,7 @@ pub fn draw<Renderer>(          if text.is_empty() { placeholder } else { &text },          size,          font, -        true, +        text::Shaping::Advanced,      );      let render = |renderer: &mut Renderer| { @@ -1109,7 +1109,7 @@ pub fn draw<Renderer>(              size,              horizontal_alignment: alignment::Horizontal::Left,              vertical_alignment: alignment::Vertical::Center, -            advanced_shape: true, +            shaping: text::Shaping::Advanced,          });      }; @@ -1314,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, true); +    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); @@ -1348,9 +1352,9 @@ where              size,              font,              Size::INFINITY, +            text::Shaping::Advanced,              Point::new(x + offset, text_bounds.height / 2.0),              true, -            true,          )          .map(text::Hit::cursor)?; | 
