Dan Byström
Dan Byström

Reputation: 9244

Programmatically installing font in Windows

What's the trick to make a font file copied to the fonts directory and then added using AddFontResource available after a reboot?

Upvotes: 4

Views: 2407

Answers (2)

kkyr
kkyr

Reputation: 3845

I've been having the same issue for the past few days and each solution I found was producing different problems.

I managed to come up with a working code with my colleague and I thought I'd share it for everyone. The code can be found in the following pastebin link:

Installing a font programatically in C#

Upvotes: 0

Kevin Newman
Kevin Newman

Reputation: 2447

This MSDN page has this to say:

This function installs the font only for the current session. When the system restarts, the font will not be present. To have the font installed even after restarting the system, the font must be listed in the registry.

I believe the key you need is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts

Upvotes: 3

Related Questions