Add Align::End for end-based alignment

For use cases that want to reverse the alignment of RTL
lines, this avoids needing to check the RTL status of every line
manually.

This is a breaking change.
This commit is contained in:
John Nunley 2023-07-07 21:31:17 -07:00
parent 7d50d17369
commit aa1b37aede
No known key found for this signature in database
GPG key ID: 42B2FA4582BB1EC9
2 changed files with 3 additions and 0 deletions

View file

@ -1001,6 +1001,7 @@ impl ShapeLine {
(Align::Right, true) => 0.,
(Align::Right, false) => line_width - visual_line.w,
(Align::Center, _) => (line_width - visual_line.w) / 2.0,
(Align::End, _) => line_width - visual_line.w,
(Align::Justified, _) => {
// Don't justify the last line in a paragraph.
if visual_line.spaces > 0 && index != number_of_visual_lines - 1 {