Board index » delphi » Delphi Fonts

Delphi Fonts

Does anyone know where delphi 1 keeps it's selectable fonts.
I keep getting error message unable to create couier new fonts on the
selected printer. My printer works with delphi . I don't understand
why it wont work with delphi 1. My printer is a canon 610
Ken Kellum
kkel...@mcn.net

 

Re:Delphi Fonts


<34039a3e.860...@NEWS.MCN.NET>, kkel...@mcn.net (Ken Kellum) writes:

Quote
>Does anyone know where delphi 1 keeps it's selectable fonts.
>I keep getting error message unable to create couier new fonts on the
>selected printer. My printer works with delphi . I don't understand
>why it wont work with delphi 1. My printer is a canon 610
>Ken Kellum
>kkel...@mcn.net

A member of the TPrinter class has the Fonts property which is itself a TStrings
object.  The strings appear to duplicate the True Type fonts which are installed
by normal methods under Windows 3.1.x.

I have changed fonts with the following sort of code:

     Printer.Canvas.Font.Name := fontname;
     Printer.Canvas.Font.Pitch := fp...;
     Printer.Canvas.Font.Style := [...];     { often null but allow fsBold etc.  }
     EstablishFontSize( SizeInPoints );

I have a conjecture that "fontname" must EXACTLY (meaning case) match the
strings naming fonts as displayed by the Windows font manager.  I have not
experimented to see if it's at all forgiving.

The "EstablishFontSize" comes from a tip I received from someone else who
reported that it fixes a bug in Borland's TPrinter class in that the PixelsPerInch
property does not get updated.  That is why we have:

   procedure EstablishFontSize(fsz : integer);
      begin
         Printer.Canvas.Font.Size := fsz;
         Printer.Canvas.Font.PixelsPerInch :=
                     GetDeviceCaps(Printer.Handle,LOGPIXELSY);
         Printer.Canvas.Font.Size := fsz;
      end;

I don't pretend to understand this code but adding it to my program made it
work.

I recommed a shareware component EDSPRINT.  Perhaps a reader of this can
point out where to get said item.  It's worth the requested fee ($30?)

Other Threads