Hi All,

I work on a software package that prints checks, among other things. I want to verify that a particular font is installed on the system before I allow the print, because if its not there it defaults to Wingdings, and checks don't quite look right with Wingdings :)

I am trying to use Screen.Font in the following way:

if Screen.Fonts.IndexOfName('MICR65') = -1 then
   begin
      ITErrorDialog('The MICR font cannot be found on your system.  Please ' +
       'install the font or contact your support personnel for further ' +
       'instruction.');
      exit;
   end;

At debug time, I can see that Screen.Fonts is empty, in which case this statement always fails.

I scoured the net, but I can't find any forums with entries similar to this. Does anyone have any advice for me?

Thanks for your help!

~DJ Quimby

Recommended Answers

All 5 Replies

This works for me:

if screen.fonts.IndexOf('Arial') > -1 then
        MessageDlg('Arial installed', mtInformation, [mbok], 0);

I plugged in that exact code, and you're right it worked. For some reason though, the MICR65 font is still unable to be found.

While the font may not be standard, it has been installed onto my workstation and it shows in the Fonts folder. I even opened up Microsoft Word to see if the display name was different, but it's not.

I'm at a loss as to why it wouldn't work with a non-standard font.

According to the Delphi documentation, the TScreen.Fonts only lists "screen" fonts. You may want to also check in TPrinter.Fonts, as the font you want is technically for use with the printer...

Hope this helps.

No such luck with the Printer object either unfortunately :( I think I will have to consider doing a straight file search for the ttf file within the Font folder. I'm not sure what that will entail as far as whether 98, Vista, and XP store fonts the same way. And I don't have much development time left, so this will have to go on the back burner for now.

Thanks for your attempts guys.

I know the problem isn't "solved", but I am going to have to wait a little while before I can actually put some focus on it again. Should I mark this bug as solved for forum purposes?

No, it isn't solved. Wait until it is. ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.