3

When I try to use Xming with WSL to run GUI programs, I see fonts with grayscale anti-aliasing, like with Firefox as you can see here:

Screenshot

This happens with every distro I've tried (Arch and Ubuntu), and it makes me want to poke my eyes out, but for the life of me I can't figure out how to fix it.

(Note: If you have a high DPI screen, the image will be blurry—you can press F12 and run this Javascript code to scale down: document.body.style.zoom = 1 / window.devicePixelRatio.)

What is the cause of this problem? Is the problem with Xming or with the distro? I've tried following all of the advice on Xming's website to no avail.

  • Is that only for Arch? I didn't look so close before. – Biswapriyo May 19 '18 at 13:07
  • @Biswapriyo: You know, I had this problem on an older Ubuntu too (16.04 I think?), but now that I try it on the Ubuntu I just installed yesterday (18.04, testing via xterm -fa 'Ubuntu Mono' -fs 12 like I had for Arch earlier) I don't seem to have this problem. Not sure what the reason might be. – Mehrdad May 19 '18 at 20:21
  • @Biswapriyo: I figured it out -- it's because I'm using the same home directory which has the same fonts.conf. That's the fix on Ubuntu too. – Mehrdad May 19 '18 at 20:50
4

(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-keys --populate as explained here.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.