Blurry text when using fractional scaling on Wayland

IntelliJ IDEs - like other Java applications - use X11 to talk to the Xorg server and render on Linux. When running on a desktop with Wayland (like Ubuntu 21.04), Java actually continues to work through X11, but this time the Xorg server is implemented by XWayland, providing a migration path for the applications that don't (yet) use Wayland directly. 

Without fractional scaling enabled, XWayland simply lets X applications render the same way as under "pure" Xorg suggesting the desired DPI through the Xft.dpi X resource value. In this configuration, text is rendered as sharp as under “pure” Xorg.

With the fractional scaling feature enabled, any scale above 100% - fractional or not - reduces the screen size available to X applications proportionally. For example, this is what an X application sees with "fractional" scaling of 200%:

$ xrandr --current
Screen 0: minimum 16 x 16, current 1280 x 800, ...

and this is with the same scaling of 200%, but fractional scaling disabled:

$ xrandr --current
Screen 0: minimum 16 x 16, current 2590 x 1664, …

As you can see, the screen size with fractional scaling is roughly twice as small. So in this mode Wayland provides a smaller screen to X windows that are then pixel-stretched according to the system's scaling factor. This makes the window's contents look somewhat blurry, which is most noticeable with text. The effect can be seen with any "pure" X application like XTerm, for instance. 

Many applications have already been ported to use Wayland, either directly or through a toolkit like Gnome. Java is on its way to be ported. The Wayland rendering pipeline project has just started (see  the announcement) and JetBrains has joined this initiative. 

Until Java has learned to use Wayland natively or until the fractional scaling feature of Wayland is reworked to avoid pixel-stretching X windows, workarounds for blurry text would be to

  • switch off fractional scaling ([link1] [link2]) or
  • go back to using "pure" X session without Wayland ([link]). 

References

Please sign in to leave a comment.

Have more questions?

Submit a request