I have a set of font files with unpredictable filenames, so I can't deduce the real "Font Family" name from the file name. I need to therefore read the font metadata to extract the real "Font Family" name, in order to render this font file. I'm in C#.NET 4.0 WinForms.
I've seen the function GetFontInformation
but I can't seem to find the P/Invoke headers for the same. All I have is the C++ version which is honestly hard to figure out. Any ideas?
The reason I cannot use the PrivateFontCollection
class to parse through a font file for me, is that these are OTF fonts and .NET/GDI+ only supports TTF fonts!
You need to add font to the (
PrivateFontCollection
) and then request for theFontFamily
and get itsName
property.Needed namespace :