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: Thu, 09 Aug 2007 18:47:58 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

Peter Gustafson wrote:
> It seems to work for me.  The last suggestion I have is that the texinfo
> should reflect the -S3x2 format.  It currently specifies a comma.

I suppose a "D'oh" would be appropriate here... Thanks for pointing that
out. Here is a another patch.

Sebastian
--- printold.m  2007-08-08 18:07:17.000000000 +0100
+++ print.m     2007-08-09 18:38:29.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>x<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]