Mercurial > hg > octave-nkf
diff scripts/plot/__print_parse_opts__.m @ 10913:dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 27 Aug 2010 06:39:36 -0400 |
parents | 1d7a7fb5074b |
children | 811f8611995d |
line wrap: on
line diff
--- a/scripts/plot/__print_parse_opts__.m +++ b/scripts/plot/__print_parse_opts__.m @@ -58,7 +58,6 @@ elseif (ispc ()) arg_st.lpr_options = "-o l"; else - ## FIXME - What other OS's might be considered. arg_st.lpr_options = ""; endif arg_st.unlink = {}; @@ -82,6 +81,8 @@ arg_st.orientation = "landscape"; elseif (strcmp (arg, "-tight")) arg_st.tight_flag = true; + elseif (strcmp (arg, "-loose")) + arg_st.tight_flag = false; elseif (strcmp (arg, "-textspecial")) arg_st.special_flag = "textspecial"; elseif (strncmp (arg, "-debug", 6)) @@ -154,39 +155,17 @@ endif endif - if ((any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt)) - || (! isempty (strfind (arg_st.devopt, "tex")))) && arg_st.use_color == 0) - ## Mono is the default for ps, eps, and the tex/latex, devices + if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt))) arg_st.use_color = -1; - elseif (arg_st.use_color == 0) + else arg_st.use_color = 1; endif - if (arg_st.append_to_file) - if (isempty (arg_st.name)) - arg_st.append_to_file = false; - elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ... - "ps", "ps2", "psc", "psc2", "pdf"}))) - have_ghostscript = ! isempty (__ghostscript_binary__ ()); - if (have_ghostscript) - file_exists = ((numel (dir (arg_st.name)) == 1) && (! isdir (arg_st.name))); - if (! file_exists) - arg_st.append_to_file = false; - end - else - arg_st.append_to_file = false; - warning ("print.m: appended output requires ghostscript to be installed.") - endif - else - warning ("print.m: appended output is not supported for device '%s'", arg_st.devopt) - arg_st.append_to_file = false; - endif - endif - if (arg_st.tight_flag) if (any (strcmpi (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"}))) arg_st.tight_flag = false; - warning ("print.m: '-tight' is not supported for device '%s'", arg_st.devopt) + warning ("print.m: '-tight' is not supported for device '%s'", + arg_st.devopt) endif endif @@ -222,6 +201,11 @@ "pcx", "pcx", "pcx", "pgm", "pgm", ... "ppm", "ppm", "tex"}; + if (strcmp (get (arg_st.figure, "__backend__"), "gnuplot") + && __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix")) + suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"}; + endif + match = strcmpi (dev_list, arg_st.devopt); if (any (match)) default_suffix = suffixes {match}; @@ -233,6 +217,27 @@ arg_st.name = strcat (arg_st.name, ".", default_suffix); endif + if (arg_st.append_to_file) + if (isempty (arg_st.name)) + arg_st.append_to_file = false; + elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ... + "ps", "ps2", "psc", "psc2", "pdf"}))) + have_ghostscript = ! isempty (__ghostscript_binary__ ()); + if (have_ghostscript) + file_exists = ((numel (dir (arg_st.name)) == 1) && (! isdir (arg_st.name))); + if (! file_exists) + arg_st.append_to_file = false; + end + else + arg_st.append_to_file = false; + warning ("print.m: appended output requires ghostscript to be installed.") + endif + else + warning ("print.m: appended output is not supported for device '%s'", arg_st.devopt) + arg_st.append_to_file = false; + endif + endif + if (! isempty (arg_st.printer) || isempty (arg_st.name)) arg_st.send_to_printer = true; if (isempty (arg_st.name)) @@ -249,7 +254,7 @@ if (isempty (arg_st.canvas_size)) if (isfigure (arg_st.figure)) [arg_st.ghostscript.papersize, paperposition] = gs_papersize (arg_st.figure, - arg_st.orientation); + arg_st.orientation); else ## allows tests to be run arg_st.ghostscript.papersize = "letter"; @@ -456,7 +461,7 @@ endif ## FIXME - This will be obsoleted by listeners for paper properties. - ## Papersize is tall when portrait,and wide when landscape. + ## 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]);