Why are WSL GUI apps rendered with blurry fonts with Xming?

Solution 1:

(Updated to also address VSCode)

For some programs, the solution is to just add this to ~/.config/fontconfig/fonts.conf:

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>   <!-- try hintmedium if it looks bad -->
    <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
    <edit name="rgba" mode="assign"><const>rgb</const></edit>             <!-- set to match your display -->
  </match>
</fontconfig>

For these programs, after you do this, you should get nice, smooth rendering, like I did here:

Screenshoot

However, for other programs, such as for Visual Studio Code (which uses Electron), you need to also install freetype2-cleartype. As Arch's manual explains, the initial cause of the problem is Microsoft patents preventing subpixel rendering, and that, in order to fix this, freetype2-cleartype can be installed from AUR either manually, or via the following (note that I'm skipping signature checking here to make it work for me):

yaourt --m-arg "--skippgpcheck" -S --needed freetype2-cleartype

If you don't have yaourt, you'll want to compile and install that from its AUR repo, and if when doing that you get GPG errors and the usual sudo pacman-key --refresh-keys doesn't work, you'll want to run sudo pacman-key --populate as explained here.