Make basic text shaping the default shaping strategy

This commit is contained in:
Héctor Ramón Jiménez 2023-04-19 01:19:56 +02:00
parent 57a276e165
commit 33b5a90019
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
24 changed files with 140 additions and 10 deletions

View file

@ -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)?;