diff options
author | 2023-04-19 01:19:56 +0200 | |
---|---|---|
committer | 2023-05-02 01:02:13 +0200 | |
commit | 33b5a900197e2798a393d6d9a0834039666eddbb (patch) | |
tree | b4ce1f77dc50d3733a2c9252d57674c3592a0c3c /widget | |
parent | 57a276e16539d6aeca0619e0c5e36d0b1c1b5ef9 (diff) | |
download | iced-33b5a900197e2798a393d6d9a0834039666eddbb.tar.gz iced-33b5a900197e2798a393d6d9a0834039666eddbb.tar.bz2 iced-33b5a900197e2798a393d6d9a0834039666eddbb.zip |
Make basic text shaping the default shaping strategy
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/checkbox.rs | 2 | ||||
-rw-r--r-- | widget/src/overlay/menu.rs | 1 | ||||
-rw-r--r-- | widget/src/pick_list.rs | 3 | ||||
-rw-r--r-- | widget/src/radio.rs | 1 | ||||
-rw-r--r-- | widget/src/text_input.rs | 7 | ||||
-rw-r--r-- | widget/src/toggler.rs | 1 |
6 files changed, 14 insertions, 1 deletions
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs index 6505cfdd..e28f76af 100644 --- a/widget/src/checkbox.rs +++ b/widget/src/checkbox.rs @@ -273,6 +273,7 @@ where color: custom_style.icon_color, horizontal_alignment: alignment::Horizontal::Center, vertical_alignment: alignment::Vertical::Center, + advanced_shape: true, }); } } @@ -292,6 +293,7 @@ where }, alignment::Horizontal::Left, alignment::Vertical::Center, + false, ); } } diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs index c322c8ba..c904730d 100644 --- a/widget/src/overlay/menu.rs +++ b/widget/src/overlay/menu.rs @@ -500,6 +500,7 @@ where }, horizontal_alignment: alignment::Horizontal::Left, vertical_alignment: alignment::Vertical::Center, + advanced_shape: false, }); } } diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index cd23cdd2..d44f4cae 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -366,6 +366,7 @@ where text_size, font.unwrap_or_else(|| renderer.default_font()), Size::new(f32::INFINITY, f32::INFINITY), + false, ); width.round() @@ -628,6 +629,7 @@ pub fn draw<'a, T, Renderer>( }, horizontal_alignment: alignment::Horizontal::Right, vertical_alignment: alignment::Vertical::Center, + advanced_shape: false, }); } @@ -653,6 +655,7 @@ pub fn draw<'a, T, Renderer>( }, horizontal_alignment: alignment::Horizontal::Left, vertical_alignment: alignment::Vertical::Center, + advanced_shape: false, }); } } diff --git a/widget/src/radio.rs b/widget/src/radio.rs index c3229aed..b685c1a1 100644 --- a/widget/src/radio.rs +++ b/widget/src/radio.rs @@ -309,6 +309,7 @@ where }, alignment::Horizontal::Left, alignment::Vertical::Center, + false, ); } } 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)?; diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs index 713a9c30..d3033ddb 100644 --- a/widget/src/toggler.rs +++ b/widget/src/toggler.rs @@ -249,6 +249,7 @@ where Default::default(), self.text_alignment, alignment::Vertical::Center, + false, ); } |