print -landscape/portrait

Ben Abbott bpabbott at mac.com
Sat Jun 13 21:02:22 CDT 2009


After the bug-report by José, regarding unexpected behavior of "print - 
landscape ...", I was encouraged to re-examine the implementation of  
how the print command handles the figure paper properties.

A simple summary of how the compatible interaction of the figure paper  
properties is itemized below.

(1) When the paperorientation is changed, a listener is needed to flip  
the papersize but should not modify the paperposition. This, indicates  
that the paperorientation can be ignored when printing.

(2) When the papertype is changed, a listener is needed to set the  
papersize while accounting for the paperorientation. This indicates  
that the papertype can also be ignored when printing.

(3) When the papersize is changed, a listener is needed to set the  
papertype, but should not modify the paperorientation.

(4) When the paperunits is changed, a listener is needed to convert  
the values for the papersize and paperposition.

(5) When paperpositionmode is 'auto' the paperposition property is set  
to produce a figure, centered on the page, and the same size as that  
the screen.

Presently, Octave has no paper property listeners in place. However,  
we can implement printing functionality in such a manner that it will  
function properly the absence of the listeners (under the assumption  
that paperunits==inches and units==pixels), and work correctly when  
those listeners are eventually implemented.

(a) When printing output, Octave will ignore the paperorientation &  
papertype, and rely upon the papersize and paperposition.

(b) Octave will use an unwind_protect block to temporally change the  
paperunits to inches (the default) to allow the listener (which is not  
yet implemented) to change the papersize and paperposition values.  
This block may also be used to temporally change the paperposition  
when paperpositionmode == 'auto'.

(c) with the -landscape option and paperoriention==portrait, rotate  
both the papersize and the paperposition.

(d) with the -portrait option and paperoriention==landscape, rotate  
both the papersize and the paperposition.

The attached changeset has been tested with (i) gnuplot 4.2.2 using  
devices ps and pdf, and with (ii) gnuplot 4.3.0 using devices ps and  
pdf.

Ive also attached a m-file script to test the print function  
(test_print.m)

Jaroslav, this changeset should apply cleanly the both the developers  
sources as well as the 3.2 sources. Presently the -landscape option  
does  not produce the expected result (imo). Thus, I recommend this  
change be pulled to 3.2. However, before doing so I'd like it to be  
tested on Linux (and hopefully Windows).

I hope to push this tomorrow after I've done a bit more testing  
(specifically I need to verity printing a hard-copy works correclty).

Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeset.patch
Type: application/octet-stream
Size: 10751 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20090613/4e62a402/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_print.m
Type: application/octet-stream
Size: 1693 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20090613/4e62a402/attachment-0001.obj 
-------------- next part --------------





More information about the Octave-maintainers mailing list