Skip to content

Commit

Permalink
Fix placement of as many words as possible on a line, undoes a29ef35
Browse files Browse the repository at this point in the history
…and fixes #265
  • Loading branch information
tdewolff committed Jan 11, 2024
1 parent 01e3b89 commit 65a52f0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions text/linebreak.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,7 @@ func (lb *linebreaker) computeAdjustmentRatio(b int, active *Breakpoint) float64
}
ratio := 0.0
if L < lb.width {
if lb.Y-active.Y == 0.0 {
// no stretching allowed, add artificial space to distinguish unstretchable lines
// this helps with left/center/right aligned text
// this promotes putting as many glyphs (CJK) as possible on a line
return Infinity * (1.0 + (lb.width-L)/lb.width) // range [1000,2000]
} else {
ratio = (lb.width - L) / (lb.Y - active.Y)
}
ratio = (lb.width - L) / (lb.Y - active.Y)
} else if lb.width < L {
ratio = (lb.width - L) / (lb.Z - active.Z)
}
Expand Down

0 comments on commit 65a52f0

Please sign in to comment.