Mercurial > octave
changeset 26173:0a145a1600e3
Use -tight option by default when printing EPS files (bug #53535).
* NEWS: Announce change to using a tight bounding box by default.
* print.m: Change documentation to indicate that "-tight" is now the default.
* __gnuplot_print__.m: Rename instances of "tight_flag" to "tight".
* __print_parse_opts__.m: Rename "tight_flag" to "tight". Remove variable
"loose" and use "! tight" as needed.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 05 Dec 2018 15:29:59 -0800 |
parents | a7be718a9dd3 |
children | 94fc8648f0fe |
files | NEWS scripts/plot/util/print.m scripts/plot/util/private/__gnuplot_print__.m scripts/plot/util/private/__print_parse_opts__.m |
diffstat | 4 files changed, 19 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Dec 05 21:15:40 2018 +0100 +++ b/NEWS Wed Dec 05 15:29:59 2018 -0800 @@ -123,6 +123,12 @@ compatibility. To produce uncompressed images use the -dtiffn device. + ** Printing to EPS files now uses a tight bounding box ("-tight" + argument to print) by default. This makes more sense for EPS + files which are normally embedded within other documents, and is + Matlab compatible. If necessary use the "-loose" option to + reproduce figures as they appeared in previous versions of Octave. + ** It is now possible to use files and folders containing Unicode characters in Windows.
--- a/scripts/plot/util/print.m Wed Dec 05 21:15:40 2018 +0100 +++ b/scripts/plot/util/print.m Wed Dec 05 15:29:59 2018 -0800 @@ -188,9 +188,9 @@ ## Octave interpreter from recognizing the embedded comma (','). For example, ## by writing @w{"-S640,480"}. ## -## @item -loose -## @itemx -tight -## Force a tight or loose bounding box for EPS files. The default is loose. +## @item -tight +## @itemx -loose +## Force a tight or loose bounding box for EPS files. The default is tight. ## ## @item -@var{preview} ## Add a preview to EPS files. Supported formats are: @@ -796,17 +796,17 @@ fileout = ["'" strtrim(fileout) "'"]; endif - if (! isempty (opts.preview) && opts.tight_flag) + if (! isempty (opts.preview) && opts.tight) warning ("octave:print:previewandtight", "print.m: eps preview may not be combined with -tight"); endif - if (! isempty (opts.preview) || opts.tight_flag) + if (! isempty (opts.preview) || opts.tight) if (isempty (opts.epstool_binary)) error ("print:noepstool", "print.m: 'epstool' is required for specified output format, but binary is not available in PATH"); endif - if (opts.tight_flag) + if (opts.tight) cmd = "--copy --bbox"; elseif (! isempty (opts.preview)) switch (opts.preview)
--- a/scripts/plot/util/private/__gnuplot_print__.m Wed Dec 05 21:15:40 2018 +0100 +++ b/scripts/plot/util/private/__gnuplot_print__.m Wed Dec 05 15:29:59 2018 -0800 @@ -63,7 +63,7 @@ if (any (strcmp (opts.devopt, {"eps", "epsc"}))) gp_opts = [gp_opts " level1"]; endif - if (opts.tight_flag || ! isempty (opts.preview)) + if (opts.tight || ! isempty (opts.preview)) tmp_file = [tempname() ".eps"]; eps_drawnow (opts, tmp_file, gp_opts); if (dos_shell)
--- a/scripts/plot/util/private/__print_parse_opts__.m Wed Dec 05 21:15:40 2018 +0100 +++ b/scripts/plot/util/private/__print_parse_opts__.m Wed Dec 05 15:29:59 2018 -0800 @@ -51,7 +51,6 @@ arg_st.ghostscript.antialiasing = false; arg_st.ghostscript.antialiasing_textalphabits = 4; arg_st.ghostscript.antialiasing_graphicsalphabits = 1; - arg_st.loose = false; arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr")); arg_st.name = ""; arg_st.orientation = ""; @@ -65,7 +64,7 @@ arg_st.special_flag = "textnormal"; arg_st.svgconvert = false; arg_st.svgconvert_binary = __quote_path__ (__svgconv_binary__ ()); - arg_st.tight_flag = false; + arg_st.tight = true; arg_st.use_color = 0; # 0=default, -1=mono, +1=color if (isunix ()) @@ -105,11 +104,9 @@ elseif (strncmp (arg, "-landscape", length (arg))) arg_st.orientation = "landscape"; elseif (strcmp (arg, "-loose")) - arg_st.loose = true; - arg_st.tight_flag = false; + arg_st.tight = false; elseif (strcmp (arg, "-tight")) - arg_st.loose = false; - arg_st.tight_flag = true; + arg_st.tight = true; elseif (strcmp (arg, "-svgconvert")) arg_st.svgconvert = true; elseif (strcmp (arg, "-textspecial")) @@ -372,7 +369,7 @@ arg_st.ghostscript.output = arg_st.name; arg_st.ghostscript.antialiasing = true; if (arg_st.formatted_for_printing) - arg_st.ghostscript.epscrop = ! arg_st.loose; + arg_st.ghostscript.epscrop = arg_st.tight; else ## pstoedit throws errors if the EPS file isn't cropped arg_st.ghostscript.epscrop = true; @@ -383,7 +380,7 @@ arg_st.ghostscript.device = arg_st.devopt; arg_st.ghostscript.output = arg_st.name; arg_st.ghostscript.antialiasing = false; - arg_st.ghostscript.epscrop = ! arg_st.loose; + arg_st.ghostscript.epscrop = arg_st.tight; endif if (unknown_device) @@ -507,7 +504,7 @@ #%!test %! opts = __print_parse_opts__ ("-deps", "-tight"); -%! assert (opts.tight_flag, true); +%! assert (opts.tight, true); %! assert (opts.send_to_printer, true); %! assert (opts.use_color, -1); %! assert (opts.ghostscript.device, "");