Use Windows Fonts in WSL
Out of the box, it seems like WSL comes with only a limited set of fonts. While for a CLI environment this might (?) be adequate, when we start using GUI apps in WSL (which it now supports via WSLg), font support would really start to matter. When I was using web-browsers like qutebrowser and surf on WSL, I found that most glyphs were not rendered. Furthermore, while using the gnome-tweaks tool which lists the fonts available, the list was very short. The available fonts can also be viewed with
fc-list
which is basically the font-config utility. Our plan is to use fonts installed in Windows instead of installing any more, following this guide.
Windows fonts reside primarily in two locations:
- Default fonts in C:/Windows/Fonts directory (if installed for all users)
- User-installed fonts in %USERPROFILE%/AppData/Local/Microsoft/Windows/Fonts directory (if installed per-user)
We need to refer to these two locations. For that, we go to
cd /etc/fonts
and create a new configuration file local.conf with admin privileges:
sudo vi local.conf
and write the following
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/mnt/c/Windows/Fonts</dir>
<dir>/mnt/c/Users/user-name/AppData/Local/Microsoft/Windows/Fonts</dir>
</fontconfig>
where we have translated the paths to Linux-style paths. The second directory addition is a little iffy because it depends on the username (“user-name”). We can skip the second addition if one installs all fonts for all users: Right-click on font > Install for all users.
Next we can refresh the font-cache:
fc-cache -fv
where -f
forces scan of directories where font-cache is present, -v
displays verbose output.