[Fwd: Re: Re: [Matplotlib-users] Font problems with generated EPSs]

Hi Darren,

Darren Dale <dd55@...143...> writes:

Darren Dale <dd55@...143...> writes:

However, mpl uses a latex package called PSFrag to
render the text in an intermediate postscript file, which is not
compatible with pdflatex. Unfortunately, if you embed that intermediate
postscript file in a new document, the text will frequently be upside
down, because PSFrag uses some commands that are illegal in embedded
documents. So by default, mpl uses ghostscript to "distill" the
intermediate postscript file, converting the fonts to outlines and
circumventing the problem.

I attach a patch against matplotlib 0.85 that uses a picture
environment to position text instead of using psfrag.

It isn't complete, and therefore probably shouldn't be applied just yet,
but may be a useful starting point. In particular, I haven't taken out
the distill code, but suspect that it could be replaced by using the
right options to dvips.

It looks like the right command is 'dvips -E'

If I had the right dvips command instead of the ghostscript distilling
process, would this result in a legal eps file? Ie is this worth pursuing?

Here is a post from way back describing the embedding issue: http://sourceforge.net/mailarchive/message.php?msg_id=12030448

"PSFrag was not designed to do what I am trying to do: generate an eps file that can later be embedded in a document. It uses a number of PostScript operators that are illegal in an eps file: setglobal, statusdict and userdict. Here is the blurb from PostScript Language Reference, Second Edition, Appendix I: setglobal disrupts page independence and nesting of included documents. [...] Creation and modification of global objects are uneffected by save-restore operators."

So, to answer your question, if you need to use a PostScript operator that is illegal in an eps file, it is not worth pursuing.

Unfortunately, dvips -E always seems to generate files with illegal
operators (see below).

I think your patched backend_ps.py still generates a .tex file that uses the PSFrag package, which will unavoidably end up using illegal PostScript operators. Is this correct?

No. I don't use PSFrag at all (the aim was to avoid the problems you
mention above).

I am however unable to generate a file from tex without statusdict or
userdict in it.

Take the following trivial tex file:

  \documentclass{article}
  \pagestyle{empty}
  \begin{document}
  foo
  \end{document}

If I run

latex
dvips -E

then it still uses statusdict and userdict, though not setglobal:

$ grep statusdict 20d9640a1b4e20b0a71da122eaf41ca7.ps
statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT)

$grep userdict 20d9640a1b4e20b0a71da122eaf41ca7.ps
}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
userdict /end-hook known{end-hook}if

Both are in the section beginning /TeXDict.

In which case, trying to use dvips -E to generate an eps file seems
doomed to failure. Perhaps I have misunderstood the restrictions on using statusdict and userdict - if they are really a problem, then what is the point of dvips -E?

Chris

···

On Tuesday 03 January 2006 10:48, Chris Walker wrote: