Font settings not working for WSL apps that draw over the entire screen #263

Closed
opened 2026-01-30 21:47:12 +00:00 by claunia · 22 comments
Owner

Originally created by @KireinaHoro on GitHub (May 15, 2018).

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.17134.48]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

    • Launch WSL console
    • Set default font to something other than the default font (e.g. on a system with MS Gothic as the default
      font, choose Source Code Pro instead in Default Values), then reopen the window;
    • Install and launch apps that redraws the entire screen (e.g. mosh, tmux, vim, etc.)
    • Exit from the app

One should not experience font change in the process

  • What's wrong / what should be happening instead:

The font gets reverted to the default font (in my case MS Gothic) as soon as tmux gets started, and sometimes the font reverts back to the font I selected when it exits (either finishes executing and exits or detaches), sometimes it doesn't. Setting the font in "Properties" does change the font, but the setting doesn't get preserved.

On exit, the font gets reverted to the default one shortly, and then the window closes.

image
image

Originally created by @KireinaHoro on GitHub (May 15, 2018). * Your Windows build number: (Type `ver` at a Windows Command Prompt) Microsoft Windows [Version 10.0.17134.48] * What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots) * Launch WSL console * Set default font to something other than the default font (e.g. on a system with MS Gothic as the default font, choose Source Code Pro instead in Default Values), then reopen the window; * Install and launch apps that redraws the entire screen (e.g. mosh, tmux, vim, etc.) * Exit from the app One should not experience font change in the process * What's wrong / what should be happening instead: The font gets reverted to the default font (in my case MS Gothic) as soon as tmux gets started, and sometimes the font reverts back to the font I selected when it exits (either finishes executing and exits or detaches), sometimes it doesn't. Setting the font in "Properties" does change the font, but the setting doesn't get preserved. On exit, the font gets reverted to the default one shortly, and then the window closes. ![image](https://user-images.githubusercontent.com/7804730/40042667-bf6e221e-5854-11e8-811f-ed1e598746c6.png) ![image](https://user-images.githubusercontent.com/7804730/40042685-cf98aede-5854-11e8-956e-9a190aa9afac.png)
Author
Owner

@dacapoday commented on GitHub (May 19, 2018):

same with you

@dacapoday commented on GitHub (May 19, 2018): same with you
Author
Owner

@pcmaniac23 commented on GitHub (Jun 2, 2018):

I have the same issue.

Also the window size changes, not just the font.
e.g. when I am in shell, the height x width might be, say, 40 x 150. But when I go into an application (vim, man pages...etc) that gets displayed over the entire terminal window, the Window's size gets changed to another size (I suspect it goes back to default Cmd window size). The font also gets changed back to the default font for the Cmd window.

It feels like as if when I go into an application from the Shell, settings such as size and font gets changed back to default, however the color settings stays (thank goodness)

@pcmaniac23 commented on GitHub (Jun 2, 2018): I have the same issue. Also the window size changes, not just the font. e.g. when I am in shell, the height x width might be, say, 40 x 150. But when I go into an application (vim, man pages...etc) that gets displayed over the entire terminal window, the Window's size gets changed to another size (I suspect it goes back to default Cmd window size). The font also gets changed back to the default font for the Cmd window. It feels like as if when I go into an application from the Shell, settings such as size and font gets changed back to default, however the color settings stays (thank goodness)
Author
Owner

@mikelu commented on GitHub (Jul 5, 2018):

having the same issue.

workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment

@mikelu commented on GitHub (Jul 5, 2018): having the same issue. workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment
Author
Owner

@Tantalus13A98B5F commented on GitHub (Jul 6, 2018):

Same here. Microsoft Windows [Version 10.0.17134.112]. The font also changes when the window is loading or quitting. Both setting the default values and properties still cannot work.

@Tantalus13A98B5F commented on GitHub (Jul 6, 2018): Same here. Microsoft Windows [Version 10.0.17134.112]. The font also changes when the window is loading or quitting. Both setting the default values and properties still cannot work.
Author
Owner

@ghost commented on GitHub (Oct 8, 2018):

Same here. By the way, is this issue about WSL? or just an issue that I can solve with the application setting?

@ghost commented on GitHub (Oct 8, 2018): Same here. By the way, is this issue about WSL? or just an issue that I can solve with the application setting?
Author
Owner

@ghost commented on GitHub (Oct 11, 2018):

Same here on Windows [Version 10.0.17134.345].
I changed default font to Ubuntu Mono but it gets reverted to its original setting when I run applications like vim or man.

@ghost commented on GitHub (Oct 11, 2018): Same here on Windows [Version 10.0.17134.345]. I changed default font to Ubuntu Mono but it gets reverted to its original setting when I run applications like vim or man.
Author
Owner

@zadjii-msft commented on GitHub (Oct 11, 2018):

Filed a bug internally to investigate. I think I know why this might be happening, for whatever reason the alt-buffer used by tmux and vim (et al) either isn't getting the font setting or the codepage setting. My guess is it's not getting the codepage, and then it's re-calculating the font it should use, and defaulting to the default codepage instead of the utf-8 codepage.

@zadjii-msft commented on GitHub (Oct 11, 2018): Filed a bug internally to investigate. I think I know why this might be happening, for whatever reason the alt-buffer used by tmux and vim (et al) either isn't getting the font setting or the codepage setting. My guess is it's not getting the codepage, and then it's re-calculating the font it should use, and defaulting to the default codepage instead of the utf-8 codepage.
Author
Owner

@windtoostrong commented on GitHub (Nov 27, 2018):

not sure if it's the same problem with my WSL. I've configured my console default font successfully, but i can't change my vim font setting, no change even with :set guifont=Consolas\ h12 inside vim.

@windtoostrong commented on GitHub (Nov 27, 2018): not sure if it's the same problem with my WSL. I've configured my console default font successfully, but i can't change my vim font setting, no change even with :set guifont=Consolas\ h12 inside vim.
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 27, 2018):

@windtoostrong

If you're using vim in the console, guifont doesn't do anything (and cannot do anything.)
If you're using gvim/xvim, you need to say Consolas:h12 (: instead of .)

@DHowett-MSFT commented on GitHub (Nov 27, 2018): @windtoostrong If you're using vim in the console, `guifont` doesn't do anything (and cannot do anything.) If you're using gvim/xvim, you need to say `Consolas:h12` (`:` instead of ` `.)
Author
Owner

@windtoostrong commented on GitHub (Nov 28, 2018):

It's vim in the console, it just go with my console configuration. Don't know why Consolas doesn't seem to work for me. I switched to use Microsoft Yahei Mono, my vim and console now shares the same font and works fine.

@windtoostrong commented on GitHub (Nov 28, 2018): It's vim in the console, it just go with my console configuration. Don't know why Consolas doesn't seem to work for me. I switched to use Microsoft Yahei Mono, my vim and console now shares the same font and works fine.
Author
Owner

@lnyng commented on GitHub (Dec 9, 2018):

I also have this problem. I found a workaround by using Inziu IosevkaCC SC from http://typeof.net/Iosevka/.

@lnyng commented on GitHub (Dec 9, 2018): I also have this problem. I found a workaround by using Inziu IosevkaCC SC from http://typeof.net/Iosevka/.
Author
Owner

@zadjii-msft commented on GitHub (Jan 4, 2019):

I've tried reproing this internally for a bit now and I can't get this behavior to repro. I've tried on a VM with MS Gothic as the default font, and I can't get the alt buffer to revert back to the default font in any scenario.

It's entirely possible that this was fixed in RS5 (the November 2018 Update). There was also a decent amount of code delta in that area since RS5, which could have also mitigated the issue. Without being able to repro it, I won't be able to track the fix down.

If someone can confirm that this is still occurring on a recent Insider's build, I'll reopen the investigation, but until then I'm marking it as not repro.

@zadjii-msft commented on GitHub (Jan 4, 2019): I've tried reproing this internally for a bit now and I can't get this behavior to repro. I've tried on a VM with MS Gothic as the default font, and I can't get the alt buffer to revert back to the default font in any scenario. It's entirely possible that this was fixed in RS5 (the November 2018 Update). There was also a decent amount of code delta in that area since RS5, which could have also mitigated the issue. Without being able to repro it, I won't be able to track the fix down. If someone can confirm that this is still occurring on a recent Insider's build, I'll reopen the investigation, but until then I'm marking it as not repro.
Author
Owner

@goomario commented on GitHub (Jan 10, 2019):

I also encountered a problem with resetting fonts. It is recommended to use Xshell with ssh to temporarily replace the default console.

@goomario commented on GitHub (Jan 10, 2019): I also encountered a problem with resetting fonts. It is recommended to use **Xshell** with ssh to temporarily replace the default console.
Author
Owner

@sfengyuan commented on GitHub (Feb 14, 2019):

It works!

Like @zadjii-msft said, the problem is Windows can not change the cmd.exe code page permanently, WSL/Bash use utf8 code page which different from cmd.exe usually, so we need to find a font that both supports utf8 and your current default code page of cmd.exe.

The font that @lnyng pointed out works for me.

@sfengyuan commented on GitHub (Feb 14, 2019): **It works!** Like @zadjii-msft said, the problem is Windows can not change the cmd.exe code page permanently, WSL/Bash use utf8 code page which different from cmd.exe usually, so we need to find a font that both supports utf8 and your current default code page of cmd.exe. The font that @lnyng pointed out works for me.
Author
Owner

@musma21 commented on GitHub (Feb 17, 2019):

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

@musma21 commented on GitHub (Feb 17, 2019): Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works : Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage] "ACP"="1252" "MACCP"="10000" "OEMCP"="437"
Author
Owner

@jindingi commented on GitHub (Feb 28, 2019):

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

that works for my vim, thanks!

@jindingi commented on GitHub (Feb 28, 2019): > > > Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works : > > Windows Registry Editor Version 5.00 > > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage] > "ACP"="1252" > "MACCP"="10000" > "OEMCP"="437" that works for my vim, thanks!
Author
Owner

@miniksa commented on GitHub (May 18, 2019):

Looks like this solved itself. Resolving.

@miniksa commented on GitHub (May 18, 2019): Looks like this solved itself. Resolving.
Author
Owner

@Po-wei commented on GitHub (May 22, 2019):

The bug reproduce in 1903 clean install.
The default font is MingLiU. Then I change it to consolas.
Open htop or vim, change back to consolas.

SO I use wsltty as a workaround.

@Po-wei commented on GitHub (May 22, 2019): The bug reproduce in 1903 clean install. The default font is MingLiU. Then I change it to consolas. Open htop or vim, change back to consolas. SO I use wsltty as a workaround.
Author
Owner

@hzhangxyz commented on GitHub (Jul 5, 2019):

use regedit and add CodePage=65001 in HKCU\Console\C:.....Debian....exe\ solve my problem.
after this launch full screen program won't reset font again.

@hzhangxyz commented on GitHub (Jul 5, 2019): use regedit and add CodePage=65001 in HKCU\Console\C:.....Debian....exe\ solve my problem. after this launch full screen program won't reset font again.
Author
Owner

@lshghkh commented on GitHub (Jul 22, 2019):

Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"ACP"="1252"
"MACCP"="10000"
"OEMCP"="437"

This worked for my Vim and Tmux after a reboot! Thx!

@lshghkh commented on GitHub (Jul 22, 2019): > Not sure if this bug has been fixed already, anyway, in my case, just changing the code page of command prompt works : > > Windows Registry Editor Version 5.00 > > [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage] > "ACP"="1252" > "MACCP"="10000" > "OEMCP"="437" This worked for my Vim and Tmux after a reboot! Thx!
Author
Owner

@jingkungao commented on GitHub (Feb 16, 2020):

having the same issue.

workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment

This fixes my problem. Thanks!

@jingkungao commented on GitHub (Feb 16, 2020): > > > having the same issue. > > workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment This fixes my problem. Thanks!
Author
Owner

@Cl1p commented on GitHub (Mar 7, 2021):

having the same issue.

workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment

This works just fine on my terminal, thanks !

@Cl1p commented on GitHub (Mar 7, 2021): > having the same issue. > > workaround is changing TERM=xterm-256color to TERM=xterm-color in registry DefaultEnvironment This works just fine on my terminal, thanks !
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#263