Windows printing problems and a feature request...

16 views
Skip to first unread message

Anders Karlsson

unread,
Sep 21, 2009, 5:52:18 AM9/21/09
to scintilla-interest
When printing from Scintilla, using SCI_FORMATRANGE it seems that
there is aslight bug concerning trailing blank lines here. If I have
this text, 3 lines, with the two trailing lines blank;
<sample>
some text


</sample>
Scintilla will say it can fit this printing within only 2 lines of
text here. The reason I found this out was that I was using this, with
bDraw set to false, to figure out how big an area Scintilla was really
printing to, so I could follow the printout with something else or
draw a frame around it.

If I print THIS text though, it seems to work as expected, and says
that three lines are required, not 2 as above.
<sample>
some text
x
x
</sample>

This would be so annoying if the last line just wasn't printed, but it
actually prints the line # still.. I will always miss out the last
line if it is empty it seems. This can be worked around of course, but
it really does seem like a bug.

And the feature request then follows on this: Would it be possible to
have SCI_FORMATRANGE return the RECT actually used when printing, like
Win32 DrawText does when passing DT_CALCRECT is passed.

Cheers
/Karlsson

Neil Hodgson

unread,
Sep 22, 2009, 8:19:20 AM9/22/09
to scintilla...@googlegroups.com
Anders Karlsson:

> When printing from Scintilla, using SCI_FORMATRANGE it seems that
> there is aslight bug concerning trailing blank lines here. If I have
> this text, 3 lines, with the two trailing lines blank;
> <sample>
> some text
>
>
> </sample>
> Scintilla will say it can fit this printing within only 2 lines of
> text here.

How is this information returned from Scintilla? The return value
is the index after the last character printed.

> The reason I found this out was that I was using this, with
> bDraw set to false, to figure out how big an area Scintilla was really
> printing to, so I could follow the printout with something else or
> draw a frame around it.
>
> If I print THIS text though, it seems to work as expected, and says
> that three lines are required, not 2 as above.
> <sample>
> some text
> x
> x
> </sample>

Three lines are printed in each case.

> And the feature request then follows on this: Would it be possible to
> have SCI_FORMATRANGE return the RECT actually used when printing, like
> Win32 DrawText does when passing DT_CALCRECT is passed.

That would not be compatible with current behaviour or with
EM_FORMATRANGE which it is based on. It should be possible to
determine the rectangle by changing the bottom of the printing
rectangle until a different value is returned.

Neil

Reply all
Reply to author
Forward
0 new messages