forked from joejulian/gio
text,widget: remove fractional line height
The previous logic kept the y offset of a line as a fractional value until the last possible moment in an effort to be as true to a fractional line height as possible (minimize the error), but this interacts pathologically with multi-line text selections, as the selections may have visibly different gaps between lines. It's better to always shift lines by a fixed quantity of whole pixels, even if it is technically less accurate to the desired line height. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
+3
-3
@@ -513,12 +513,12 @@ func calculateYOffsets(lines []line) {
|
||||
}
|
||||
// Ceil the first value to ensure that we don't baseline it too close to the top of the
|
||||
// viewport and cut off the top pixel.
|
||||
currentY := fixed.I(lines[0].ascent.Ceil())
|
||||
currentY := lines[0].ascent.Ceil()
|
||||
for i := range lines {
|
||||
if i > 0 {
|
||||
currentY += lines[i].lineHeight
|
||||
currentY += lines[i].lineHeight.Round()
|
||||
}
|
||||
lines[i].yOffset = currentY.Round()
|
||||
lines[i].yOffset = currentY
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user