Why are my installed fonts not available in .NET?
Posted
by Dan Herbert
on Stack Overflow
See other posts from Stack Overflow
or by Dan Herbert
Published on 2010-05-06T01:53:03Z
Indexed on
2010/05/06
1:58 UTC
Read the original article
Hit count: 643
I'm trying to render some images with text using a font I just added to my machine and no matter what I do, I can't seem to get the font to become accessible in .NET.
I tried using PrivateFontCollection.AddFontFile(filename)
and PrivateFontCollection.AddMemoryFont(...)
to load the font into memory. Whenever I do this, the method throws a "File Not Found" exception, which is unusual because I get this exception when loading the font from memory, where there should be no files to be "not found".
Initially, I thought it may be because the font I was trying to use was in the .pfm
format, so I converted the font to .otf
and had the same problem.
Then I tried installing the .otf
font to my Windows Fonts folder so I could pull it from FontFamily.Families
. Once I installed the font, it became available in Microsoft Word & Notepad2. However, when I try to load it from FontFamily.Families
, it is not included in the array.
I thought rebooting my machine would fix the issue but obviously there is something more complicated involved here.
Is there something basic I just might have missed when installing the font in my machine (Windows Vista), or is there another way to programmatically load a font that I should be using instead? Is .otf
not supported in .NET?
© Stack Overflow or respective owner