octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: print.m: size support for (e)ps terminals


From: Sebastian Schubert
Subject: Re: print.m: size support for (e)ps terminals
Date: Wed, 08 Aug 2007 19:05:58 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

Hi,

Jonathan Stickel wrote:
> I tried this out in octave-2.9.12.  It doesn't seem to work for me:
> 
> 
> octave:19> print -deps test2.eps -S3,2
> 
> gnuplot> set terminal postscript eps enhanced mono dashed size 3
>          ^
>          line 0: size requires two numbers:  xsize, ysize

Sorry, I didn't know that it is ok to use the arguments without quotes,
so the problem seems to be the ",".  I guess this helps a bit to decide
whether "3x5" or "3,5" (@Peter).  So I added another patch which uses "x".

print -deps test2.eps -S3x2

should work now.

> Also, the curly braces around 'units' in the texinfo help causes problems.

Sorry again.  Fixed.

Sebastian

--- printold.m  2007-08-08 18:07:17.000000000 +0100
+++ print.m     2007-08-08 18:06:49.000000000 +0100
@@ -91,6 +91,11 @@
 ##   If the device is omitted, it is inferred from the file extension,
 ##   or if there is no filename it is sent to the printer as postscript.
 ##
+## @item address@hidden
+##   Sets the size '<XX><unit>,<YY><unit>' of the plot for the (e)ps*
+##   devices in inches (default) or in 'cm'.  gnuplot 4.2 or higher is
+##   needed.
+## 
 ## @item address@hidden
 ## @itemx address@hidden:@var{size}
 ## @itemx -F:@var{size}
@@ -115,6 +120,8 @@
   use_color = 0; # 0=default, -1=mono, +1=color
   force_solid = 0; # 0=default, -1=dashed, +1=solid
   fontsize = "";
+  plotsizex = "";
+  plotsizey = "";
   font = "";
   name = "";
   devopt = "";
@@ -147,6 +154,9 @@
        else
          font = arg(3:length(arg));
        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-S")
+       plotsizex = arg(3:index(arg,"x")-1);
+       plotsizey = arg(index(arg,"x")+1:length(arg));
       elseif (length (arg) >= 1 && arg(1) == "-")
        error ("print: unknown option `%s'", arg);
       elseif (length (arg) > 0)
@@ -250,6 +260,14 @@
       endif
     endif
 
+    if (! strcmp (plotsizex, ""))
+      if (compare_versions (__gnuplot_version__, "4.2", ">="))
+       options = strcat (options, "size ", plotsizex,",",plotsizey," ");
+      else
+       error ("print: size option needs gnuplot 4.2 or higher");
+      endif
+    endif
+
     if (! isempty (font))
       options = strcat (options, "\"", font, "\" ");
     endif
@@ -259,7 +277,13 @@
     
     new_terminal = strcat (termn, " ", options);
     
-  elseif (strcmp (dev, "aifm") || strcmp (dev, "corel"))
+  else
+
+    if (! strcmp (plotsizex, ""))
+      error ("print: size option only works with (e)ps* device");
+    endif
+    
+    if (strcmp (dev, "aifm") || strcmp (dev, "corel"))
     ## Adobe Illustrator, CorelDraw
     if (use_color >= 0)
       options = " color";
@@ -331,6 +355,7 @@
     ## AutoCad DXF, METAFONT, HPGL
     new_terminal = dev;
   endif
+  endif
 
   drawnow (new_terminal, name);
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]