Existe-t-il un moyen de fix blurry fonts in linux GUI applications when being run from WSL (Ubuntu 18.04) using the default Windows scaling? Things J'ai tried jusqu'à présent:
With Xming:
- Tried disabling Windows scaling and setting it from linux side using `GDK_DPI_SCALE=2.5`, the problem with this is several things like context menu icons don't play nicely and are often not scaled. Without `GDK_DPI_SCALE=2.5`, applications are basically unusable since the text is extremely tiny.
- Tried installing all the fonts from C:\Windows\Fonts to `C:\Program Files\Xming\fonts\TTF` and running `mkfontscale`, couldn't make it work this way either.
- Tried using VcXsrv, has the same issue.
## Screenshots
- Clion:
- Comparison between emacs (WSL) and VS Code (Windows native)
All the resources J'ai looked up jusqu'à présent:
- [Why are WSL GUI apps rendered with blurry fonts with Xming?](https://superuser.com/questions/1324140/why-are-wsl-gui-apps-rendered-with-blurry-fonts-with-xming): The answer here is specifically for just firefox and electron based applications.
- [Gnome-Terminal blurry on Xming](https://www.reddit.com/r/bashonubuntuonwindows/comments/686zxw/gnometerminal_blurry_on_xming/): Doesn't have anything helpful in particular either other than a suggestion to disable scaling and using something else than Xming.
- [DPI issues running GUI programs on a 4K screen](https://www.reddit.com/r/bashonubuntuonwindows/comments/77a5ni/dpi_issues_running_gui_programs_on_a_4k_screen/): Suggests using VcXsrv.
The main purpose of doing all this is to be able to run text editors(emacs)/IDE(Clion) from WSL. And, the reason I cannot install their windows equivalent is we develop only for linux.
Few system details:
## Screen
4K (3840x2160) - 15.6"
## OS
-
**Windows**: Windows 10 Home v1803 Build: 17134.345
-
**WSL**: Ubuntu 18.04 (`Linux username 4.4.0-17134-Microsoft #345-Microsoft Wed Sep 19 17:47:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux`)
Blurry fonts on using Windows par défaut scaling avec WSL GUI applications (HiDPI)
Re: Blurry fonts on using Windows par défaut scaling avec WSL GUI applications (HiDPI)
**Disclaimer:** The following procedure may vary with the actual hardware in system. The settings may change in your setup.
First, enable high DPI settings for the X server executable. Close any running instance of that X server. Ouvrez le folder where you have installed the X Server e.g. VcxSrv, Xming, X410 etc. Here I choose `D:\MyFolder` and VcxSrv as example. Open that folder, clic droit on `vcxsrv.exe` for VcxSrv or `Xming.exe` for Xming. Choose Properties > Compatibility tab > Change high DPI settings > Enable Override high DPI scaling > change to 'Application' (or 'System Enhanced' option). Here is the screenshot looks like after changing the settings:
Also do the above steps for `xlaunch.exe` file. This change will add the following registry values:
`[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"D:\\MyFolder\\xlaunch.exe"="~ HIGHDPIAWARE"
"D:\\MyFolder\\vcxsrv.exe"="~ HIGHDPIAWARE"
```
Next, override GTK+ settings for the X11 environment. [This Gnome article](https://developer.gnome.org/gtk3/stable/gtk-x11.html) has in-depth view of the environment variables. `GDK_SCALE` will scale the windows by specific factor. `GDK_DPI_SCALE` will scale DPI for scale aware applications. Enable the settings with the following commands in bash (or other shell).
`export GDK_SCALE=0.5
export GDK_DPI_SCALE=2
```
Change those value according to your system. Now execute the X server and the X11 programs. [This reddit thread](https://www.reddit.com/r/bashonubuntuonwindows/comments/7s3jav/on_high_resolution_monitor_x_apps_are_blurry/) also helps.
First, enable high DPI settings for the X server executable. Close any running instance of that X server. Ouvrez le folder where you have installed the X Server e.g. VcxSrv, Xming, X410 etc. Here I choose `D:\MyFolder` and VcxSrv as example. Open that folder, clic droit on `vcxsrv.exe` for VcxSrv or `Xming.exe` for Xming. Choose Properties > Compatibility tab > Change high DPI settings > Enable Override high DPI scaling > change to 'Application' (or 'System Enhanced' option). Here is the screenshot looks like after changing the settings:
Also do the above steps for `xlaunch.exe` file. This change will add the following registry values:
`[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"D:\\MyFolder\\xlaunch.exe"="~ HIGHDPIAWARE"
"D:\\MyFolder\\vcxsrv.exe"="~ HIGHDPIAWARE"
```
Next, override GTK+ settings for the X11 environment. [This Gnome article](https://developer.gnome.org/gtk3/stable/gtk-x11.html) has in-depth view of the environment variables. `GDK_SCALE` will scale the windows by specific factor. `GDK_DPI_SCALE` will scale DPI for scale aware applications. Enable the settings with the following commands in bash (or other shell).
`export GDK_SCALE=0.5
export GDK_DPI_SCALE=2
```
Change those value according to your system. Now execute the X server and the X11 programs. [This reddit thread](https://www.reddit.com/r/bashonubuntuonwindows/comments/7s3jav/on_high_resolution_monitor_x_apps_are_blurry/) also helps.