Page 1 of 1

PrintPreview character width

PostPosted: January 3rd, 2011, 6:41 pm
by wpxyz
Hi,

PrintPreview is a great component, and there is a chance that it will replace many of my Quickreport outputs since it gives me better control over print layout.

Some of my programs are compiled with D7/Win2k at 1280x1024 resolution. When running such a program on a different computer (XP, 1280x800) I realize that preview and printout are strangely distorted such as if the characters were too wide. The characters are also partially overlapping as written in an older posting (viewtopic.php?f=7&t=1262&p=4834&hilit=printpreview#p4834). I could fix the printout issue by activating DirectPrint, but the preview of course still has the same issue.

Is there a solution to this issue in the meantime? Could it be that different mapping factors should be applied because of the different vertical resolutions?

By the way, how can I get the correct page number in case of DirectPrint? In the OnNewPage event I initially used the CurrentPage property to display the page number, but this is not updated if DirectPrint=true. I solved this by incrementing a counter variable in each OnNewPage event, but it would be nice to have this in the component.

With kind regards
Werner

Re: PrintPreview character width

PostPosted: January 8th, 2011, 12:17 pm
by Kambiz
Hi,

I try to fix the wide screen issue on the next release of the component.
I will also add a property to know page number of the page that owns the canvas.

Thank you!

Re: PrintPreview character width

PostPosted: January 8th, 2011, 6:59 pm
by wpxyz
Thank you, I am looking forward to it.

Werner

Re: PrintPreview character width

PostPosted: February 5th, 2011, 7:43 am
by Kambiz
I started working on the new release of PrintPreview.
While looking at the code, I noticed that there is already a property to find out the page owning the canvas. That property is CanvasPageNo. :)

Re: PrintPreview character width

PostPosted: February 5th, 2011, 8:38 am
by Kambiz
Werner,

I tested PrintPreview on different screen resolutions and different DPI settings, and characters appeared correctly as expected on all cases. Apparently the problem is not because of these settings.

Re: PrintPreview character width

PostPosted: February 8th, 2011, 10:31 pm
by wpxyz
Kambiz,

thanks for your efforts.

I missed the CanvasPageNo property, it does exactly what I want.

I did some research on the character width issue on four PCs I have access to, with Win2000, XP and 7, most of them with non 4:3 resolution ratios and could not confirm the issue, except for the notebook referred to in my first posting. So I think this has nothing to do with the PrintPreview component.

Thanks again for your great work.
Werner

Re: PrintPreview character width

PostPosted: May 3rd, 2011, 10:13 pm
by mestro
Hi,

also in my printings i can discover wrong spaces between some characters. This looks very unattractive:
Sometimes there is a huge gap intermediate the letters. In other cases the letters seemed to like each other and trying to become just one. :oops:

Cause it's difficult to find out the reason of this behavior, i want to share my information with you. My presumption is an rounding error in the scaling operation between the different resolution of the printer and the form. But how this mechanism works exactly, is not clear to me. :-k
But I figured out, that the there are some curious results of the method TextWidth of a single character: I printed some single characters in different font sizes with an yellow background color. Additional i marked the TextWidth of each letter with small lines and printed the integer result of TPrintPreview.Canvas.TextWidht(aChar) and TForm.Canvas.TextWidth(aChar).
The yellow background for each letter is plotted correctly. And often the additional marking lines are identcal to the yello beackground of a letter, but sometimes the plot of a letter ist smaler or wider than the TextWidth result (marked through the lines).
I think this is the reason of the wrong distances between some letters, you can see in the sampe text on the top of the letter. But note: the affected letters depends on the size of the font and the font itself. Additional i figured out, also the DPI configuration of the screen has an effect on ths mechanism.
I tried different versions of TPrintPrefview: 4.7, 5.12 or 5.61 - all the same results.

But one more: For sure, I expected expanded letters by increasing font size. But sometimes there is a irregular, smaler value (e.g. see the 'A' in colum 4 in file 'V4.7 96dpi.pdf'). TextWidth results in 5, 6, 8, 7 (!?), 9 and 9. D'ohhh, what's this?! #-o

Hope there is anyone who had one idea more than me, how to fix this. As seen in the example text in the pdf files, the gap is sometimes as big as a single blank! :?
In the attachments, i attached my pdf files and my testprogram (modified viewer demo project). May anyone wanna try a look into this, please?

with best regards,
mestro

Im using Win7 32bit with Turbo Delphi. Due to Turbo Delphi i have to create the TPrintPreview object at runtime, but this shouldn't be a problem...

Re: PrintPreview character width

PostPosted: May 7th, 2011, 4:15 am
by Kambiz
Before I didn't have character width problem in PrintPreview with TrueType/OpenType fonts. But now I can confirm that the problem exist. I suspect the problem is caused because of either a Windows update or display driver update.