给你一个函数,你试试:<br>function GetFontNameFromFotFile(const ttf: string): string;<br>var<br> FHd: integer;<br> FotFile: string;<br> FontName: string;<br> ch:char;<br>begin<br> FontName:='';<br> try<br> FotFile := ChangeFileExt(ttf, '.fot');<br> CreateScalableFontResource(0, PChar(FotFile), PChar(ttf), nil);<br> if fileexists(FotFile) then<br> begin<br> try<br> FHd := FileOpen(FotFile,fmShareExclusive OR fmOpenRead);<br> if FHd >0<br> then begin<br> if FileSeek(FHd, 1270, 0)=-1<br> then ShowMessage('Error: FileSeek operation with file'+FotFile)<br> else begin<br> FileRead(FHd,ch,1);<br> while ch<>#0 do begin<br> FileRead(FHd,ch,1);<br> end;<br> FileRead(FHd,ch,1);<br> while ch<>#0 do begin<br> FontName:=FontName+ch;<br> FileRead(FHd,ch,1);<br> end;<br> end;<br> end<br> else begin<br> ShowMessage('Error: File '+FotFile+' not opened');<br> end;<br> finally<br> if FHd>0 then FileClose(FHd);<br> end;<br> end<br> else showmessage('FOT-file not created');<br> finally<br> if FileExists(FotFile) then DeleteFile(FotFile);<br> end;<br> Result := FontName;<br>end;<br>