Board index » delphi » Getting Font Names in Delphi 3

Getting Font Names in Delphi 3

Please could anyone tell me how to do the following.

I need to be able to Extract the actual windows font name from a True Type
Font File  (.TTF) and also

From the Screen.Fonts TStrings List Associate a Windows Font Name with it's
.TTF File.

Since I convert TTF Files into Postscript, PCL, And Meta Fonts, I am writing
a tracking app that needs both of these associations.

Please help
Kevin

 

Re:Getting Font Names in Delphi 3


Quote
Kevin Bird wrote in message <774ofc$bl...@flex.london.pipex.net>...
>Please could anyone tell me how to do the following.

>I need to be able to Extract the actual windows font name from a True Type
>Font File  (.TTF) and also
>From the Screen.Fonts TStrings List Associate a Windows Font Name with it's
>.TTF File.

Have you tried the registry? The actual and display names are listed
as pairs under HKLM\Software\Microsoft\Windows (NT)\Fonts

This would only work for registered fonts, but it would very
simple to do - to get the display name from the TTF filename you'd
just enumerate the values until you find the data that matches the
filename (and of course even easier to get a TTF filename from a
display name - just read the data associated with that value).

Otherwise, you've got trouble. AFAIK, the only way Windows
knows the display name for the font is because the rasterizer
can walk through all of the various data tables within the TTF
file and record that information. Since there is no "fixed" format
for a TTF file, it's not simply a matter of opening the TTF file,
seeking to a particular offset and reading the display name. I can
send you the TTF spec if you want, but it looks to me to be a
*big* job to write a program that can properly understand a TTF
file at a low level.

When I had to do this, I went with the registry solution. Of
course, if the above paragraph is wrong, or if anyone knows a
better solution, I'd be interested to hear it too.

--
Jeremy Collins

Re:Getting Font Names in Delphi 3


I have Delphi 3 also

In the Borland\Delphi3\Demos\Ownerlst\Font.dpr is a project dealing  with the
names of system fonts.

Hope this helps

Other Threads