octave-maintainers
[Top][All Lists]
Advanced

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

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


From: Sebastian Schubert
Subject: print.m: size support for (e)ps terminals
Date: Mon, 06 Aug 2007 19:19:26 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

Hi,

after writing the epslatexstandalone support, someone proposed to also
support the size option.  Find the patch attached. I created it ignoring
changed whitespace due to changed alignment of code to make the actual
changes more visible. The last part between else and endif has to be
indented probably.

It only supports the ps like terminals as only they have a consistent
way of changing the size AFAICS.  The way of changing the size was
different in gnuplot 4.0 (set size before changing the terminal), so I
think it is ok for now to only support gnuplot 4.2.

What do you think?

Sebastian
--- printold.m  2007-08-05 21:48:24.000000000 +0100
+++ print.m     2007-08-06 12:32:47.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,7 @@
   use_color = 0; # 0=default, -1=mono, +1=color
   force_solid = 0; # 0=default, -1=dashed, +1=solid
   fontsize = "";
+  plotsize = "";
   font = "";
   name = "";
   devopt = "";
@@ -147,6 +153,8 @@
        else
          font = arg(3:length(arg));
        endif
+      elseif (length (arg) > 2 && arg(1:2) == "-S")
+       plotsize = arg(3:length(arg));
       elseif (length (arg) >= 1 && arg(1) == "-")
        error ("print: unknown option `%s'", arg);
       elseif (length (arg) > 0)
@@ -250,6 +258,14 @@
       endif
     endif
 
+    if (! strcmp (plotsize, ""))
+      if (compare_versions (__gnuplot_version__, "4.2", ">="))
+       options = strcat (options, "size ", plotsize);
+      else
+       error ("print: size option needs gnuplot 4.2 or higher");
+      endif
+    endif
+
     if (! isempty (font))
       options = strcat (options, "\"", font, "\" ");
     endif
@@ -259,7 +275,13 @@
     
     new_terminal = strcat (termn, " ", options);
     
-  elseif (strcmp (dev, "aifm") || strcmp (dev, "corel"))
+  else
+
+    if (! strcmp (plotsize, ""))
+      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 +353,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]