PPOSHGROUP / PPoShTools

MIT License
5 stars 0 forks source link

Question: Is it possible to add a local user font? #15

Open coolaj86 opened 3 years ago

coolaj86 commented 3 years ago

I'm looking at your Add-Font script here: https://github.com/PPOSHGROUP/PPoShTools/blob/master/PPoShTools/Public/FileSystem/Add-Font.ps1

I tried adapting it to use HKCU and $Env:UserProfile\AppData\Local\Microsoft\Windows\Fonts (so that it can be used without requiring administrator privileges) ... but Windows Terminal is not able to find the font I've installed.

Do you have any pointers?

P.S. The specific project I'm working on is to fix https://github.com/webinstall/webi-installers/issues/228 for the Nerd Font webinstall.dev installer: https://github.com/webinstall/webi-installers/blob/master/nerdfont/install.ps1.

DomBros commented 3 years ago

try to use: https://www.powershellgallery.com/packages/RunAsUser

pon., 26 kwi 2021 o 08:47 AJ ONeal @.***> napisał(a):

I'm looking at your Add-Font script here: https://github.com/PPOSHGROUP/PPoShTools/blob/master/PPoShTools/Public/FileSystem/Add-Font.ps1

I tried adapting it to use HKCU and $Env:UserProfile\AppData\Local\Microsoft\Windows\Fonts (so that it can be used without requiring administrator privileges) ... but Windows Terminal is not able to find the font I've installed.

Do you have any pointers?

P.S. The specific project I'm working on is to fix the Nerd Font webinstall.dev installer: https://github.com/webinstall/webi-installers/blob/master/nerdfont/install.ps1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PPOSHGROUP/PPoShTools/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/AENKXVNBB775USYY7L3IAXDTKUEAXANCNFSM43SHDA3A .

-- Pozdrawiam, Tomasz Dąbrowski.

coolaj86 commented 3 years ago

Thanks for the reply.

Although a bit hokey, I already have a Windows sudo (https://webinstall.dev/sudo/) which is what I used for the WSL installer (https://webinstall.dev/wsl).

However, my point is to not require admin privileges for things that should be able to live without them. My understanding is that fonts can be installed to HKCU and local user AppData - and I even had it working for session-only user-only unprivileged font loading, but I'm trying to get permanent unprivileged font loading.

In Windows 10 1809 non-admin users can install fonts for themselves.

Seems it must be possible. Re: https://web.archive.org/web/20200322113553/https://docs.microsoft.com/en-us/windows-insider/at-home/whats-new-wip-at-home-1809

mczerniawski commented 3 years ago

Yes, it's possible to install fonts using User privs only, but not with this function:( It registers this font globally - and to do so need to set up flags $copyFlag = [string]::Format("{0:x}",4+16)

This is the part where admin privs are required.