Andreas
Andreas

Reputation: 10067

How to find all fonts paths on Windows

I want to find all paths that contain font files that are installed on a Windows 10 system. Traditionally, fonts are installed in C:\Windows\Fonts but apparently, they can also be installed in different directories.

Specifically, I got a report from a user who has installed the font Albertus Extra Bold on Windows 10. When he opens C:\Windows\Fonts in Explorer, selects Albertus Extra Bold and chooses "Properties" from the context menu, the dialog shows that the *.ttf file of the font apparently is not installed in C:\Windows\Fonts but in C:\Users\Admin\AppData\Local\Microsoft\Windows\Fonts.

So should my app simply scan %USERPROFILE%\AppData\Local\Microsoft\Windows\Fonts on top of C:\Windows\Fonts or can there be more paths that can contain fonts on Windows 10?

Upvotes: 3

Views: 14239

Answers (2)

jeremie bergeron
jeremie bergeron

Reputation: 514

There are 3 types of fonts:

  1. System fonts are in %windir%\Fonts.
  2. User fonts are in %USERPROFILE%\AppData\Local\Microsoft\Windows\Fonts. It only exists since the build 10.0.17083 (Source)
  3. Temporary fonts can be anywhere in your pc. You add add one by calling AddFontResourceW

If you are looking for a way to know all the font filename that you have currently, you need to use DirectWrite

If you are looking to an implementation, you can see how the python library FindSystemFontsFilename did it.

Upvotes: 2

Andreas
Andreas

Reputation: 10067

Ok, I figured it out: It seems to be a Windows 10 thing. When I double-click a *.ttf file on my Windows 7 system and click on "Install", the font will be installed in C:\Windows\Fonts. On Windows 10, however, doing the same will lead to the font being installed in %USERPROFILE%\AppData\Local\Microsoft\Windows\Fonts. So it seems Windows 10 uses non-system folders to avoid requesting admin privileges from the user.

Upvotes: 4

Related Questions