Printing problem



I am having problems with a RISC OS application which performs printing, and
the more I look at it, the more I am baffled. I'll try to describe the
circumstances, and I would be grateful if anyone could tell me whether this
sort of problem is familiar to them, and how to fix it.

The application offers a single rectangle via PDriver_GiveRectangle
corresponding to most of the printable area of an A4 ***. The
transformation matrix is 1:1 with no rotation. It then gets rectangles from
PDriver and renders the whole of the output each time (i.e. it doesn't do
anything clever to work out whether parts of the page don't need rendering).

The output consists of a Draw file, via DrawFile_Render. This is transformed
to rotate 90 degrees clockwise, and prints perfectly. On top of this a
series of lines of text is printed in the centre of the ***, again rotated
clockwise by 90 degrees. So as the page comes out of the printer the start
of each of the lines of text is nearer the top of the *** than the bottom.

The problem is that some of the lines of text are not being printed at all.
If I choose to print the lines centred on the page, with each line centred
horizontally, then any lines longer than about 3cm do not print at all. So
if I increase the font size, more lines disappear. If I reduce it to 8pt,
all the lines are printed.

The draw file consists of a cm grid covering the whole ***, and that is
printed perfectly. All the text lines are rendered every time the draw file
is rendered.

If I instead print the text lines left justified, at the left hand edge of
the landscape page (the top when printing), none of the lines are printed.

If I print it right justified, most of the lines are printed. Please see
http://sinenomine.co.uk/testpage.gif which shows the centred and right
justified version printed on the same ***, with handwritten annotations.
(This test intentionally did not include the draw file.)

The problem only arises if I print to actual paper using either GutenPrint on
the Iyonix (RO 5.13) or an Explan printer driver on the RISC PC (RO 4.02).
If I print to PostScript the problem goes away. Similarly if I use an Epson
FX80 dot matrix printer driver and print to a file, on viewing the output in
!FX80Emul it is also complete.

I have put debugging in, which proves that the printer driver is requesting
rectangles from my application which cover the whole page. The rectangles
are in strips about 5.5cm tall. And my debugging shows the correct text is
being passed to Font_Paint each time.

Shorter lines of text happen to be entirely within the third strip which the
printer driver requests. If I vary the lengths of the lines of text or vary
the font size, then a line will disappear as soon the left hand end overlaps
the second strip requested by the printer driver. It seems that any string I
print will not appear if any part of it overlaps the first or second strips.

I have even tried printing in portrait orientation 80 lines at a suitable
point size, each being centred horizontally on the page and consisting of a
single digit. All lines which would be in the first two strips requested by
the printer driver fail to appear on hard copy, and all the resr appear fine.
Printing to a PosScript file exhibits none of these problems. It surely
cannot be a printer driver bug or everyone would have been affected by this,
but if it's a bug in my application I cannot work out where. It's as if some
sort of clipping is occurring, except that it's clipping which can make whole
lines disappear!

There are other complications too weird to describe: output doesn't appear if
it's more than about 6 inches from the left edge of the *** when viewed
upright, as you'l see from the GIF. Also I have had examples of some
characters in a string of text not being rendered while others are.

Does anyone have any ideas? I'd really appreciate any hints as to what to
try for debugging next. Anything else I could usefully report on or test?

--
Matthew Phillips
Dundee
** Posted from http://www.teranews.com **
.