pop-os / cosmic-edit

COSMIC Text Editor
GNU General Public License v3.0
232 stars 54 forks source link

Bad font rendering when fractionally scaled #140

Open flukejones opened 7 months ago

flukejones commented 7 months ago

The screenshot demonstrates the issue. Fractional scaling is 125% here. It happens on most scales except integer.

image

Not sure what other info is valuable. This does happen in both KDE and Cosmic.

XV-02 commented 7 months ago

Can you provide the version of Cosmic-Edit you're using?

This can be found on Pop!_OS, Ubuntu, and many other Debian derivatives by running the following in a terminal:

apt policy cosmic-edit

I just need the value next to Installed:

flukejones commented 7 months ago

@XV-02 I run fedora and install from git (just updated to today).

Details of my setup are:

Operating System: Fedora Linux 40 KDE Plasma Version: 6.0.0 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.2 Kernel Version: 6.8.0-0.rc6.49.fc40.x86_64 (64-bit) Graphics Platform: Wayland Processors: 20 × 13th Gen Intel® CoreT i7-13700H Memory: 31.0 GiB of RAM Graphics Processor: Mesa Intel® Graphics Manufacturer: ASUSTeK COMPUTER INC. Product Name: ROG Zephyrus M16 GU604VY_GU604VY_00130747B System Version: 1.0

I run both KDE and Cosmic.

flukejones commented 7 months ago

Turned out I had a copy of cosmic-edit in my user bin dir, so i was never actually seeing updates when I rebuilt sysext.

flukejones commented 6 months ago

image

Re-opening as this is still true. Running bcc1ad82840c4109025b7389df953893ee4cce83

flukejones commented 6 months ago

From what I can see the bad rendering is in set places (at default window size here)

mmstick commented 6 months ago

What graphics card and driver do you have? Does it look like this if you change the WGPU renderer, or disable GPU rendering by removing the wgpu feature from libcosmic?

flukejones commented 6 months ago

Hmm:

Using mesa 24.0.0 for Intel, 550.54.14 for nvidia. I'll try without wgpu feature if I have time.

jackpot51 commented 6 months ago

The main reason for this is that the custom control cosmic-edit uses for text renders it to an image and the image size is calculated based on the logical size multiplied by the scale factor. When using a fractional size, that can sometimes end up being a size that doesn't exactly fit into integer logical pixels and then it scales incorrectly. I'm going to replace this workaround now that iced directly supports rendering cosmic_text buffers.

flukejones commented 6 months ago

Ah I see, that explains why resizing to a particular size helped.

jackpot51 commented 6 months ago

This is partially improved by 2bfcfdf. It searches for a pixel size that is an integer in both the logical and physical coordinates. Unfortunately it does not work fully with the wgpu renderer. When I have more time I will switch to using a different rendering technique that will both improve performance and fix this issue when using the wgpu feature.