Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Unable to find the selected font MesloLGS NF" using Windows 11 #2730

Open
chybeat opened this issue Jul 16, 2024 · 0 comments
Open

Error "Unable to find the selected font MesloLGS NF" using Windows 11 #2730

chybeat opened this issue Jul 16, 2024 · 0 comments

Comments

@chybeat
Copy link

chybeat commented Jul 16, 2024

Hi all, this may be help to others. A nightmare popular OS (Windows 11) has another terrible issue when using powerlevel10k fonts (MesloLGS NF)

The O.S. (in some configurations) requires to install the fonts to be used in WSL/Ubuntu for all users. but the adorable and beatiful (F****G!) new context menu not have the option to install for administrators.

Replicating the issue:

  1. Windows 11 Pro without UAC (deactivated from control panel ). I choose this configuration to try run every app as administrator and avoid the special and awesome permission window.
  2. Using the normal (and suggested) .ttf file installation procedure installs the font "well" for current user (administrator for me). (Opening the ttf file and clicking on Install button, or from "install" option in file's context menu)
  3. When open Linux from Windows Terminal after fonts installation procedure, the next message give me a happy day:

image

" WARNING
Unable to find the selected font "MesloLGS NF".

"Consolas" has been selected instead.

Please either install the missing font or choose another one."

Then, the ubutntu command line shows like this:
image

Even runing the beautiful (but not efficient) Windows terminal or Visual Studio Code as Administrator , the problem persists, but I don't understand why!.

image

Possible "fixes"

- Run wsl.exe or/Winapp as administrator

If you run the linux distro as administrator from command line using the 'wsl.exe' command or clicking in the ubuntu app icon (ubuntu for me) found the font and works perfect (as the left windows on picture before). Bad luck to Vscode or Windows terminal. 😒

- Install the font for all users

The next link shows you the way to install a font for all users:
https://www.elevenforum.com/t/install-fonts-in-windows-11.5340/#One

The problem can be solved easy. If possible, the font installation instructions (procedure) can be updated for Windows 11 in main README.MD or fonts.md files in repository. Something like "Some configurations in Windows 11 require a right click on font file, click on 'Show more options' and then click over 'Install for all users'." or something more professional. I just want to share an idea.

**After installing the fonts using the instructions, both Vscode and Treminal, runs like a charm: **

image

My real problem is to make the installation "easy" using a powershell Script to use the "Install for all users" parameters: (if anyone wants to help 😉)

Clear-Host;
Write-Host "Downloading and Installing oh-myz-sh fonts...";

#Next line may be requires to add or change something, may be all :(
$fonts = (New-Object -ComObject Shell.Application).Namespace(0x14);

(@{
	name = 'MesloLGS NF Regular.ttf';
	url = 'https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf';
	},@{
		name = 'MesloLGS NF Bold.ttf';
		url = 'https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf';
	},@{
		 name = 'MesloLGS NF Italic.ttf';
		url = 'https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf';
	},@{
		 name = 'MesloLGS NF Bold Italic.ttf';
		url = 'https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf';
	}
) | ForEach-Object {
	$destFile = ${env:temp}+ "\" + $_.name;
	$fontFile = ${env:windir}+ "\fonts\" + $_.name;
	if (Test-Path -Path $destFile -PathType Leaf) {
		Remove-Item -Path $destFile -Force;
	}

	if(Test-Path -Path $fontFile -PathType Leaf) {
		Remove-Item -Path $fontFile -Force;
	}
	Write-Host "Downloading and installing font" $_.name;
	Invoke-WebRequest -URI ($_.url) -OutFile $destFile;
	Get-ChildItem $destFile | ForEach-Object{
		#Next line may be requires to add or change something, may be all :(
		$fonts.CopyHere($_.fullname)
	};
	if (Test-Path -Path $destFile -PathType Leaf) {
		Remove-Item -Path $destFile -Force;
	}
}

Please forget the irony and sarcam, my native lang is spanish and I try to write this in English to be have some fun compared my last 3 hours. The frustation to work Linux in Windows 11 for me is in the past. Now I think this helps to others ;), or may be not, but I'm ok 😊

Have a good and productive day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant