bugGNU Octave - Bugs: bug #31976, Cannot print in emf form in fltk...

 
 

bug #31976: Cannot print in emf form in fltk printing (MinGW)

Submitter:  Tatsuro MATSUOKA <tmacchant>
Submitted:  Sat 25 Dec 2010 05:57:45 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Tatsuro MATSUOKA Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 24 Feb 2012 01:09:24 PM UTC, comment #38: 

I've pushed the chagneset!

http://hg.savannah.gnu.org/hgweb/octave/rev/61cc4c715962

Thanks for the help!!

I'm closing this report, if something goes wrong it can be reopened.

Ben Abbott <bpabbott>
Group Member
Fri 24 Feb 2012 02:59:39 AM UTC, comment #37: 

I have confirmed that 31976-f.diff worked!

Thanks!!!!!!!!!!!!!!

Tatsuro MATSUOKA <tmacchant>
Fri 24 Feb 2012 02:37:31 AM UTC, comment #36: 

Tatsuro,

Please confirm the attached patch (31976-f.diff) works.


(file #25153)

Ben Abbott <bpabbott>
Group Member
Fri 24 Feb 2012 01:54:46 AM UTC, comment #35: 

In the patch, one line

        cmd = strrep (cmd, "\\", "/" );


replaced the below

        cmd = strrep (cmd, "/", "\\");


(Replace "/" character with "\". )

A correct emf file was created.

Thanks !!!!!!

Tatsuro MATSUOKA <tmacchant>
Fri 24 Feb 2012 01:36:38 AM UTC, comment #34: 

The changeset, 31976-e.diff switches back to the double-quotes and replaces the "|" character with "/"

(file #25152)

Ben Abbott <bpabbott>
Group Member
Fri 24 Feb 2012 01:21:54 AM UTC, comment #33: 

Ben
Thank you for your efforts.


octave:7> print -debug fltk_test.emf
pstoedit command: "'c:\Program Files\pstoedit/pstoedit.exe' -f fig 2> NUL"
fig2dev command: "'c:\Programs\fig2dev/fig2dev.exe' -L emf 2> NUL"
fltk-pipeline: "'c:\Program Files\pstoedit/pstoedit.exe' -f fig 2> NUL | 'c:\Programs\fig2dev/fig2dev.exe' -L emf 2> NUL > fltk_test.emf"


This time, nothing is created.


pstoedit command: "'c:\Program Files\pstoedit/pstoedit.exe'

The quoting the path with single quite(') is not acceptable in windows command prompt.

Tatsuro MATSUOKA <tmacchant>
Fri 24 Feb 2012 12:30:54 AM UTC, comment #32: 

My mistake. I didn't attach the proper patch.

Please try 31976-d.diff

(file #25151)

Ben Abbott <bpabbott>
Group Member
Fri 24 Feb 2012 12:25:35 AM UTC, comment #31: 

I have attached 31976-c.diff and executed the test.


octave:5> print -debug fltk_test.emf
error: `caller' undefined near line 435 column 42
error: evaluating argument list element number 2
error: called from:
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\private\__print_parse_opts__.m at line 435, column 5
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\private\__print_parse_opts__.m at line 53, column 21
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\print.m at line 261, column 8


In the _print_parse_opts_.m


function cmd = __quote_path__ (cmd)
  if (! isempty (cmd))
    is_quoted = all (cmd([1, end]) == "'");
    if (! is_quoted)
      dos_shell = ! isunix () && ispc ();
      if (any (cmd == " ") || (dos_shell && any (cmd == '\')))
        cmd = strcat ("'", strrep (cmd, "'", "''"), "'");
      endif
    endif
  else
    error ("%s: shell command is empty", caller)
  endif
endfunction


Value of cmd seems to be empty.

Tatsuro MATSUOKA <tmacchant>
Fri 24 Feb 2012 12:06:01 AM UTC, comment #30: 

Tatsuro,

Thank you for your patience !

I think the bug is due to '\' being interpreted as the beginning of an escape sequence (i.e. "\n" = new line).

Also, the _quote_path_(cmd) function be called with cmd = "", if one of the supporting shell utilities is missing.

I've done some testing for 31976-c.diff on MacOS with _quote_path_ forced to think I'm running on MinGW. This changeset works for me.

(file #25150)

Ben Abbott <bpabbott>
Group Member
Thu 23 Feb 2012 02:04:44 AM UTC, comment #29: 

The result of changeset-a.patch.


octave:6> print -debug fltk_test.emf
error: __quote_path__: subscript indices must be either positive integers or logicals
error: called from:
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\private\__print_parse_opts__.m at line 427, column 13
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\private\__print_parse_opts__.m at line 53, column 21
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\print.m at line 261, column 8


The result of changeset-b.patch.

error: unterminated string constant
parse error near line 431 of file e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\private\__print_parse_opts__.m

  syntax error

>>>     cmd = strrep (cmd, "/", "\");
                                 ^

error: called from:
error:   e:\usr\Tatsu\mingwhome\octaves\OctBuild\hg-devel\..\..\hg\octave-work\scripts\plot\print.m at line 261, column 8




Tatsuro MATSUOKA <tmacchant>
Thu 23 Feb 2012 01:36:20 AM UTC, comment #28: 

I've attached two more quick attempts.




(file #25124, file #25125)

Ben Abbott <bpabbott>
Group Member
Thu 23 Feb 2012 01:18:07 AM UTC, comment #27: 

Thank you for your patch.

However,

octave:21> print -debug fltk_test.emf
pstoedit command: '"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL'
fig2dev command: '"c:\Programs\fig2dev/fig2dev.exe" -L emf 2> NUL'
fltk-pipeline: '"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | "c:\Programs\fig2dev/fig2dev.exe" -L emf 2> NUL > fltk_test.emf'

still give empty emf.

I cannot figure out the reason why your patch does not work.


BTW, I found that eps cannot print for MinGW.


'c:\Programs\gs\gs9.04\bin/gswin32c.exe" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite -sOutputFile="fltk_test.eps' is not recognized as an internal or external command,
operable program or batch file.
epstool command: '"c:\Programs\gs\gs9.04\bin/gswin32c.exe" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite -sOutputFile="fltk_test.eps" -'
fltk-pipeline: '"c:\Programs\gs\gs9.04\bin/gswin32c.exe" -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite -sOutputFile="fltk_test.eps" -'


The left side of the command
c:\Programs\gs\gs9.04\bin/gswin32c.exe

is not quoted by ".

Tatsuro MATSUOKA <tmacchant>
Wed 22 Feb 2012 05:02:01 PM UTC, comment #26: 

Ok. My mistake. Trying again.

(file #25115)

Ben Abbott <bpabbott>
Group Member
Wed 22 Feb 2012 04:52:41 PM UTC, comment #25: 

The attached changeset seems to be one for ND-plotting, not for emf printing.

Rik <rik5>
Group administrator
Wed 22 Feb 2012 02:19:16 PM UTC, comment #24: 

Thanks Tatsuro.

You've saved me a lot of work! This should be easy to fix.

Please try the attached changeset.

(file #25108)

Ben Abbott <bpabbott>
Group Member
Wed 22 Feb 2012 05:07:44 AM UTC, comment #23: 

In the verbatim " is deleted

The third case is

cat fltk_test.fig | "C:\Programs\fig2dev/fig2dev.exe" -L emf 2> NUL
 > fltk_test.emf


Tatsuro MATSUOKA <tmacchant>
Wed 22 Feb 2012 05:02:07 AM UTC, comment #22: 

I have misled.

Not from msys prompt by ./run-octave


>>system('cmd')
E:\usr\Tatsu\program\Octave\test2>type fltk_test.fig | C:\Programs\fig2dev\fig2dev.exe -L emf 2> NUL > fltk_test.emf

works well.

Therefore problem does not lie on cygwin version fig2dev.

Seeing the command in detail fig2dev command is not quoted by "" and both \ (back slash) and / (slash) are used as path separator.

I have tested three cases.v.exe -L emf 2> NUL > fltk_test.emf


cat fltk_test.fig | C:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL
 > fltk_test.emf

gives empty emf file.



cat fltk_test.fig | C:\Programs\fig2dev\fig2dev.exe -L emf 2> NUL
 > fltk_test.emf

gives correct emf file.


cat fltk_test.fig | C:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL
 > fltk_test.emf

gives correct emf file.

At the top of the command line path like C:\Programs\fig2dev/fig2dev.exe seems to be acceptable.
But it seems not to be accepted in the pipe command, which is command after "|" .

Perhaps the solution to be C:\Programs\fig2dev/fig2dev.exe given as "C:\Programs\fig2dev/fig2dev.exe" or C:\Programs\fig2dev\fig2dev.exe.

I do not know where is to be changed to complete this.
Please give me advise.

Tatsuro MATSUOKA <tmacchant>
Tue 21 Feb 2012 11:41:58 PM UTC, comment #21: 

Hello
http://www.schmidt-web-berlin.de/winfig/

Winfig is shareware so that I do not use it.

Fig2dev bundled with winfig works without registration so I tried.


type fltk_test.fig | "C:\Program Files (x86)\WinFIG\fig2dev.exe" -L emf 2> NUL > fltk_test.emf


This time, fltk_test.emf is not empty but broken.

However,

"C:\Program Files (x86)\WinFIG\fig2dev.exe" -L emf 2> NUL fltk_test.fig fltk_test.emf


give correct emf.

Anyway fig2dev though pipe seems not to be work correctly on native windows.

Tatsuro MATSUOKA <tmacchant>
Tue 21 Feb 2012 11:16:02 PM UTC, comment #20: 

Tatsuro, do you have an experience with WinFig's fig2dev ?

http://www.schmidt-web-berlin.de/winfig/

it looks to be written for the DOS COMMAND shell.

Ben Abbott <bpabbott>
Group Member
Tue 21 Feb 2012 10:45:52 PM UTC, comment #19: 

Note that fig2dev on windows is cygwin version.  This may be reason  why fig2dev cannot treat pipe data.

Tatsuro MATSUOKA <tmacchant>
Tue 21 Feb 2012 09:45:55 PM UTC, comment #18: 


>> print -debug fltk_test.fig
pstoedit command: '"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL'
fltk-pipeline: '"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL > fltk_test.fig'



>> print -debug fltk_test.emf
pstoedit command: '"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL'
fig2dev command: 'c:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL'
fltk-pipeline: '"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | c:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL > fltk_test.emf'


I worked on cmd command line


type fltk_test.fig | c:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL > fltk_test.emf


gives empty emf file.


c:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL fltk_test.fig fltk_test.emf


gives correct emf file.

For windows,


"c:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | c:\Programs\fig2dev/fig2dev.exe -L emf 2> NUL > fltk_test.emf'


seems not to work.

Tatsuro MATSUOKA <tmacchant>
Tue 21 Feb 2012 01:18:06 PM UTC, comment #17: 

Tatsuro,

Thank you for the quick response. On MacOS, I tried the script below.


if (! strcmp (graphics_toolkit (), "fltk"))
  close all
  graphics_toolkit fltk
endif
figure (1)
clf
plot (rand (3))
xlabel xlabel
ylabel ylabel
title title
print -debug test.emf


The resulting debug info is below.


pstoedit command: '/opt/local/bin/pstoedit -f fig 2> /dev/null'
fig2dev command: '/opt/local/bin/fig2dev -L emf 2> /dev/null'
fltk-pipeline: '/opt/local/bin/pstoedit -f fig 2> /dev/null | /opt/local/bin/fig2dev -L emf 2> /dev/null > test.emf'


The test.emf produced looks good when opened in OpenOffice.

Can you tell me what debug information is given for you with MinGW? Also, how what do you recommend be changed to produce the correct result?

Ben Abbott <bpabbott>
Group Member
Tue 21 Feb 2012 09:22:56 AM UTC, comment #16: 

print ("fltk_test.fig","-dfig")

gives correct 'fig' file.

(I have confirmed Xfig on Cygwin.)
I can manually transform the "fig" file to "emf" file using fig2dev.

Therefore something is wrong in transformation "fig" to "emf" file in Octave operation.

Tatsuro MATSUOKA <tmacchant>
Tue 21 Feb 2012 01:22:01 AM UTC, comment #15: 

I looked at print.m, the piece of code that is problematic is below.


        if (dos_shell)
          filein(filein=="'") = "\"";
          gs_cmd = __ghostscript__ ("binary", opts.ghostscript.binary,
                                    "device", "epswrite",
                                    "source", "-",
                                    "output", filein);
          cmd = sprintf ("%s %s & %s", gs_cmd, filein, cmd);
        else
          cmd = sprintf ("cat > %s ; %s", filein, cmd);
        endif


Essentially, we try to pipe data in by pipe. For unix the gl2ps pipes the eps language through "cat".

We use a pipe up front because gl2ps is asynchronous. Thus, if we save the eps output a file  we don't know when the file will be closed and won't know when to continue to process it to produce any of the other output formats (png, ps, pdf, jpg, emf, fig, etc are all produced by converting the eps file).

The current implementation attempts to use ghostscript to form a pipe. I don't know if this is working or not, but if it does it has an unfortunate side effect. Piping through ghostscript will break using psfrag. I'd like to preserve that if possible.


Ben Abbott <bpabbott>
Group Member
Tue 21 Feb 2012 12:36:04 AM UTC, comment #14: 

My bad.  The problem is with MinGW so the code I wrote was correct.  It was the comment that was wrong.  It should be:


if (ispc () && ! isunix ())
   ## MinGW-only stuff
else
   ...
endif



Rik <rik5>
Group administrator
Tue 21 Feb 2012 12:25:23 AM UTC, comment #13: 

I had thought Cygwin returned true for isunix() but MinGW returned false.

Do Cygwin and MinGW behave the same?

Ben Abbott <bpabbott>
Group Member
Mon 20 Feb 2012 08:29:40 PM UTC, comment #12: 

Ben,

Marco's test is correct.  Use


if (ispc () && ! isunix ())
   ## Cygwin-only stuff
else
   ...
endif


Can we protect a Cygwin-only pipe command for the printing of emf?  It appears from the re-reading the bug report that one needs to insert an extra 'type FILENAME |' at the start of the command to get things started.  In UNIX-speak this would be 'cat FILENAME |' but we don't need to implement it for the other platforms.



Rik <rik5>
Group administrator
Mon 03 Oct 2011 11:46:39 AM UTC, comment #11: 

on cygwin

octave:1> ispc()
ans = 0
octave:2> isunix()
ans =  1

I guess Mingw is reverse

marco atzeri <matzeri>
Tue 27 Sep 2011 11:30:53 AM UTC, comment #10: 

Its been a while since I looked at this. I recall the problem is with piping (from octave to pstoedit?).

After a quick review, it appears the command below doesn't work.


"C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> NUL > test1.emf


But this one does.


C:\usr\tatsu\test\testOctave\fltk_print_test>type test1.eps | "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> NUL > test1.emf


The difference is the leading part below.


C:\usr\tatsu\test\testOctave\fltk_print_test>type test1.eps |


What Octave commands are needed to ensure we are running Mingw and not Cygwin or some other OS?

Ben Abbott <bpabbott>
Group Member
Tue 27 Sep 2011 06:17:33 AM UTC, comment #9: 

Not solved yet.


print ('fltk_test.png','-dpng');
print ('fltk_test.eps','-deps');


went well.

But

print ('fltk_test.emf','-demf');

gave empty plot.

Tatsuro MATSUOKA <tmacchant>
Tue 27 Sep 2011 04:13:13 AM UTC, comment #8: 

Has emf printing from the FLTK backend been resolved?  The last action on this was back in January, 2011.

Rik <rik5>
Group administrator
Tue 18 Jan 2011 09:16:39 PM UTC, comment #7: 

I don't see a consistent behavior with comparing the manual method to Octave. Using the developer sources with no patch ...


octave:22> print -debug test-print.emf
pstoedit command: '/sw/bin/pstoedit -f fig 2> /dev/null'
fig2dev command: '/sw/bin/fig2dev -L emf 2> /dev/null'
fltk-pipeline: '/sw/bin/pstoedit -f fig 2> /dev/null | /sw/bin/fig2dev -L emf 2> /dev/null > test-print.emf'
octave:23> print -depswrite test.eps



cat test.eps | /sw/bin/pstoedit -f fig 2> /dev/null | /sw/bin/fig2dev -L emf 2> /dev/null > test-bash.emf
-verbatiim-

The files "test-print.emf" and "teset.eps" both include the text (the are attached). The file "test-bash.emf" does not include the text.

I don't understand what is happening.

(file #22446, file #22447, file #22448)

Ben Abbott <bpabbott>
Group Member
Tue 18 Jan 2011 07:24:43 PM UTC, comment #6: 


>34     fig2dev_devices = {"pstex", "mf", "emf"};
>If "emf" is removed then pstoedit will be used to produce the emf file. This may fix the warning.


I have carried out this.

*********
octave.exe:6> print -debug test1.emf
pstoedit command: '"c:\Program Files\pstoedit/pstoedit.exe" -f emf 2> NUL'
fltk-pipeline: '"c:\Program Files\pstoedit/pstoedit.exe" -f emf 2> NUL > test1.emf'
***********

The content in test1.emf
********************
The driver for the selected format cannot write to standard output because it writes binary data
********************

I have carried out manually translate test1.eps to test1.emf.
The test1.eps is generated by
******************
demo ("legend", 1)
h = findall (gcf, "-property", "fontname");
set (h, "fontname", "Helvetica")
print -debug test1.eps
******************

From DOS command prompt,
***********
C:\xxx>"c:\Program Files\pstoedit/pstoedit.exe" -f emf test1.eps test1.emf
**********
pstoedit: version 3.50 / DLL interface 108 (build Aug 10 2009 - release build - MS VC++ 1300) : Copyright (C) 1993 - 2009 Wolfgang Glunz
too many data in line 603 size is 336 : ignoring 007FFF8007FF01FFFFF00FFF07FFFFF80FFF0FFFFFFE1FFF1FFFFFFF1FFF1FFFFFFF9FFF3FFC01FFFFF07FF0003
FFFE07FC0000FFFC07F800007FFC0FF800003FFC0FF000000FFC0FF000000FFC0FF0000007FC0FF0000003FC0FF0000003FC0FF0000003FC0FF0000003FC0FF8000003FC07FC
000003FC07FE000003FC07FF000003FC03FFC00003FC01FFFC0003FC00FFFFF003FC007FFFFFC3FC003FFFFFFBFC000FFFFFFFFC0003FFFFFFFC00007FFFFFFC000001FFFFFC
00000001FFFC000000001FFC0000000007FC0000000007FC0000000003FC0000000003FC0000000003FC03FC000003FC03FC000003FC03FC000003FC03FE000003FC03FE0000
07FC03FF000007FC01FF80000FFC01FFE0003FF801FFF801FFF800FFFFFFFFF0007FFFFFFFF0003FFFFFFFE0001FFFFFFFC0000FFFFFFF800003FFFFFE000000FFFFF8000|00

too many data in line 744 size is 336 : ignoring 007FFF8007FF01FFFFF00FFF07FFFFF80FFF0FFFFFFE1FFF1FFFFFFF1FFF1FFFFFFF9FFF3FFC01FFFFF07FF0003
FFFE07FC0000FFFC07F800007FFC0FF800003FFC0FF000000FFC0FF000000FFC0FF0000007FC0FF0000003FC0FF0000003FC0FF0000003FC0FF0000003FC0FF8000003FC07FC
000003FC07FE000003FC07FF000003FC03FFC00003FC01FFFC0003FC00FFFFF003FC007FFFFFC3FC003FFFFFFBFC000FFFFFFFFC0003FFFFFFFC00007FFFFFFC000001FFFFFC
00000001FFFC000000001FFC0000000007FC0000000007FC0000000003FC0000000003FC0000000003FC03FC000003FC03FC000003FC03FC000003FC03FE000003FC03FE0000
07FC03FF000007FC01FF80000FFC01FFE0003FF801FFF801FFF800FFFFFFFFF0007FFFFFFFF0003FFFFFFFE0001FFFFFFFC0000FFFFFFF800003FFFFFE000000FFFFF8000|00

too many data in line 785 size is 684 : ignoring 000001FFFFE000000000000FFFFFFC000FC000003FFFFFFF000FC00000FFFFFFFFC00FC00001FFFFFFFFE01FC00
003FFFFFFFFF81FC0000FFFFFFFFFFC1FC0001FFFFC00FFFE1FC0003FFFC0000FFF3FC0007FFE000003FFBFC000FFFC000000FFFFC000FFF00000003FFFC001FFE00000001FF
FC003FFC00000000FFFC003FF8000000007FFC007FF0000000003FFC007FE0000000003FFC00FFC0000000001FFC00FFC0000000001FFC01FF80000000000FFC01FF80000000
000FFC03FF000000000007FC03FF000000000007FC03FE000000000007FC03FE000000000003FC07FE000000000003FC07FC000000000003FC07FC000000000003FC07FC0000
00000003FC07FC000000000003FC0FFC000000000003FC0FF8000001FFFFFFFC0FF8000001FFFFFFFC0FF8000001FFFFFFFC0FF8000001FFFFFFFC0FF8000001FFFFFFFC0FF8
000001FFFFFFFC0FF8000001FFFFFFFC0FF8000001FFFFFFFC0FF8000000000000000FF8000000000000000FF8000000000000000FF8000000000000000FF800000000000000
07FC0000000000000007FC0000000000000007FC0000000000000007FC0000000000000007FE0000000000000003FE0000000000000003FE0000000000000003FF0000000000
000001FF00000000001FF801FF00000000001FF801FF80000000001FF000FFC0000000003FF000FFC0000000003FF0007FE0000000007FE0007FF0000000007FE0003FF80000
0000FFE0003FFC00000001FFC0001FFE00000003FF80000FFF00000007FF800007FF8000000FFF000007FFE000003FFE000003FFFC0001FFFE000001FFFF800FFFFC000000FF
FFFFFFFFF80000003FFFFFFFFFF00000001FFFFFFFFFC000000007FFFFFFFF8000000003FFFFFFFE00000000007FFFFFF800000000001FFFFFC000000|00
too many data in line 906 size is 336 : ignoring 007FFF8007FF01FFFFF00FFF07FFFFF80FFF0FFFFFFE1FFF1FFFFFFF1FFF1FFFFFFF9FFF3FFC01FFFFF07FF0003
FFFE07FC0000FFFC07F800007FFC0FF800003FFC0FF000000FFC0FF000000FFC0FF0000007FC0FF0000003FC0FF0000003FC0FF0000003FC0FF0000003FC0FF8000003FC07FC
000003FC07FE000003FC07FF000003FC03FFC00003FC01FFFC0003FC00FFFFF003FC007FFFFFC3FC003FFFFFFBFC000FFFFFFFFC0003FFFFFFFC00007FFFFFFC000001FFFFFC
00000001FFFC000000001FFC0000000007FC0000000007FC0000000003FC0000000003FC0000000003FC03FC000003FC03FC000003FC03FC000003FC03FE000003FC03FE0000
07FC03FF000007FC01FF80000FFC01FFE0003FF801FFF801FFF800FFFFFFFFF0007FFFFFFFF0003FFFFFFFE0001FFFFFFFC0000FFFFFFF800003FFFFFE000000FFFFF8000|00

I have attached test1.eps and test1.emf

(file #22444, file #22445)

Tatsuro MATSUOKA <tmacchant>
Tue 18 Jan 2011 05:43:50 PM UTC, comment #5: 

Line 34 of _fltk_print_.m is below.


 34     fig2dev_devices = {"pstex", "mf", "emf"};


If "emf" is removed then pstoedit will be used to produce the emf file. This may fix the warning.

Another possibility is that the font being used is the problem. Perhaps using a standard PS font will fix the warning.


demo ("legend", 1)
h = findall (gcf, "-property", "fontname");
set (h, "fontname", "Helvetica")
print test.emf


Does using Helvetica fix the warning?

Ben Abbott <bpabbott>
Group Member
Tue 18 Jan 2011 04:48:27 PM UTC, comment #4: 

BTW, created test1.emf does not have any digit. I attach it.

********************************
C:\usr\tatsu\test\testOctave\fltk_print_test>"C:\Program Files\pstoedit/pstoedit.exe" -f fig test1.eps tmp.fig
pstoedit: version 3.50 / DLL interface 108 (build Aug 10 2009 - release build -
MS VC++ 1300) : Copyright (C) 1993 - 2009 Wolfgang Glunz

C:\usr\tatsu\test\testOctave\fltk_print_test>"C:\Program Files\fig2dev/fig2dev.exe" -L emf tmp.fig test1.emf
fig2dev: tmp01.eps: emf: unsupported picture format
fig2dev: tmp02.eps: emf: unsupported picture format
<snip>
fig2dev: tmp59.eps: emf: unsupported picture format
***************************************

The warning like "fig2dev: tmp01.eps: emf: unsupported picture format" might be origin emf file without characters.

Tatsuro MATSUOKA <tmacchant>
Tue 18 Jan 2011 04:34:02 PM UTC, comment #3: 

Hello

Sorry I have forgotten to report the result.

************************************
octave:6> print -debug test1.emf
pstoedit command: '"C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL'
fig2dev command: '"C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> NUL'
fltk-pipeline: '"C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> NUL > test1.emf'
****************************

I have tested on the cmd prompt

C:\usr\tatsu\test\testOctave\fltk_print_test>type test1.eps | "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> NUL | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> NUL > test1.emf

test.emf is created.

Therefore the concept is right but something is missing on the octave code.

BTW, created test1.emf does not have any digit. I attach it.

(file #22438)

Tatsuro MATSUOKA <tmacchant>
Tue 18 Jan 2011 12:31:56 PM UTC, comment #2: 

The the recent fix for eps output ...

    http://hg.savannah.gnu.org/hgweb/octave/rev/84fa2ba414ee

... has the printing with -demf been fixed as well?

Ben Abbott <bpabbott>
Group Member
Wed 05 Jan 2011 01:04:03 AM UTC, comment #1: 

I've attached a changeset that should fix the problem. Please test and let me know if it works.

(file #22353)

Ben Abbott <bpabbott>
Group Member
Sat 25 Dec 2010 05:57:45 PM UTC, original submission:  

Hello

I cannot print plot in emf form in fltk printing on dev. source.

Thu Dec 23 15:57:40 2010 +0100
changeset 11409 dd539a976451
parent 11408 6154672afa9a

In dbstep trace, I have notices
cmd = "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> /dev/null | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> /dev/null > cos.emf

'/dev/null' does not exist on the native windows. But 'NUL' can be used instead.  I cannot find where I should modify them for windows.

Any suggestions?

*******dbstep trace********
octave:2> dbstop _fltk_print_
ans =  26
octave:3>
octave:3> backend('fltk')
octave:4>
octave:4> fplot('cos', [0 2*pi])
octave:5>
octave:5> print('cos.emf','-demf')
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 26
26:   dos_shell = (ispc () && ! isunix ());
debug>
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 28
28:   figure (opts.figure)
debug>
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 29
29:   drawnow ("expose")
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 30
30:   _fltk_redraw_ ();
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 32
32:   if (! isempty (opts.fig2dev_binary))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 32
32:   if (! isempty (opts.fig2dev_binary))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 34
34:     fig2dev_devices = {"pstex", "mf", "emf"};
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 39
39:   gl2ps_device = {};
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 40
40:   pipeline = {};
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 41
41:   switch (lower (opts.devopt))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 41
41:   switch (lower (opts.devopt))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 41
41:   switch (lower (opts.devopt))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 41
41:   switch (lower (opts.devopt))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 41
41:   switch (lower (opts.devopt))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 41
41:   switch (lower (opts.devopt))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 83
83:     cmd_pstoedit = opts.pstoedit_cmd (opts, "fig");
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 84
84:     cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt);
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 85
85:     if (strcmp (opts.devopt, "pstex"))
debug> cmd_pstoedit, cmd_fig2dev
cmd_pstoedit = "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> /dev/null
cmd_fig2dev = "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> /dev/null
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 85
85:     if (strcmp (opts.devopt, "pstex"))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 99
99:       cmd = sprintf ("%s | %s > %s", cmd_pstoedit, cmd_fig2dev, opts.name);
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 100
100:       gl2ps_device = {"eps"};
debug> cmd
cmd = "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> /dev/null | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> /dev/null > cos.emf
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 101
101:       pipeline = {cmd};
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 146
146:   opts.pipeline = pipeline;
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 148
148:   for n = 1:numel(pipeline)
debug> opts.pipeline
ans =

{
  [1,1] = "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> /dev/null | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> /dev/null > cos.emf
}

debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 149
149:     if (opts.debug)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 149
149:     if (opts.debug)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 152
152:     pid = popen (pipeline{n}, "w");
debug> n
n =  1
debug> pipeline{n}
ans = "C:\Program Files\pstoedit/pstoedit.exe" -f fig 2> /dev/null | "C:\Program Files\fig2dev/fig2dev.exe" -L emf 2> /dev/null > cos.emf
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 153
153:     if (pid < 0)
debug> 指定されたパスが見つかりません。(Path not found)
dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 153
153:     if (pid < 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 157
157:       drawnow (gl2ps_device{n} , sprintf ("%d" , pid));
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 158
158:       waitpid (pid);
debug> gl2ps_device{n}, n
ans = eps
n =  1
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 160
160:       pclose (pid);
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\__fltk_print__.m
at line 164
164: endfunction
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\isfigure.m at line 29
29:   if (nargin == 1)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\isfigure.m at line 29
29:   if (nargin == 1)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\isfigure.m at line 30
30:     retval = (ishandle (h) && strcmp (get (h, "type"), "figure"));
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\isfigure.m at line 35
35: endfunction
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
34
34:   nargs = nargin;
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
36
36:   f = NaN;
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
38
38:   init_new_figure = false;
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
39
39:   if (mod (nargs, 2) == 1)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
39
39:   if (mod (nargs, 2) == 1)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
40
40:     tmp = varargin{1};
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
41
41:     if (ishandle (tmp) && strcmp (get (tmp, "type"), "figure"))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
41
41:     if (ishandle (tmp) && strcmp (get (tmp, "type"), "figure"))
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
42
42:       f = tmp;
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
43
43:       varargin(1) = [];
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
44
44:       nargs--;
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
58
58:   cf = get (0, "currentfigure");
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
59
59:   if (! isempty (cf) && cf != 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
59
59:   if (! isempty (cf) && cf != 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
60
60:     if (isnan (f) || cf != f)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
60
60:     if (isnan (f) || cf != f)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
65
65:   if (rem (nargs, 2) == 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
65
65:   if (rem (nargs, 2) == 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
66
66:     if (isnan (f) || init_new_figure)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
66
66:     if (isnan (f) || init_new_figure)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
66
66:     if (isnan (f) || init_new_figure)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
71
71:     set (0, "currentfigure", f);
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
76
76:   cf = get (0, "currentfigure");
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
77
77:   _add_default_menu_ (cf);
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
79
79:   if (nargout > 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
79
79:   if (nargout > 0)
debug> dbstep
stopped in C:\Programs\OctaveBuild\share\octave\3.3.54+\m\plot\figure.m at line
83
83: endfunction
debug> dbstep
octave:6>
*****dbstep trace end

Tatsuro


Tatsuro MATSUOKA <tmacchant>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #25153:  31976-f.diff added by bpabbott (789B - application/octet-stream - eighth patch)
file #25152:  31976-e.diff added by bpabbott (790B - application/octet-stream - seventh patch)
file #25151:  31976-d.diff added by bpabbott (3KiB - application/octet-stream)
file #25150:  31976-c.diff added by bpabbott (3KiB - application/octet-stream - fifth changeset)
file #25124:  changeset-a.patch added by bpabbott (1KiB - application/octet-stream)
file #25125:  changeset-b.patch added by bpabbott (1KiB - application/octet-stream)
file #25115:  changeset.patch added by bpabbott (1KiB - application/octet-stream - 2nd attempt at "Changeset 1 from Feb 22, 2012")
file #25108:  changeset.patch added by bpabbott (2KiB - application/octet-stream - Changeset 1 from Feb 22, 2012)
file #22446:  test-print.emf added by bpabbott (4KiB - compare manual and octave)
file #22447:  test-bash.emf added by bpabbott (2KiB - compare manual and octave)
file #22448:  test.eps added by bpabbott (7KiB - application/postscript - compare manual and octave)
file #22444:  test1_1.eps added by tmacchant (9KiB - application/postscript)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by matzeri (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Updated the item)
  • -email is unavailable- added by tmacchant (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 21 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-02-24 bpabbott StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2012-02-24 bpabbott Attached File- Added 31976-f.diff, #25153
    2012-02-24 bpabbott Attached File- Added 31976-e.diff, #25152
    2012-02-24 bpabbott Attached File- Added 31976-d.diff, #25151
    2012-02-24 bpabbott Attached File- Added 31976-c.diff, #25150
    2012-02-23 bpabbott Attached File- Added changeset-a.patch, #25124
        Attached File- Added changeset-b.patch, #25125
    2012-02-22 bpabbott Attached File- Added changeset.patch, #25115
    2012-02-22 bpabbott Attached File- Added changeset.patch, #25108
    2012-02-21 bpabbott StatusReady For Test In Progress
    2011-09-27 rik5 SummaryCannot print in emf form in fltk printing (MinGW) Cannot print in emf form in fltk printing (MinGW)
    2011-01-18 bpabbott Attached File- Added test-print.emf, #22446
        Attached File- Added test-bash.emf, #22447
        Attached File- Added test.eps, #22448
    2011-01-18 tmacchant Attached File- Added test1_1.eps, #22444
        Attached File- Added test1.emf, #22445
    2011-01-18 tmacchant Attached File- Added test1.emf, #22438
    2011-01-05 bpabbott Assigned toNone bpabbott
    2011-01-05 bpabbott Attached File- Added changeset.patch, #22353
        StatusNone Ready For Test

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code