Normal Topic Printing justification (Read 2418 times)
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Printing justification
Mar 17th, 2005 at 2:21am
Print Post Print Post  
I am concerned about a possiible algorithm error when Sesame is printing justified text.  History is here:

--------------------------------
In the March 2005 issue of Inside Sesame, Tom Marcellus has provided some excellent code to drop into any form,  and send a printout of the current record to your default printer.  All source code is there for you to modify, but only one variable really needs to change: that is the name of a Key Element name for the Report Header.

I have used it on a command button on a number of forms with only making that one change.

All was going well until I started printing out one element that was a bit different from all the others.  The element is a Multi-Line, Left Justified, all UpperCase text element.

When this element was being printed I noticed that sometimes the right side was being clipped.

For references, I am using original vFont = BArial., vSize=12.  The only changes I made were to vSize in this one section of the code.

I spent a number of hours exchanging emails and tests with Tom, and we agreed that there was no programming error.  But Sesame seems to be handling the justification calculations inconsistently.  Near the end of the code is the section that prints the value of the element.  Only one code value was changed, the vSize which was predefined as vSize as Integer =12.  The defined font was BArial.  We tested with and without Bold and found that Size seemed to be the controlling factor.  Bold and Unbold had similar results.  Does not appear to be a function of width.  Clipping occurred when width was changed from 650 to 450 and 750.   Also got similar results on different printers.

Here is the code that was being analyzed:
---------------------
If Not @IsBlank(ThisElement) Then {
    vThisElement = @Replace(ThisElement,
    @Newline() + @NewLine(), @NewLine())
    PrintString(vThisElement, @PageExtentX() +
    10, -1, 650, vFont, vSize, 0)
    }
-----------------------------
Summary of tests that were done:
1.  The original program called for vSize (=12), copy was clipped.
2.  Changing vSize to 9 or 10 resulted in good printing.
3.  Changing vSize to  11, 12, 13, 14 resulted in clipped printing.
4.  Since 12 is the same as vSize, it was strange to notice that the clipping was not the same, each had different spacing.
5.  Because of  12 not showing the same as vSize, I tried using @ToNumber(12), and that ended up with a third different clipped result for "vSize=12".
--------------------------------------------------------------
Next section is not really code, but used to help align columns, inserting Table was not working.
Code
Select All
Value		Result
vSize		 Clipped
12		  Clipped, but different
@TN(12)		Clipped, with third difference
 9	 OK
10		OK
11		Clipped
12		Clipped
13		Clipped
14		Clipped 



It would seem to me that Sesame probably may have some type of algorithm problem when trying to calculate justification.  I have changed my application to use "10" vs. vSize so I can deliver to client. 

Short term work-around is to use size of 10 or lower.  But  longterm solution will be needed. 

Has anyone else seem a similar problem?



  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Printing justification
Reply #1 - Mar 17th, 2005 at 2:06pm
Print Post Print Post  
Bob,
The NewPage command specifies the accuracy of the printing. Setting it any lower than the DPI of the device introduces an inherit and unavoidable inaccuracy by the factor you specify. So a NewPage(850,1100) command is telling your printer to use 100 DPI. If your printer is capable of 600 DPI (typical laser printer), you are telling the printer that you only care about accuracy to 1/6 of actual. This is, of course, reflected in the measuring of text. To increase the accuracy of printing above 100 DPI, specify higher numbers in the NewPage command and increase the text size in proportion.

If you are currently using NewPage(850, 1100) and a text size of 10 and your printer is 600 DPI, multiply both by a scale factor of 6, resulting in NewPage(5100, 6600) and a text size of 60. That will cause a one for one scaling factor. In most cases, this is wastefully accurate, and merely increasing the scale factor by much smaller amounts will result in "accurate enough".

Imagine the NewPage command as applying a grid to your paper - like graph paper. The parameters to the NewPage command specify the number of "cells" vertically and horizontally appearing on the graph paper. The more of these cells you have, the more accurately you can print and measure.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged