Thursday 15 September 2011

Delphi - Retrieve .Fon font name from a specified file -



Delphi - Retrieve .Fon font name from a specified file -

this question has reply here:

how font name font file? 3 answers

what want delphi code retrieve name .fon font file, did google search went 0.

to clear: example: have font: file name + path: c:\joker_let.fon font real name is: 'joker allow 1.0'

what did far:

function getfonfontname(fontfile: string): string; var fs : tmemorystream; fontname: array of char; begin result:= ''; fs := tmemorystream.create(); seek 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); fs.free; end; end;

but function not working should be, because font name not stored in same place in .fon files. if give font in illustration name; if give font not name correctly or went nil ''. need else retrieve .fon name in each file.

i did google search .fon file construction didn't find useful found there 2 types: pe , ze. specified want pe type (portable executable = mz). since didn't find detailed info .fon pe type did stupid

function getfonfontname(fontfile: string): string; temporary solution.

hope clear. sorry english.

this question posed before here: how font name font file?. looks can utilize getfontresourceinfo win api.

delphi fonts

No comments:

Post a Comment