It's worth answering for the history and if anyone needs it in the future.
The simplest way is to install, verify and uninstall, thus accessing the font name.
Here is the routine:
Function NomedaFonte(Font: WideString):WideString;
type
TGetFontResourceInfoW = function(Name: PWideChar; var BufSize: Cardinal;
Buffer: pointer; InfoType: Cardinal): LongBool; stdcall;
var
naf, k, y: integer;
gfri: TGetFontResourceInfoW;
lf: array of TLogFontW;
lfsz: Cardinal;
hfnt: HFONT;
Nome: WideString;
begin
gfri := GetProcAddress(GetModuleHandle('gdi32.dll'), 'GetFontResourceInfoW');
if @gfri = nil then
raise Exception.Create('GetFontResourceInfoW in gdi32.dll não funciona.');
if LowerCase(ExtractFileExt(Font)) = '.pfm' then
Font := Font + '|' + ChangeFileExt(Font, '.pfb');
naf := AddFontResourceW(PWideChar(Font)); //carrega fonte
try
if naf > 0 then
begin
SetLength(lf, naf);
lfsz := naf * SizeOf(TLogFontW);
if not gfri(PWideChar(Font), lfsz, @lf[0], 2) then
raise Exception.Create('GetFontResourceInfoW não pode ser chamado.');
y := 0;
naf := lfsz div SizeOf(TLogFont);
for k := 0 to naf - 1 do
begin
hfnt := CreateFontIndirectW(lf[k]);
try
Nome := lf[k].lfFaceName; //Pega nome da fonte
Result := Nome;
finally
DeleteObject(hfnt);
end;
end;
end;
finally
RemoveFontResourceW(PWideChar(Font)); //Descarrega fonte
end;
end;
Source (in German).