microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.46k stars 8.31k forks source link

'fontFace' not working for any profile after system reboot. #3257

Open Stadler76 opened 5 years ago

Stadler76 commented 5 years ago

Environment

Steps to reproduce

  1. Setup Windows Terminal (With Ubuntu subsystem)
  2. Set the fontFace for various profiles (Tested with powershell, cmd and Ubuntu WSL) Note, that everything was working as intended up to here.
  3. Restart Windows.

Expected behavior

The font setting being applied: grafik grafik

Actual behavior

After restarting Windows fontFace is being ignored: grafik grafik

Additional Info

My current profiles.json: profiles.txt

Stadler76 commented 5 years ago

I assume, issue #3250 is the same issue. Just wanted to create a new issue since that one is lacking any information.

DHowett-MSFT commented 5 years ago

Which font specifically are you using? "Powerline Fonts" isn't terribly descriptive.

Does the font work in other applications after rebooting? Can you share a screenshot of it working in Windows Terminal before rebooting? Thanks.

Stadler76 commented 5 years ago

Which font specifically are you using? "Powerline Fonts" isn't terribly descriptive.

Roboto Mono for Powerline at first, then Noto Mono for Powerline, DejaVu Sans Mono for Powerline and even with Courier New. It seems that every profile gets the fallback to the default font, no matter the fontFace-setting.

Does the font work in other applications after rebooting?

Outside of the terminal (Using the conhost setting dialogue the fonts work excluding Roboto Mono which is bugged atm (See #295, respectively google/fonts#1832), so that ones off the table for me).

Can you share a screenshot of it working in Windows Terminal before rebooting? Thanks.

Unfortunately I can't provide a screenshot from before restarting Windows. But I'll go check, if restarting Windows and/or reinstalling Terminal helps.

Stadler76 commented 5 years ago

Ok, reinstalling the terminal and or restarting Windows didn't work. What 'seems' to do the trick was deleting all newly installed Powerline fonts and reinstall them: grafik To reinstall all of them I've cloned the repo https://github.com/powerline/fonts with GitHub Desktop and ran the install.ps1 in powershell (Used Set-ExecutionPolicy Bypass before running that script).

Next will be another restart or two to see, if it breaks again.

Stadler76 commented 5 years ago

Ok, same issue after a restart. I've tried to install only a single set: DejaVu Sans Mono for Powerline. It worked, till I've restarted Windows.

In short: Reinstalling the font fixes it and restarting Windows breaks it again. Currently I'm too tired to hunt that issue down any more.

DHowett-MSFT commented 5 years ago

This is really fascinating! I wonder if it reproduces on v0.6? Sorry, I've never seen anything like this before, but we did make some font changes in that release.

DHowett-MSFT commented 5 years ago

Also, if you install the font "for all users" instead of just plain installing it, does it work after a reboot? This might be something fun for the font team to look at.

Stadler76 commented 5 years ago

@DHowett-MSFT wrote:

This is really fascinating! I wonder if it reproduces on v0.6? Sorry, I've never seen anything like this before, but we did make some font changes in that release.

Yes, it reproduces with: Windows Terminal (Preview) Version: 0.6.2951.0

Also, if you install the font "for all users" instead of just plain installing it, does it work after a reboot? This might be something fun for the font team to look at.

Yes, this works fine after a reboot. When installing it locally (What the install.ps1 actually does) it breaks after a restart, unless:

Did a couple more restarts and installing and uninstalling of fonts, what I've found out so far: I've installed Roboto Mono for Powerline locally and DejaVu Sans Mono for Powerline "for all users". I've switched between those two a couple times and everytime I hit save I saw Roboto broken and DejaVu working thanks to Terminal immediately updating.

So the steps to reproduce should be:

Steps to reproduce

  1. Setup oh-my-zsh with the agnoster theme (I guess oh-my-posh should show the same error).
  2. Now install one Powerline-font locally (for example Roboto Mono for Powerline) aka mark all font files → Right click → Install.
  3. Install one Powerline-font for all users (for example DejaVu Sans Mono for Powerline) aka mark all font files → Right click → Install for all users.
  4. Make sure the Windows FontCache service is running and set to start automatically (should be the default).
  5. Setup the profile to use the locally installed font and check, if it still works.
  6. Restart Windows.
  7. Restart Windows Terminal.
  8. Switch the fonts in the config back and forth between those two.

Expected behaviour

Both fonts always work.

Actual behavior

The globally installed (aka for all users) font works fine, the locally installed font breaks/won't load unless you restart the FontCache or disable the service before restarting Windows.

Stadler76 commented 5 years ago

Oh and btw: I wonder, if its the FontCache to blame or how Windows Terminal utilizes it. I guess a bit of both, since the issue with the FontCache described above only exists in the Terminal.

DHowett-MSFT commented 5 years ago

So, Terminal isn't doing anything special with the font cache. We're using DirectWrite, the text rendering API, like most other apps on the system are. Now, I've got one last crazy idea before I escalate this to the fonts team:

If you introduce a delay (say, 30-60 seconds) between steps 6 and 7 ... does it work for you?

Sorry to make you jump through so many hoops. ☚ī¸

Stadler76 commented 5 years ago

I doubt it does since I usually do a bunch of other thing before restarting the terminal, but I can test it one last time. Gimme a min or ten.

Stadler76 commented 5 years ago

Nope, that didn't WFM. I've waited ~10 mins between restarting Windows and (re)starting Windows Terminal.

Just for funsies I've recorded and cut a brief video, that shows the issue: Fontcache issue with locally installs font in Windows Terminal Preview

PS:

Sorry to make you jump through so many hoops. ☚ī¸

I've already planned to test with FontCache disabled 'n stuff. Thanks for the hint with the globally installed fonts, btw. And well: Through most of those hoops I've jumped voluntarily or otherwise it would leave me restless. 😉

DHowett-MSFT commented 5 years ago

:grin: Thanks for testing for me. I was concerned that Terminal was starting up before the font cache was, and the font cache was somehow not simply a cache, but you've handily blown that theory away.

I'm wrapping this all up to escalate to the team who owns font handling on Windows, since it looks like we're doing "everything we can" here.

Stadler76 commented 5 years ago

btw: I doubt, that its limited to powerline fonts. I assume, it would break with other locally installed fonts as well, but the extra glyphs of those fonts make it easier to visualize the issue.

tebeco commented 4 years ago

Just appeared in 0.7 for me (was ok in 0.6) I first updated Win10 to 10933.1 Fast Insider (i think i had 19030 before) Then updated the terminal from the store

I do Confirm on OMyZsh + Agnoster, and also OMyPsh

font installed Delugia Nerd Font Complete, https://github.com/adam7/delugia-code/releases/download/v1911.21/Delugia.Nerd.Font.Complete.ttf https://github.com/adam7/delugia-code/releases/tag/v1911.21

Only using local install too (double click > install), i did not try an "All user install"

What surprise me is that if you use Cascadia Code (no powerlines yet IIRC) or XXXX Powerlines right after boot up, the glyph are not rendered the same :

Cascadia Code goes likes empty square :

image

Delugia goes like the video of @stadler76 (char inside square) :

So it's not behaving the same, corrupted buffer or something ? image

suavelizard commented 4 years ago

The re-installing the font and restarting the terminal fixes it until the next reboot. Worth noting I believe the font also doesn't appear in the Windows 10 Fonts when doing a search until you re-install. Running Terminal version 0.9.433.0. Font: Meslo LGM.

tebeco commented 4 years ago

@suavelizard one of the workaround is to install the font System Wide and not for the user only. It should properly persist then (this is not optimal but it has fixed this behavior for me)

fabiodbr commented 4 years ago

Yes, installing font system wide fixes the issue.

Riiskyy commented 4 years ago

I came across this issue in Google after experiencing these exact same symptoms. I was using the Nerd Font patched Cascadia Code font (Delugia Nerd Font) and after every reboot the font face would not be recognized in VSCode (I had not opened Windows Terminal to see if it was the same but I suspect it would be).

If I went to Start -> Settings -> Personalisation -> Fonts and searched for the font it would not show in the list, but if I went to C:\Windows\Fonts\ I would see the font file there. I will see how it goes after performing a full reboot now that I have installed the font system wide.

Edit: confirmed font is still present after a reboot when installing system wide

Stadler76 commented 4 years ago

I was using the Nerd Font patched Cascadia Code font (Delugia Nerd Font) and after every reboot the font face would not be recognized in VSCode (I had not opened Windows Terminal to see if it was the same but I suspect it would be).

Good to know, that this is not a Terminal only issue. But I'm still curious, if this is 100% a font cache issue or if this can be fixed in Windows Terminal.

aasutossh commented 4 years ago

I have fonts installed (for all) in C:\Windows\Fonts directory, still Windows Terminal can't use it. Other system fonts can be recognized by the WT though.

Using WT Preview from MS store.

DHowett commented 4 years ago

@aasutossh your message was incomprehensible because of the email formatting, so I had to remove it.

aasutossh commented 4 years ago

What I previously said was, I installed the fonts using the right click option "install for all users", and they were present in the regedit too. But I still couldn't use them (they were nerd fonts).

So I patched the fonts myself and now I can use it. I stopped using ms terminal, I use alacritty now.

luizwhite commented 4 years ago

OMG! 😱😱 It was not just me! I have the exact same issue than @Riiskyy and @tebeco But I use WSL on VSCode

After reboot I always have to reinstall my fonts (MesloLGS NF and CaskaydiaCove NF) to work in Windows Terminal/VScode Terminal. If not, they behave as if the fonts have not been installed.

PS: I will test Font System Wide

luizwhite commented 4 years ago

I don't believe it.. It really fixes the problem when i right-click the .ttf and "Install for all users" Simple as that, after reboot all terminals looking fine with my OMZ powerlevel10k in Windows Terminal or VScode

EndyBoi commented 3 years ago

This is for anyone else who Googles up this issue. Using "Install for all users" was the solution for me as well.

However, go to Start -> Settings -> Personalisation -> Fonts and search for the font. The name there is the one you want to use. As for me Ubuntu Mono Nerd Font Complete Mono Windows Compatible did not work, but in the Fonts directory it shows as UbuntuMono NF and this has correctly worked between reboots and shutdowns.

Cheers @luizwhite @Riiskyy @tebeco big ups. I almost resorted to going to page 2 on Google.

ilqvya commented 3 years ago

Stupid JSON settings

Make a normal UI for such settings as in CMD.exe. Omg....

ilqvya commented 3 years ago

Holy crap... 1 year have been passed for the issue. I can't set the Cascadia Mono ExtraLight font face. Only can set default Cascadia Mono.

But in cmd.exe it works well....

This project is a mess....

qidydl commented 3 years ago

I experienced this same issue as well. It's especially confusing because the fonts are visible in Word and work fine there, but putting the same font name in Terminal appears to not work. "Install for all users" did resolve the problem for me as well.

ZHHHH9980 commented 3 years ago

This is for anyone else who Googles up this issue. Using "Install for all users" was the solution for me as well.

However, go to Start -> Settings -> Personalisation -> Fonts and search for the font. The name there is the one you want to use. As for me Ubuntu Mono Nerd Font Complete Mono Windows Compatible did not work, but in the Fonts directory it shows as UbuntuMono NF and this has correctly worked between reboots and shutdowns.

Cheers @luizwhite @Riiskyy @tebeco big ups. I almost resorted to going to page 2 on Google.

Oops!It works! "go to Start -> Settings -> Personalisation -> Fonts and search for the font " which can get the real name,so the icons won't just be the "□"

niklasb-ms commented 2 years ago

Hi, I'm trying to reproduce this issue to see if I can figure out why the fonts are disappearing, and hopefully fix the issue. So far, I haven't been able to get it to happen. I tried cloning the https://github.com/powerline/fonts repo and running the ./install.ps1 script at @Stadler76 described above. For me, the fonts are all installed successfully and remain installed after rebooting. They also remain installed after installing Terminal Preview and rebooting.

Speculating as to what might be happening, I can think of two possibilities. First, let me say that installing a font file basically should do three things:

  1. Copy the font file to a fonts folder
  2. Add the font file to the current Windows session
  3. Add a registry value that references the file

I suspect that either registry values are not being added in the first place, or they're being added and later removed (e.g., on reboot). Either one would explain the observed behavior. The font initially works because it's been added to the current session, but no longer appears after reboot because it's not in the registry.

I'm wondering if someone who can reproduce this would be willing to help me narrow it down by doing an experiment. Here is what I would like you to try if you are willing:

  1. Install the font or fonts the same way as before
  2. Check if registry values exist for the fonts (see below)
  3. Check if the font(s) appear in Settings / Personalization / Fonts
  4. Reboot
  5. Repeat steps 2-3

The registry values for per-user fonts are under "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts". You can export the key to a file using the following command:

reg.exe export "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" fonts.reg

Where fonts.reg is the output file and can be any file name you like. E.g., it could be after-install.reg the first time you run the command after after-reboot the second time.

Thanks, --Nick

Stadler76 commented 2 years ago

@niklasb-ms: Are you by any chance testing this on Windows 11? Because I narrowed it down to be an issue with Windows Font Cache. As you see in the video I recorded, it can be resolved by restarting the Font Cache or by disabling it. If Windows Terminal is running you need to restart it,

kiranraaj19 commented 2 years ago

image

I Changed the font in Windows Terminal > Settings > Default > Appearance > Font face, and i saw it concurrently change the "fontFace" object in settings.json to a "font": {"face": "{YOUR_FONT_HERE}"} object, I think the wsl2 has changed the code a bit resulting the fontFace to be deprecated.

cmdshft commented 2 years ago

Pardon my ignorance, because this is still an issue for me. How do I install a font system wide? I installed the fonts to C:\Windows\Fonts but after rebooting, Windows Terminal says it can no longer find the fonts. I did not have this issue before installed 2H22.

Stadler76 commented 2 years ago

Pardon my ignorance, because this is still an issue for me. How do I install a font system wide?

Right click -> Install for all users

simsrw73 commented 1 year ago

I'm wondering if someone who can reproduce this would be willing to help me narrow it down by doing an experiment. Here is what I would like you to try if you are willing:

  1. Install the font or fonts the same way as before
  2. Check if registry values exist for the fonts (see below)
  3. Check if the font(s) appear in Settings / Personalization / Fonts
  4. Reboot
  5. Repeat steps 2-3

@niklasb-ms

This issue never affected me until W11 Update 22H2. Now it happens every time I reboot.

  1. I clone https://github.com/ryanoasis/nerd-fonts. And run .\install.ps1 -WindowsCompatibleOnly Meslo
  2. Registry values exist.
  3. Fonts show here.
  4. Reboot

2.a. Registry values exist. I ran a diff on both output files and they are exactly the same. 2.b. Note also that font files exist in "C:\Users\simsrw73\AppData\Local\Microsoft\Windows\Fonts", both before and after reboot.

  1. Font does NOT appear in Settings.

Reinstalling the fonts corrects the issue until next reboot. And as reported above by @Stadler76, restarting the Windows Font Cache Service and restarting Terminal corrects the issue until next reboot.

This issue is driving me crazy. I will run any diagnostic you need, incl allowing remote access to see this resolved.

Output of the two commands after clean install of fonts (manually deleted all previous references to the font in registry and font files) and after reboot:

In both commands, output of before & after reboot are identical, but fonts no longer show in settings and are not available to use until reinstalled or font cache service is restarted (gsudo Restart-Service -Name "FontCache").

font-listings.zip

fredizzimo commented 1 year ago

Writing this here as well, since I accidentall wrote my reply in the closed #12587 issue, which looks like a duplicate.

For me it also started after the Window 11 22H2 update. It seems like it looses all user installed fonts.

The old control panel still shows the fonts, but they are missing from the new set settings Personalization/Fonts and Windows programs.

Like above, restarting the Windows Font Cache Service, seems to make it work again.

Enyer182 commented 1 year ago

Could anyone find any workaround yet? I'm having the same issue. I have Windows 10 Enterprise. My windows version is 22H2 tried installing powerline fonts from the repo above as the author did and exported the registry. I can see all the fonts are installed correctly everywhere, but the issue persists.

image

simsrw73 commented 1 year ago

The only workaround is to restart the FontCache service. I setup task scheduler to do this at startup

  1. Run taskschd
  2. Action menu -> Create Basic Task
  3. Name = Restart Font Cache
  4. Next
  5. Run task "When I log on"
  6. Next
  7. Action to perform = Start a program
  8. Next
  9. Program = powershell
  10. Add arguments = -WindowStyle Hidden -Command "Restart-Service -Name 'FontCache'"
  11. Next
  12. Check "Open the Properties dialog..."
  13. Finish
  14. On General tab, under Security options, check "Run with highest privileges"
  15. On the Triggers tab, Edit the "At log on" trigger, and change it to "Any user"
  16. Click OK
simsrw73 commented 1 year ago

Apparently, reinstalling Windows also fixes this. Just upgraded my GPU from Nvidia to AMD and Windows started crashing periodically. Even after using GPU driver removal tool and reinstalling AMD, so I tried reinstalling Windows. Both issues seem to be fixed. No crashing and No font problems in wt. No idea what causes the issue but, in my case, reinstalling Windows seems have resolved it. That is a horrible solution. I wish someone could have helped debug the cause of the issue.

Roundlay commented 1 year ago

Currently in the camp where none of the proposed workarounds remedy the issue for me. Anyone manage to resolve this issue with any of the Iosevka Nerd Fonts in a way not listed above?

rscircus commented 1 year ago

+1 Having this w/ multiple fonts. Victor Mono as of today.

dgarmire commented 1 year ago

I seem to have fixed this issue on Windows 11 latest updates as of 7/4/2023:

windows key -> services -> services (local) -> Windows Font Cache Service

In this window, select tab "Log On", and use "Local System Account", also check "Allow service to interact ..."

Click "Ok"

Then stop and start service

zadjii-msft commented 1 year ago

Okay so housecleaning time. Internally, this is tracked by MSFT:42103854.

After the last couple PRs we did in this area, we're pretty confident there's nothing more that we (the Terminal team) can do on our side here to mitigate this.

This is pretty clearly still an issue. I'm bumping the internal thread to see how we can get this fixed in the OS.

I've decided that even though there's nothing more we (the Terminal team) can do to fix this on our side, I'm going to leave this one open. Folks have a hard enough time searching for existing open issues, let alone closed ones. This is super painful when it does hit, so I think it warrants being left open regardless of if there's any work we can do to fix it.

I have no idea when this'll be fixed, but I'll make sure to share any relevant internal updates here in this thread.

arpadbarta commented 1 year ago

I seem to have fixed this issue on Windows 11 latest updates as of 7/4/2023:

windows key -> services -> services (local) -> Windows Font Cache Service

In this window, select tab "Log On", and use "Local System Account", also check "Allow service to interact ..."

Click "Ok"

Then stop and start service

Yoppe seems to work.

fuzzlebuck commented 1 year ago

I seem to have fixed this issue on Windows 11 latest updates as of 7/4/2023:

windows key -> services -> services (local) -> Windows Font Cache Service

In this window, select tab "Log On", and use "Local System Account", also check "Allow service to interact ..."

Click "Ok"

Then stop and start service

This worked for me too! after months of issues with the nerd fonts in Terminal and VSCode. Thank you!

ededdneddyfan commented 1 year ago

I seem to have fixed this issue on Windows 11 latest updates as of 7/4/2023:

windows key -> services -> services (local) -> Windows Font Cache Service

In this window, select tab "Log On", and use "Local System Account", also check "Allow service to interact ..."

Click "Ok"

Then stop and start service

Workaround confirming to still work as of today (10/23/23)

Dharmesh-IT commented 1 year ago

I seem to have fixed this issue on Windows 11 latest updates as of 7/4/2023: windows key -> services -> services (local) -> Windows Font Cache Service In this window, select tab "Log On", and use "Local System Account", also check "Allow service to interact ..." Click "Ok" Then stop and start service

Yoppe seems to work.

work for me same as of today (24-Oct-2023) with windows 11 latest version

lhecker commented 1 year ago

Please use upvotes/reactions if you agree with a post. A lot of people are subscribed to this thread and each confirmation pings everyone every time, so please avoid doing that. I'm collapsing the above comments as off-topic.

vanguard-bit commented 10 months ago

Pardon my ignorance, because this is still an issue for me. How do I install a font system wide?

Right click -> Install for all users

sorry...right click on what?