How to fix WSL(Windows Subsystem for Linux) font on Windows 10

This problem seems to be mentioned in two bug reports:

  • Font in WSL Console window changes to Raster Fonts when Running a powershell.exe command with Consolas font #367

  • Windows 10 1809/19H1/20H1 breaks Powershell's console settings. Keeps opening with raster fonts. #280.

There is no clear response from the developers about the problem. Some explanation is given in the second link:

It was only detected in 1809 because the default font for the console was Consolas. Prior to that, I believe it was Lucida Console? And the code worked the same way for that font. My understanding of that code (which has been there since forever and prior to my team on the PowerShell Team) is that in the Windows sources, we only have one shortcut used for PowerShell and that shortcut defines the default font. So when the default font was changed, East Asian users complained as their glyphs weren't being rendered since the font doesn't support it. So this code detects that the font and locale aren't compatible and switches it to one that will render.

I'm hesitant on making any changes in Windows PowerShell as even seemingly small changes like this lead to unexpected regressions.

A workaround was suggested in the first link (which didn't work for everyone), was to change FaceName to the font used in WSL Console in the registry at keys:

HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe
HKEY_CURRENT_USER\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe

My value for FaceName is currently Lucida Console.

In the first link it was remarked also:

Observation: if you have a BAT file where you call powershell script.ps1 two times the second call resets font to raster.

Inserting chcp 437 between the calls helps.

The conclusion is that this was always broken, but the problem is only now appearing because Windows version 1809 changed the default font to Consolas. Changing the default font in FaceName to either Lucida Console or Consolas might help, not to solve the bug but perhaps to hide it a bit. Adding chcp commands before the call to PowerShell might also help.

The only real solution would be if Microsoft fixed the bug, but it seems that the code involved is rather old, so that the current PowerShell team is hesitant about modifying it.