summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-10-18 15:10:22 +0200
committerGitHub <noreply@github.com>2024-10-18 13:10:22 +0000
commit711a2d88079f0b3929bbb6be97bda52139e22aa1 (patch)
treef094bb4b0d2c24a7853fa476ab012ebe25e27f08 /crates
parent6057df7c4d1068eb1e16d9b1476ee2a0a9cb03e7 (diff)
Fix optimized linebreaks without justification (#5236)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/layout/inline/linebreak.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/typst/src/layout/inline/linebreak.rs b/crates/typst/src/layout/inline/linebreak.rs
index f5048aae..aa62d487 100644
--- a/crates/typst/src/layout/inline/linebreak.rs
+++ b/crates/typst/src/layout/inline/linebreak.rs
@@ -597,7 +597,7 @@ fn raw_cost(
let badness = if ratio < metrics.min_ratio(approx) {
// Overfull line always has maximum cost.
1_000_000.0
- } else if justify || ratio < 0.0 {
+ } else if breakpoint != Breakpoint::Mandatory || justify || ratio < 0.0 {
// If the line shall be justified or needs shrinking, it has normal
// badness with cost 100|ratio|^3. We limit the ratio to 10 as to not
// get to close to our maximum cost.