Introduce text::Shaping enum and replace magic boolean
This commit is contained in:
parent
33b5a90019
commit
4bd290afe7
25 changed files with 203 additions and 132 deletions
|
|
@ -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)?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue