Board index » delphi » Printer Font problems in Delphi 1.0

Printer Font problems in Delphi 1.0

Quote
David Vinas wrote:

> I have an application which I recently had to downgrade from Delphi 2.0 to
> 1.0, since many of our clients still need support for Win3.1. Everything went
> fine until I tried to print using the Printer.Canvas.Font properties and the
> TextOut method. The fonts come out tiny- almost unreadable. I have tried
> everything imaginable, even my deepest voodoo magic. No luck.

Try setting the PixelsPerInch property to 300 or 600, or whatever the max.
resolution of your printer is. That worked for me.

Nils

 

Re:Printer Font problems in Delphi 1.0


"Nils C. Hertzberg" <nil...@ii.uib.no> wrote:

Quote
>David Vinas wrote:

>> I have an application which I recently had to downgrade from Delphi 2.0 to
>> 1.0, since many of our clients still need support for Win3.1. Everything went
>> fine until I tried to print using the Printer.Canvas.Font properties and the
>> TextOut method. The fonts come out tiny- almost unreadable. I have tried
>> everything imaginable, even my deepest voodoo magic. No luck.
>Try setting the PixelsPerInch property to 300 or 600, or whatever the max.
>resolution of your printer is. That worked for me.

Better: before you assign Printer.Canvas.Font.Size, use

with Printer do
  Canvas.Font.PixelsPerInch:=GetDeviceCaps(Handle,logPixelsY);

which will automatically set PixelsPerInch to the printer Y-resolution.

--
Isaac Hepworth                 ijh1...@cam.ac.uk
Corpus Christi College, Cambridge University, UK

Re:Printer Font problems in Delphi 1.0


I have an application which I recently had to downgrade from Delphi 2.0 to
1.0, since many of our clients still need support for Win3.1. Everything went
fine until I tried to print using the Printer.Canvas.Font properties and the
TextOut method. The fonts come out tiny- almost unreadable. I have tried
everything imaginable, even my deepest voodoo magic. No luck.

I am aware of the discrepancy between the Font.Size and Font.Height help file
entries, but still haven't been able to solve the problem. Does some kind soul
have a solution?

Thanks.

David
dvi...@sccsi.com

Re:Printer Font problems in Delphi 1.0


In article 6...@lurch.sccsi.com, dvi...@sccsi.com (David Vinas) writes:

Quote
>I have an application which I recently had to downgrade from Delphi 2.0 to
>1.0, since many of our clients still need support for Win3.1. Everything went
>fine until I tried to print using the Printer.Canvas.Font properties and the
>TextOut method. The fonts come out tiny- almost unreadable. I have tried
>everything imaginable, even my deepest voodoo magic. No luck.

>I am aware of the discrepancy between the Font.Size and Font.Height help file
>entries, but still haven't been able to solve the problem. Does some kind soul
>have a solution?

Have  you used the PixelsPerInch property to correct the Delphi 1.0 bug ?

Printer.Canvas.Font.PixelsPerInch:=GetDeviceCaps(Printer.Canvas.Handle, LOGPIXELSX);

If your LOGPIXELSX is different from LOGPIXELSY, I don't know which you should use. I
have always found them  the same.

HTH

Ray Cramer
R...@Pol.ac.uk

Re:Printer Font problems in Delphi 1.0


Quote
dvi...@sccsi.com (David Vinas) wrote:
>I have an application which I recently had to downgrade from Delphi 2.0 to
>1.0, since many of our clients still need support for Win3.1. Everything went
>fine until I tried to print using the Printer.Canvas.Font properties and the
>TextOut method. The fonts come out tiny- almost unreadable. I have tried
>everything imaginable, even my deepest voodoo magic. No luck.
>I am aware of the discrepancy between the Font.Size and Font.Height help file
>entries, but still haven't been able to solve the problem. Does some kind soul
>have a solution?

Could you post some code? This would probably help. Also, email it to
me if you can. I may miss it if it is just posted.

Cheers,
Damien

========================================================
Are you a shareware programmer? E-mail me for info on
something I'm writing to make your life a lot easier!!!
=== "http://204.101.50.93/students/damien/dmhome.htm" ===

Re:Printer Font problems in Delphi 1.0


Quote
David Vinas wrote:

> In article <31B57192.4...@ii.uib.no>, nil...@ii.uib.no says...
> >David Vinas wrote:
> >> I have an application which I recently had to downgrade from Delphi 2.0 to
> >> 1.0, since many of our clients still need support for Win3.1. Everything
> went
> >> fine until I tried to print using the Printer.Canvas.Font properties and
> the
> >> TextOut method. The fonts come out tiny- almost unreadable. I have tried
> >> everything imaginable, even my deepest voodoo magic. No luck.

> >Try setting the PixelsPerInch property to 300 or 600, or whatever the max.
> >resolution of your printer is. That worked for me.

> >Nils

> Yes, but I need to know the resolution of the printer first. I tried getting
> the resolution with the GetDeviceCaps command, but I don't know how to set the
> index (2nd parameter). Any suggestions?

> David

Try using:

Printer.Canvas.Font.PixelsPerInch :=
   GetDeviceCaps(Printer.Canvas.Handle, LOGPIXELSY);

--
Joe C. Hecht
Borland Delphi Developer Support Group
http://www.borland.com

Re:Printer Font problems in Delphi 1.0


In article <31B57192.4...@ii.uib.no>, nil...@ii.uib.no says...

Quote
>David Vinas wrote:
>> I have an application which I recently had to downgrade from Delphi 2.0 to
>> 1.0, since many of our clients still need support for Win3.1. Everything
went
>> fine until I tried to print using the Printer.Canvas.Font properties and
the
>> TextOut method. The fonts come out tiny- almost unreadable. I have tried
>> everything imaginable, even my deepest voodoo magic. No luck.
>Try setting the PixelsPerInch property to 300 or 600, or whatever the max.
>resolution of your printer is. That worked for me.
>Nils

Yes, but I need to know the resolution of the printer first. I tried getting
the resolution with the GetDeviceCaps command, but I don't know how to set the
index (2nd parameter). Any suggestions?

David

Re:Printer Font problems in Delphi 1.0


This problem drove me crazy, and yes, I tried all the suggestions
mentione here and in all the other posts on this topic when I was
developing. Incidentally, 2.0 has a similar problem. My solution was
to use the AssignPrn approach with the Printer object. This seems to
work. (The GetDeviceCaps method works _most_ of the time in 1.0.)

Quote
dvi...@sccsi.com (David Vinas) wrote:
>I have an application which I recently had to downgrade from Delphi 2.0 to
>1.0, since many of our clients still need support for Win3.1. Everything went
>fine until I tried to print using the Printer.Canvas.Font properties and the
>TextOut method. The fonts come out tiny- almost unreadable. I have tried
>everything imaginable, even my deepest voodoo magic. No luck.
>I am aware of the discrepancy between the Font.Size and Font.Height help file
>entries, but still haven't been able to solve the problem. Does some kind soul
>have a solution?
>Thanks.
>David
>dvi...@sccsi.com

Re:Printer Font problems in Delphi 1.0


Quote
Ray Cramer wrote:

> In article 6...@lurch.sccsi.com, dvi...@sccsi.com (David Vinas) writes:
> >I have an application which I recently had to downgrade from Delphi 2.0 to
> >1.0, since many of our clients still need support for Win3.1. Everything went
> >fine until I tried to print using the Printer.Canvas.Font properties and the
> >TextOut method. The fonts come out tiny- almost unreadable. I have tried
> >everything imaginable, even my deepest voodoo magic. No luck.

> Have  you used the PixelsPerInch property to correct the Delphi 1.0 bug ?

> Printer.Canvas.Font.PixelsPerInch:=GetDeviceCaps(Printer.Canvas.Handle, LOGPIXELSX);--

This one keeps coming up. I actually started reading this group to see if anyone had a better
solution than mine.

Delphi 1 sometimes sets the printer font resolution to screen resolution (or the old printer
resolution after a printer change).  SettingPrinter.Canvas.Font.PixelsPerInch makes no
difference; it behaves like a readonly property.
Can sometimes be cured by
    Printer.PrinterIndex := Printer.PrinterIndex
believe it or not; it has worked for me.

Otherwise have to destroy and recreate the Printer object, then reassign PrinterIndex.
Make sure that the first thing you do to the printer is write something, even a null string,
before trying to read PixelsPerInch or call TextHeight/TextWidth

david.pars...@bbsrc.ac.uk

Re:Printer Font problems in Delphi 1.0


Quote
David Parsons <david.pars...@bbsrc.ac.uk> wrote:
>Ray Cramer wrote:

>> In article 6...@lurch.sccsi.com, dvi...@sccsi.com (David Vinas) writes:
>> >I have an application which I recently had to downgrade from Delphi 2.0 to
>> >1.0, since many of our clients still need support for Win3.1. Everything went
>> >fine until I tried to print using the Printer.Canvas.Font properties and the
>> >TextOut method. The fonts come out tiny- almost unreadable. I have tried
>> >everything imaginable, even my deepest voodoo magic. No luck.

>> Have  you used the PixelsPerInch property to correct the Delphi 1.0 bug ?

>> Printer.Canvas.Font.PixelsPerInch:=GetDeviceCaps(Printer.Canvas.Handle, LOGPIXELSX);--
>This one keeps coming up. I actually started reading this group to see if anyone had a better
>solution than mine.
>Delphi 1 sometimes sets the printer font resolution to screen resolution (or the old printer
>resolution after a printer change).  SettingPrinter.Canvas.Font.PixelsPerInch makes no
>difference; it behaves like a readonly property.

Font.PixelsPerInch does not behave like a readonly property. It just
doesn't adjust the Font.Size (and .Height) properties retrospectively. To
effect this adjustment, use the following :

with Printer.Canvas do
  begin
    Font.PixelsPerInch:=GetDeviceCaps(Handle,logPixelsY);
    Font.Size:=Font.Size;
  end;

HTH

--
Isaac Hepworth                 ijh1...@cam.ac.uk
Corpus Christi College, Cambridge University, UK

Re:Printer Font problems in Delphi 1.0


I use:

   PixelsPerInchX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
   PixelsPerInchY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);

John.

Re:Printer Font problems in Delphi 1.0


Quote
In article <4pat6i$...@lurch.sccsi.com>, dvi...@sccsi.com (David Vinas) writes:
>In article <31B57192.4...@ii.uib.no>, nil...@ii.uib.no says...
>>David Vinas wrote:
>>> I have an application which I recently had to downgrade from Delphi 2.0 to
>>> 1.0, since many of our clients still need support for Win3.1. Everything
>went
>>> fine until I tried to print using the Printer.Canvas.Font properties and
>the
>>> TextOut method. The fonts come out tiny- almost unreadable. I have tried
>>> everything imaginable, even my deepest voodoo magic. No luck.

>>Try setting the PixelsPerInch property to 300 or 600, or whatever the max.
>>resolution of your printer is. That worked for me.

>>Nils

>Yes, but I need to know the resolution of the printer first. I tried getting
>the resolution with the GetDeviceCaps command, but I don't know how to set the
>index (2nd parameter). Any suggestions?

>David

The LOGPIXELSX and LOGPIXELSY index values will get you the pixels per
inch of the printer in the X and Y coordinates respectively.

HTH

-* Stephen *-
Stephen Posey
University of New Orleans
Email  : S...@uno.edu
WWW    : http://www.uno.edu/~slp

Other Threads