Mercurial > octave
changeset 26933:b6ac4615214f
maint: merge stable to default
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 18 Mar 2019 12:58:09 +0100 |
parents | ef922c0631e7 (current diff) aa9745a1114a (diff) |
children | 1771bed38482 |
files | libgui/src/m-editor/file-editor.cc scripts/plot/util/print.m |
diffstat | 2 files changed, 35 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/print.m Sun Mar 17 19:13:30 2019 +0800 +++ b/scripts/plot/util/print.m Mon Mar 18 12:58:09 2019 +0100 @@ -1020,22 +1020,36 @@ endfunction -function cmd = pstoedit (opts, devopt) +function cmd = pstoedit (opts, devopt, do_svg = true) if (nargin < 2) devopt = opts.devopt; endif if (isempty (opts.pstoedit_binary)) - error ("print:nopstoedit", "print.m: 'pstoedit' is required for specified output format, but binary is not available in PATH"); + error ("print:nopstoedit", ... + ["print.m: 'pstoedit' is required for specified output format, ", ... + "but binary is not available in PATH"]); endif dos_shell = (ispc () && ! isunix ()); - if (dos_shell) - cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt); + + if (! do_svg) + if (dos_shell) + cmd = sprintf ("%s -f %s 2> NUL", opts.pstoedit_binary, devopt); + else + cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt); + endi;f + endif else - ## FIXME: Is this the right thing to do for DOS? - cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt); + cmd = svgconvert (opts, devopt); + if (dos_shell) + cmd = sprintf ("%s & %s -ssp -f %s %%s 2> NUL", cmd, ... + opts.pstoedit_binary, devopt); + else + cmd = sprintf ("%s ; %s -ssp -f %s %%s 2> /dev/null", cmd, ... + opts.pstoedit_binary, devopt); + endif endif if (opts.debug)
--- a/scripts/plot/util/private/__opengl_print__.m Sun Mar 17 19:13:30 2019 +0800 +++ b/scripts/plot/util/private/__opengl_print__.m Mon Mar 18 12:58:09 2019 +0100 @@ -88,9 +88,9 @@ pipeline = {sprintf("cat > %s", opts.name)}; endif case fig2dev_devices - cmd_pstoedit = opts.pstoedit_cmd (opts, "fig"); cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt); if (strcmp (opts.devopt, "pstex")) + cmd_pstoedit = opts.pstoedit_cmd (opts, "fig", false); [~, ~, ext] = fileparts (opts.name); if (any (strcmpi (ext, {".ps", ".tex", "."}))) opts.name = opts.name(1:end-numel(ext)); @@ -104,17 +104,26 @@ pipeline{2} = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, strrep(opts.name, ".ps", ".tex")); else + ## Using svgconvert + tmp = tempname (); + opts.unlink = [opts.unlink tmp]; + cmd_pstoedit = sprintf (opts.pstoedit_cmd (opts, "fig"), ... + "pdf", tmp, tmp); cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name); - gl2ps_device = {"eps"}; + gl2ps_device = {"svg"}; pipeline = {cmd}; endif case "aifm" - cmd = opts.pstoedit_cmd (opts, "ps2ai"); - gl2ps_device = {"eps"}; + tmp = tempname (); + opts.unlink = [opts.unlink tmp]; + cmd = sprintf (opts.pstoedit_cmd (opts, "ps2ai"), "pdf", tmp, tmp); + gl2ps_device = {"svg"}; pipeline = {sprintf("%s > %s", cmd, opts.name)}; case {"dxf", "emf", "fig", "hpgl"} - cmd = opts.pstoedit_cmd (opts); - gl2ps_device = {"eps"}; + tmp = tempname (); + opts.unlink = [opts.unlink tmp]; + cmd = sprintf (opts.pstoedit_cmd (opts), "pdf", tmp, tmp); + gl2ps_device = {"svg"}; pipeline = {sprintf("%s > %s", cmd, opts.name)}; case {"corel", "gif"} error ("print:unsupporteddevice",