bugGNU Octave - Bugs: bug #66149, emf printing is broken with...

 
 

bug #66149: emf printing is broken with ghostscript 10

Submitter:  Fabio <efferre79>
Submitted:  Fri 30 Aug 2024 05:21:55 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.2.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 01 Sep 2024 08:39:16 PM UTC, comment #8: 

@efferre79: I agree with the fact that importing SVG files directly is still not an option, because support is completely absent for old versions of MSOffice and very poor even in 2016+ versions I've had at hand. My experience though is that Octave's own emf files are generally of poor quality. My advice to students that really want to use MSWord for their reports is to use Inkscape (like Dmitri poited out) to convert svg files into much better looking EMF figures.

So considering the maintenance burden  I would also be in favor of dropping support for fig and emf formats in Octave: it was never really convincing anyway.

As a convenience function, if you have inkscape installed, I attached a simple function that you can call as below:


demo text 6
inkprint -demf toto.emf


to obtain the attached emf file.



(file #56401, file #56402)

Pantxo Diribarne <pantxo>
Group Member
Sun 01 Sep 2024 10:42:28 AM UTC, comment #7: 

In some exotic cases one can always use 3-d party tools to convert SVG to pretty much anything. I recommend Inkscape.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 01 Sep 2024 10:37:24 AM UTC, comment #6: 

I don't agree, old versions of Office don't support SVG!

Fabio <efferre79>
Sun 01 Sep 2024 10:33:15 AM UTC, comment #5: 

I think Octave should deprecate and eventually drop support for emf/fig formats. In old days EMS was the only vector format that can be imported into MS Office and similar, and FIG was useful for post-processing editing in e.g. XFIG. Nowadays SVG can be used instead.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 01 Sep 2024 10:23:58 AM UTC, comment #4: 

thanks dmitri for the hints! it seems the pipeline of commands should be changed to support latest ghostscript versions.

Fabio <efferre79>
Sat 31 Aug 2024 04:23:35 AM UTC, comment #3: 

From http://www.calvina.de/pstoedit/pstoedit.htm#section_8


Up to version 9.55 of Ghostscript, it's PDF interpreter was implemented in PostScript itself. That allowed pstoedit to handle PDF files in the same way as PostScript files since the same mechanisms for intercepting the drawing operations could be used.

However, from version 9.56 on, the PDF interpreter of Ghostscript was implemented in C and hence the interceptions used by pstoedit are no longer effective when processing PDF files.

You need to convert the PDF to PostScript at first before you can convert it into another format. You can use Ghostscript for that or also use the gs:ps2write (-f gs:ps2write) driver from pstoedit.


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 30 Aug 2024 10:42:14 PM UTC, comment #2: 

I confirm the problem on Fedora 40 with ghostscript 10.02.1.
Doing:

octave:1> plot (1:3)
octave:2> print t1.pdf

(pdf is OK)
and than in the shell:

$ pstoedit -ssp -f fig t1.pdf t1.fig
pstoedit: version 4.00 / DLL interface 108 (release build - g++ 14.0.1 20240118 (Red Hat 14.0.1-0) - 64-bit) : Copyright (C) 1993 - 2023 Wolfgang Glunz

the resulting file (t1.fig) is pretty much empty.

$ cat t1.fig
#FIG 3.2
Portrait
Flush left
Inches
Letter
100.00
Single
0
1200 2

I have not investigate it further.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 30 Aug 2024 05:22:32 PM UTC, comment #1: 

I mean print() help

Fabio <efferre79>
Fri 30 Aug 2024 05:21:55 PM UTC, original submission:  

I had installed ghostscript 10.03.1. The printing to EMF is again broken. I solved temporarily by downgrading to ghostscript 9.53.3.

This is an example script to trigger the issue:


plot(1,1)
print -debug test.emf


The output file test.emf is empty (0 length). It seems another case of bug #55906 or bug #58702.

The debugging output I get is


fig2dev command: '/usr/bin/fig2dev -L emf 2> /dev/null'
svgconvert command: '/usr/libexec/octave/9.2.0/exec/x86_64-pc-linux-gnu/octave-svgconvert - %s 96.17 "/usr/share/octave/9.2.0/fonts/FreeSans.otf" 1 "%s"'
pstoedit command: '/usr/libexec/octave/9.2.0/exec/x86_64-pc-linux-gnu/octave-svgconvert - %s 96.17 "/usr/share/octave/9.2.0/fonts/FreeSans.otf" 1 "%s" ; /usr/bin/pstoedit -ssp -f fig "%s" 2> /dev/null'
opengl-pipeline: '/usr/libexec/octave/9.2.0/exec/x86_64-pc-linux-gnu/octave-svgconvert - pdf 96.17 "/usr/share/octave/9.2.0/fonts/FreeSans.otf" 1 "/tmp/oct-AsT0F3" ; /usr/bin/pstoedit -ssp -f fig "/tmp/oct-AsT0F3" 2> /dev/null "/tmp/oct-wxcXas.fig" ; /usr/bin/fig2dev -L emf 2> /dev/null "/tmp/oct-wxcXas.fig" "test.emf"'


How can I avoid the deletion of the temporary file /tmp/oct-AsT0F3 used by octave-svgconvert to further debug the issue on the shell?

Moreover -debug option is not documented in the plot() help!

Fabio <efferre79>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56401:  inkprint.m added by pantxo (2KiB - text/x-objcsrc)
file #56402:  toto.emf added by pantxo (97KiB - image/emf)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by efferre79 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-01 pantxo Attached File- Added inkprint.m, #56401
        Attached File- Added toto.emf, #56402
        CategoryPlotting Plotting with OpenGL
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.14-3b9d.
    Corresponding source code