mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix optimized linebreaks without justification (#5236)
This commit is contained in:
parent
0774943f1d
commit
242a16e77a
@ -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.
|
||||
|
BIN
tests/ref/issue-5235-linebreak-optimized-without-justify.png
Normal file
BIN
tests/ref/issue-5235-linebreak-optimized-without-justify.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -123,3 +123,19 @@ For info see #link("https://myhost.tld").
|
||||
// - shaping that results in multiple glyphs in the same cluster
|
||||
#set text(font: "Noto Sans Thai")
|
||||
#h(85pt) งบิก
|
||||
|
||||
--- issue-5235-linebreak-optimized-without-justify ---
|
||||
#set page(width: 207pt, margin: 15pt)
|
||||
#set text(11pt)
|
||||
|
||||
#set par(linebreaks: "simple")
|
||||
Some texts feature many longer
|
||||
words. Those are often exceedingly
|
||||
challenging to break in a visually
|
||||
pleasing way.
|
||||
|
||||
#set par(linebreaks: "optimized")
|
||||
Some texts feature many longer
|
||||
words. Those are often exceedingly
|
||||
challenging to break in a visually
|
||||
pleasing way.
|
||||
|
Loading…
x
Reference in New Issue
Block a user