What i want is a Delphi code that retrieve the name from .fon font file, I did a Google search but it went to 0.
to be clear: Example: i have font: the file name + path: C:\joker_let.fon the font real name is: 'Joker LET 1.0'
What I did so far:
Function GetFONFontName(FontFile: String): String;
var FS : TMemoryStream;
FontName: Array of Char;
Begin
Result:= '';
FS := TMemoryStream.Create();
Try
FS.LoadFromFile(FontFile);
SetLength(FontName, FS.Size);
FS.ReadBuffer(FontName[0], FS.Size);
Result:= String( FontName);
Result:= Copy(Result, Pos('FONTRES', Result)+8, 250);
Result:= Copy(Result, Pos(':', Result)+141, 60);
Result:= Copy(Result, 1, Pos(#0, Result)-1);
Result:= Trim(Result);
Finally
FS.Free;
End;
End;
But this function not working as it should be, because the font name its not stored in same place in all .fon files. if i give the font in the example i will get its name; but if i just give another font i not get its name correctly or it went to nothing just ''. so i need something else that retrieve the .fon name in each file.
- I did another Google search to get the .fon file structure but i didn't find something useful i found only that there is two types: PE and ZE. to be specified i want the PE type (Portable Executable = MZ). since i didn't find a detailed information about the .fon PE Type so i did that stupid
Function GetFONFontName(FontFile: String): String; to do a temporary solution.
hope i was clear. sorry for my English.