11

Everytime I try to install fonts in my work Windows 7 machine, I get the error:

"The requested file <font file>.ttf is not a valid font file" 

I'm using reputable fonts sources, like Google Fonts. An example of font is Work Sans.

This informative question, gives the weird solution of turning on the Windows Firewall to install the font. Since I'm not an admin, I can't turn it on.

Due to the uninformative Windows error message, I'd like to know if I can do something, or if I've been wasting my time trying to install a personal font.

neves
  • 519

3 Answers3

11

Assuming your problem is not being able to install a font without admin rights, below is a solution that does not require admin or additional executables (so will work even with an extremely locked-down computer):

Load a font in Windows using PowerShell

Save the below script as a PowerShell script file somewhere on your machine, next to the TTF and OTF files you want to install:

Add-Type -Name Session -Namespace "" -Member @"
[DllImport("gdi32.dll")]
public static extern int AddFontResource(string filePath);
"@

$null = foreach($font in Get-ChildItem -Recurse -Include *.ttf, *.otf) {
    [Session]::AddFontResource($font.FullName)
}

This script will scan for .ttf and .otf font files in the directory it's running from, and temporarily install them without needing admin access.

The main disadvantage of this is script is that it will only install the font for the duration of your current session. Once you log off or restart your system, you will need to run it again, but that could be automated (depending on how your computer is configured, such as whether it allows running .ps scripts on startup).

Pabru
  • 1,335
5

I have just stumbled upon a solution, which I have not tried:

  1. Install PortableApps.com Platform
  2. During the installation choose “Select a custom location…” and select a folder that you can modify without admin rights (IMPORTANT STEP)
  3. Create a Fonts folder within PortableApps\PortableApps.com\Data
  4. Copy your font files inside this folder
  5. Close and restart PortableApps
  6. That's it :)

Source: https://woorkup.com/install-fonts-without-administrator-access/

Hope this works for you

phuclv
  • 30,396
  • 15
  • 136
  • 260
mhham
  • 201
1

Adding/removing system fonts is an Administrator task because someone could really mess up Windows by deleting or replacing standard system fonts. Unless you are given permissions to have write access in the \Windows\Fonts folder than you will not be able to add fonts.

ProdIssue
  • 405