|
From: Michael S. <m-s...@us...> - 2012-02-16 14:16:21
|
Hello, I would like to come back to the old story about some glyphs missing when PyX figures are included in other (postscript) documents. * We had the discussion about including PyX-EPS files in latex and then processing it with dvips. The final statement was (in short) that it is not a bug in PyX but in dvips, related to the treatment of UniqueID. http://permalink.gmane.org/gmane.comp.python.pyx.users/1228 Also interesting: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=575469 * Now, I came across the same symptom in a different context: The journal "Soft Matter" (they certainly do not use TeX, the math typesetting is too ugly). In one of the figures I sent them there are also glyphs missing (1,l,n,i,r,v) -- I do not know whether they took the EPS or the PDF file. After some digging with the minimal example I could hunt the problem down to a line in the font definition in the PyX-EPS file: fig.py: from pyx import * c = canvas.canvas() c.text(0, 0, "Hello, world!") c.writeEPSfile("fig.eps") test.tex: \documentclass{article} \usepackage{graphicx} \begin{document} Word. \includegraphics{fig.eps} Another word. \end{document} Run python fig.py; latex test; dvips test My file fig.eps produces the described effect, "Hello world!" reads in test.ps: " e o wor d ". In fact, my file fig.eps contains the following lines 355-361: 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark {restore}if %%EndFont %%EndProlog If I delete the "{restore} if" line, then everything works fine! I do not see what is to be restored at the point of font definition anyway (but this is postscript, not easy to read). It is also interesting to compare the EPS file with one that has been converted from PyX-PDF file, using the "pdftops" tool (from kpdf) pdftops -eps fig.pdf fig_kpdf.eps There are some differences in the "%%" directives, using "%%BeginResource" instead of our "%%BeginFont", but one of the differences is also that there is no "{restore} if". If I add this line after the "cleartomark" in the kpdf-generated EPS file, I observe that the *very same* glyphs are missing in test.ps. To conclude, I do think that this is a PyX bug. We should strip the "{restore} if" when including a font. Michael |