Get Name of Installed Font using API
I can temporarily install a font file using the AddFontResource lib, but how do I get the name of the font that I just installed? I need to know the name of the font so that I can call it when I automate Word. I think I need to use the GetTextFace lib, but I don’t fully understand how to use this function; Here is the Windows API declaration:
Private Declare Function GetTextFace Lib “gdi32” Alias “GetTextFaceA” (ByVal hdc As Long, ByVal nCount As Long, ByVal lpFacename As String) As Long
In Dan Appleman’s Win32 API book, it says the “hdc” is to be a handle to a device context- what does this mean!?! Can someone breakdown this function and explain its parts? I am guessing that the lpFacename holds a string that the font name is dumped to and nCount sets the size of this string- why?.
A little guidance is much appreciated!
Thank you!
–Llyal
PS – I have found that the AddFontResource only temporarily installs a font (a machine re-boot will remove them); this is with Windows 2000; are there no APIs that will allow me to permanently install and uninstall fonts?