Menu

#8 problem in exporting figure object (generated from ps file)

closed
nobody
None
2019-10-30
2017-01-13
No

This problem was reported as Debian Bug #248807 by Gang Liang some time ago, but still persists in 3.2.6a.

Gang builds a Fig file, which consists of some text and an included PS file (created by LaTeX, named mytex.ps).
In xfig mytex.ps and the text can be seen side by side, while the contents of mytex.ps is replaced by a white page (after a short flash of the text at startup), when exporting with fig2dev.

The attached 248807.tar.gz contains the following files to reproduce the issue:
* mytex.fig (the FIG file)
* mytex.ps (the LaTeX based PS file embedded in mytex.fig)
* mytex-ro4.ps (the result when you fig2dev mytex.fig)

1 Attachments

Discussion

  • tkl

    tkl - 2017-01-13

    There is a button in the picture widget labelled "EPS/PS", but this is misleading. Xfig and fig2dev are really only able to import eps-files. In the source code, ps-files are dealt with as if they were eps-files. There is no trace of a differentiation between eps- and ps-file.

    In the short run, this will be fixed by renaming the button from "EPS/PS" to "EPS". The documentation only mentions the import of eps-files. I am not sure, whether the import of ps-files can or will be fixed.

    For the time being, a workaround is to use the pdftops program from the poppler-utils package and do ps2pdf mytex.ps tmp.pdf; pdftops -eps tmp.pdf mytex.ps. The attached example figure mytex.fig can then be correctly converted with fig2dev -L ps mytex.fig out.ps. The commands based on ghostscript to convert a ps-file to an eps-file can not be used because these commands also compute a new, tight bounding box and crop the original image to it.

     
  • tkl

    tkl - 2017-01-16

    A possible fix is to insert before the included ps-file

    save countdictstack mark newpath /showpage {} def /setpagedevice /pop load def
    

    and to append after the included ps-file

    cleartomark countdictstack exch sub { end } repeat restore
    

    The above is, besides manipulation of the comments for DSC-conformance, what the ps2epsi script that comes with ghostscript and, very similarly, the pstoeps program does. The latter has /setpagedevice {pop} def instead of /setpagedevice /pop load def.

     
  • tkl

    tkl - 2017-02-22

    The issue is fixed in the next release. Before including an eps or ps file, /setpagedevice is redefined to pop, /setpagedevice {pop} def. This may allow at least some ps-files, for instance those produced by latex or those produced by fig2dev, to be embedded into output produced by fig2dev.

    Not related to this issue, it is now also possible to include epsi files. These are eps files which are mostly found under Windows, They have a binary header prepended and a tiff preview appended to the eps code proper.

     
  • tkl

    tkl - 2017-02-22
    • status: open --> pending
     
  • tkl

    tkl - 2018-04-13
    • status: pending --> closed
     

Log in to post a comment.