For the Windows version of Fonts Manager, I need to find the name of a font from the font file.
On Mac, there is an MBS plugin, but unfortunately nothing for Windows.
Scouring the Internet, I found the function GetFontResourceInfo at http://www.undocprint.org/winspool/getfontresourceinfo
It seems simple enough, but I am at a loss about how to get the return information :
BOOL GetFontResourceInfo(
LPCTSTR lpszFilename, // font file name
LPDWORD cbBuffer, // size of buffer for resource information
LPVOID lpBuffer, // buffer for returned resource information
DWORD dwQueryType, // resource information query type
);
[code]Parameters
lpszFilename
[in] Pointer to a null-terminated character string that contains a valid font file name. This parameter can specify any of the following files. File extension Description .fon Font resource file. .fnt Raw bitmap font file. .ttf Raw TrueType file. .ttc East Asian Windows: TrueType font collection. .fot TrueType resource file. .otf PostScript OpenType font. .mmm multiple master Type1 font resource file. It must be used with .pfm and .pfb files. .pfb Type 1 font bits file. It is used with a .pfm file. .pfm Type 1 font metrics file. It is used with a .pfb file.
To add a font whose information comes from several resource files, point lpszFileName to a string with the file names separated by a | for example, abcxxxxx.pfm | abcxxxxx.pfb.
cbBuffer
[in,out] Specifies the length, in bytes, of the information to be retrieved. If this parameter is zero, GetFontResourceInfo returns the size of the data specified in the dwQueryType parameter.
lpBuffer
[out] Pointer to a buffer that receives the font information. If this parameter is NULL, the function returns the size of the buffer required for the font data.
dwQueryType
Specifies the type of resouce information to return. This parameter can be one of the following values.
Value Meaning
QFR_0
0 DWORD or LPVOID
unknown
QFR_DESCRIPTION
1 The function provides a string that an NT-based operating system will use to describe the font file. A null-terminated Unicode string is written to the buffer pointed to by lpBuffer.
QFR_LOGFONT
2 Array of LOGFONT
QFR_PDEV
3 PDEV ?
QFR_FONTFILE
4 scalable font file name
QFR_5
5 DWORD
Windows XP: Always returns 0[/code]
How do I get the value back ?
I started writing this and got stuck with lpbuffer :
Soft Declare Function GetFontResourceInfo Lib "User32" (lpzfilename as WString, byref cbBuffer as Uint32, byref lpBuffer as Ptr ? ?
I realize I simply don’t know how to get the information back in a MemoryBlock, maybe a string ?
Will very much appreciate assistance.
TIA