mirror of
https://github.com/typst/typst
synced 2025-06-28 00:03:17 +08:00
Fix cost if last line is justified
This commit is contained in:
parent
65c4ee42e7
commit
e5615ce02d
@ -780,16 +780,12 @@ fn linebreak_optimized<'a>(
|
|||||||
// this breakpoint.
|
// this breakpoint.
|
||||||
active = i + 1;
|
active = i + 1;
|
||||||
MAX_COST
|
MAX_COST
|
||||||
} else if eof {
|
} else if mandatory || eof {
|
||||||
// This is the final line and its not overfull since then we
|
|
||||||
// would have taken the above branch.
|
|
||||||
0.0
|
|
||||||
} else if mandatory {
|
|
||||||
// This is a mandatory break and the line is not overfull, so it
|
// This is a mandatory break and the line is not overfull, so it
|
||||||
// has minimum cost. All breakpoints before this one become
|
// has minimum cost. All breakpoints before this one become
|
||||||
// inactive since no line can span above the mandatory break.
|
// inactive since no line can span above the mandatory break.
|
||||||
active = k;
|
active = k;
|
||||||
MIN_COST
|
MIN_COST + if attempt.justify { ratio.powi(3).abs() } else { 0.0 }
|
||||||
} else {
|
} else {
|
||||||
// Normal line with cost of |ratio^3|.
|
// Normal line with cost of |ratio^3|.
|
||||||
ratio.powi(3).abs()
|
ratio.powi(3).abs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user