fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.25k stars 1.4k forks source link

Multiline text rendering is misaligned #5264

Open pjanx opened 2 weeks ago

pjanx commented 2 weeks ago

Checklist

Describe the bug

Fyne seemingly doesn't bother to pixel align text when rendering, and so it often ends up fuzzy. See the animated screenshot.

How to reproduce

Have a lot of lines of text in your application.

Screenshots

animated

Example code

package main

import (
    "strings"
    "time"

    "fyne.io/fyne/v2"
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/widget"
)

func main() {
    a := app.New()
    w := a.NewWindow("Bugs")
    w.Resize(fyne.NewSize(480, 360))
    me := widget.NewMultiLineEntry()
    w.SetContent(me)

    long := strings.Repeat("Lorem ipsum dolor sit amet\n", 60)
    short := strings.Repeat("Lorem ipsum dolor sit amet\n", 40)
    var which bool
    t := time.NewTicker(time.Second / 2)
    go func() {
        for {
            <-t.C
            which = !which
            if which {
                me.SetText(long)
            } else {
                me.SetText(short)
            }
            me.TypedKey(&fyne.KeyEvent{Name: fyne.KeyPageDown})
        }
    }()
    w.ShowAndRun()
}

Fyne version

2.5.2

Go compiler version

1.23.2

Operating system and version

Linux

Additional Information

No response

andydotxyz commented 1 week ago

It does try to pixel align the text. It seems you have found a case where it fails.

Can you please provide full information about your monitor / resolution and any scaling applied by the operating system?

Also, if you run "fyne_demo" and go to the Advanced screen what does it report for scaling?

pjanx commented 1 week ago

This was recorded without scaling, just scaled up twice without filtering to make it clearer, but I can generally test it just about everywhere, if you wait.

andydotxyz commented 1 week ago

Please check the scale info from fyne_demo. User scale settings are only 1 of 3 possible sources of scaling on the output device.

pjanx commented 1 week ago

Please check the scale info from fyne_demo

Like I stated, and also just run the example, fyne

Problematic platforms include:

andydotxyz commented 1 week ago

Perfect thanks