octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #40259] Printing in landscape mode is clipped


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #40259] Printing in landscape mode is clipped
Date: Sat, 19 Jul 2014 15:53:50 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.77.4 (KHTML, like Gecko) Version/7.0.5 Safari/537.77.4

Follow-up Comment #15, bug #40259 (project octave):

Opps. I forgot to explain why I don't like my prior patch.  Below is more
context for the patch to __print_parse_opts__.m.  Note that transposing of the
papersize is done twice.  At best, this is clumsy and confusing, but I suspect
this points to a bug later in the code.


     papersize = papersizes (strcmp (papertypes, papertype), :);
   endif
 
+  ## Change default papersize if current paperorientation of figure is
landscape
+  if (strcmpi (get (hfig,"paperorientation"), "landscape"))
+    papersize = papersize([2,1]);
+  endif
+
  if (strcmp (paperunits, "normalized"))
    paperposition = paperposition .* papersize([1,2,1,2]);
  else
    paperposition = convert2points (paperposition, paperunits);
  endif

  ## FIXME: This will be obsoleted by listeners for paper properties.
  ##        Papersize is tall when portrait,and wide when landscape.
  if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait"))
      || (papersize(1) < papersize(2) && strcmpi (paperorientation,
"landscape")))
    papersize = papersize([2,1])
    paperposition = paperposition([2,1,4,3])
  endif


I addition, the remaining part of the function is


  if ((! strcmp (papertype, "<custom>")) && (strcmp (paperorientation,
"portrait")))
    ## For portrait use the ghostscript name
    papersize = papertype;
    papersize(papersize=="-") = "";
    papersize = strrep (papersize, "us", "");
    switch (papersize)
      case "a"
        papersize = "letter";
      case {"b", "tabloid"}
        papersize = "11x17";
      case {"c", "d", "e"}
        papersize = strcat ("arch", papersize);
    endswitch
    if (strncmp (papersize, "arch", 4))
      papersize(end) = upper (papersize(end));
    endif
  endif

endfunction


I'd suggest this part be modified so that all cases are handled in the same
way (to minimize code maintenance).

A good start would be to clean up the code with regards to papersize and
paperorienetation.  Specifically the inconsistent behavior between Octave and
Matlab seen below. Notice that changing the orientation flips the width/height
of the papersize and paperposition in Octave, but only flip the width/height
of the papersize in Matlab.  This may be the root cause of the bug (some/all
of the code may be written expecting compatible behavior).


% MATLAB
get (gcf, 'paperorientation')

ans =

portrait

get (gcf, 'papersize'), get (gcf, 'paperposition')

ans =

    8.5000   11.0000

ans =

    0.2500    2.5000    8.0000    6.0000

set (gcf, 'paperorientation', 'landscape')
get (gcf, 'papersize'), get (gcf, 'paperposition')

ans =

   11.0000    8.5000

ans =

    0.2500    2.5000    8.0000    6.0000



# OCTAVE
 get (gcf, 'paperorientation')
ans = portrait
get (gcf, 'papersize'), get (gcf, 'paperposition')
ans =

    8.5000   11.0000

ans =

   0.25000   2.50000   8.00000   6.00000

set (gcf, 'paperorientation', 'landscape')
get (gcf, 'papersize'), get (gcf, 'paperposition')
ans =

   11.0000    8.5000

ans =

   2.50000   0.25000   6.00000   8.00000




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40259>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]