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

@ -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,
);
}
}

View file

@ -500,6 +500,7 @@ where
},
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Center,
advanced_shape: false,
});
}
}

View file

@ -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,
});
}
}

View file

@ -309,6 +309,7 @@ where
},
alignment::Horizontal::Left,
alignment::Vertical::Center,
false,
);
}
}

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

View file

@ -249,6 +249,7 @@ where
Default::default(),
self.text_alignment,
alignment::Vertical::Center,
false,
);
}