It is worth answering to have the history and in case in the future someone needs.
The simplest way is to install, check and uninstall, thus having access to the source name.
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).
Is that it? http://www.delphipages.com/forum/showthread.php?t=171299 (see Chris' suggestion).
– EMBarbosa