octave-maintainers
[Top][All Lists]
Advanced

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

Re: overriding print.m pdf default terminal choices?


From: Ben Abbott
Subject: Re: overriding print.m pdf default terminal choices?
Date: Tue, 25 Aug 2009 15:22:35 -0400


On Aug 24, 2009, at 6:43 PM, Ben Abbott wrote:

On Aug 24, 2009, at 4:01 PM, Benjamin Lindner wrote:

Benjamin Lindner wrote:
Ben Abbott wrote:
On Monday, August 17, 2009, at 11:27AM, "Benjamin Lindner" <address@hidden > wrote:
Hello list,

I wondered if it is possible to force print.m to use ghostscript for
printing to pdf even if gnuplot provides a pdfcairo terminal?

I ask because the last available gnuplot for win32 does not include the
patch which fixes the spurious-pages-in-pdf-output bug.
So a command as
plot(0:0.1:10, sin(0:0.1:10), "@-"); print -dpdf test.pdf
produces a three-page pdf.

I don't know when there will be a new gnuplot release or snapshot
release but the do not happen very frequently.

So for the mingw32 binaries I'd like to have print.m to use ps- >pdf via
ghostscript for the moment.

benjamin

I assume you are referring to Octave's latest sources, and that you are not running gnuplot's development sources (meaning your version of gnuplot is 4.2.x, or earlier)?
Actually I'm referring to the 3.2.x branch of octave and the latest version of gnuplot available is the 2008-11-21 4.3.0 cvs snapshot.
If so then, what you're asking for should be the default. If it is not, then the check for ghostscript may be failing.

Does the code below indicate you have ghostscript installed?

  if (~isempty (getenv ("GSC")))
    persistent ghostscript_binary = getenv ("GSC");
  else
    persistent ghostscript_binary = "gswin32c";
  endif
[status, output] = system (sprintf ("if exist \"%s\" ( exit /B 1 ) else ( exit /B 0 )", ghostscript_binary));
  have_ghostscript = (status == 0)

Ben

thanks for the hint.
I have the environment variable GSC defined as
> ghostscript_binary = getenv("GSC")
ghostscript_binary = C:\Programs\gs\gs8.62\bin\gswin32c.exe
and naturally this executable exists.
However, have_ghostscript evaluates to false.
This is strange.
Seems the exit code is not propagated into the variable status, as
> [s,o]=system("exit 1")
s =  127
o =
but
> system("exit 1")
ans =  1
I need to investigate this further.

Ben, I think your code snippet above is out of date.
In both 3.2.3 and current development tip I have

elseif (ispc ())
[status, output] = system (sprintf ("if exist \"%s\" ( exit /B 1 ) else ( exit /B 0 )", ghostscript_binary));
    have_ghostscript = (status ~= 0);
endif

The fact that calling system with two outputs does not return the correct exit code on windows aside, I end up with have_ghostscript = 1. I use the 4.3.0-cvs snapshot of 2008-11-21 (from the gnuplot homepage) and built with support for the pdfcairo terminal.

The result being that print uses the pdfcairo terminal, because it is preferred over an available ghostscript.

And I'm back again at my first question: Is there an easy way to make print.m prefer the ghostscript way? Or do I need to provide a 4.3.0 version of gnuplot without the cairo terminals?

benjamin

You are correct. Thanks for catching my error.

Although others have expressed a preference for the cairo terminals, I have no objection the changing the preferred default to use Ghostscript. There is one feature of the postscript terminal that concerns me. The ghostcript terminal explicitly sets the BBOX to be 50pts inside the edge of the page. This often results in text being clipped with printed.

Perhaps print() should be rewritten to crop ps output at the BBOX? If so a 50pt border added to the pagesize and then clipped by ghostscript. Once that is done, we could also produce eps output by converting a postscript file. This would be nice as gnuplot's eps terminal scales down the size of the fonts.

The only problem with that is we currently don't have ghostscript as a run time dependency. Should that be changed?

In any event, I'm presently not able to build octave, am weary of producing any changesets until I can.

Ben

I opted for a less ambitious solution. The attached changeset allow the use to add "-ghostscript" when producing a pdf output.

Is that an acceptable solution?

Ben

Attachment: changeset.patch
Description: Binary data







reply via email to

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