print.m: SVG ans size specification for PNG and SVG
Francesco Potorti` <[email protected]> Fri, 21 Sep 2007 13:32:45 +0200
| Newsgroups | gmane.comp.gnu.octave.sources |
|---|---|
| Organization | ISTI-CNR, via Moruzzi 1, I-56124 Pisa, +39-0503153058 |
| Message-ID | <[email protected]> |
This patch, which is alternative to the previously posted one, adds the
SVG type to the capabilities of print.m and additionally allows for a
-Sxsize,ysize option for PNG and SVG terminals.
--- /home/pot/math/octavelib/utils/myprint.m~ 2007-09-21 12:48:05.000000000=
+0200
+++ /home/pot/math/octavelib/utils/myprint.m 2007-09-21 13:30:55.000000000 =
+0200
@@ -69,20 +69,22 @@
## @item cdr
## @itemx corel
## CorelDraw
-## @item hpgl
-## HP plotter language
-## @item fig
-## XFig
## @item dxf
## AutoCAD
+## @item emf
+## Microsoft Enhanced Metafile
+## @item fig
+## XFig
+## @item hpgl
+## HP plotter language
## @item mf
## Metafont
## @item png
## Portable network graphics
## @item pbm
## PBMplus
-## @item emf
-## Microsoft Enhanced Metafile
+## @item svg
+## Scalable vector graphics
## @end table
##
## Other devices are supported by "convert" from ImageMagick. Type
@@ -91,6 +93,9 @@
## 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.
##
+## @itemx -S@@var{xsize},@var{ysize}
+## Plot size in points for PNG and SVG.
+##
## @item -F@var{fontname}
## @itemx -F@var{fontname}:@var{size}
## @itemx -F:@var{size}
@@ -116,6 +121,7 @@ function print (varargin)
force_solid =3D 0; # 0=3Ddefault, -1=3Ddashed, +1=3Dsolid
fontsize =3D "";
font =3D "";
+ size =3D "";
name =3D "";
devopt =3D "";
printer =3D "";
@@ -147,6 +153,8 @@ function print (varargin)
else
font =3D arg(3:length(arg));
endif
+ elseif (length (arg) > 2 && arg(1:2) =3D=3D "-S")
+ size =3D arg(3:length(arg));
elseif (length (arg) >=3D 1 && arg(1) =3D=3D "-")
error ("print: unknown option `%s'", arg);
elseif (length (arg) > 0)
@@ -191,7 +199,7 @@ function print (varargin)
endif
=
## check if we have to use convert
- dev_list =3D {"aifm", "corel", "fig", "png", "pbm", "dxf", "mf", ...
+ dev_list =3D {"aifm", "corel", "fig", "png", "pbm", "dxf", "mf", "svg", =
...
"hpgl", "ps", "ps2", "psc", "psc2", "eps", "eps2", ...
"epsc", "epsc2", "emf", "pstex", "pslatex", ...
"epslatex", "epslatexstandalone"};
@@ -325,11 +333,25 @@ function print (varargin)
##eval (sprintf ("__gnuplot_set__ term %s mono medium", dev));
##endif
=
- new_terminal =3D "png large";
+ if (isempty (size))
+ options =3D " large";
+ else
+ options =3D strcat (" size ", size);
+ endif
+ new_terminal =3D strcat ("png", options);
=
elseif (strcmp (dev, "dxf") || strcmp (dev, "mf") || strcmp (dev, "hpgl"=
))
## AutoCad DXF, METAFONT, HPGL
new_terminal =3D dev;
+
+ elseif (strcmp (dev, "svg"))
+ ## SVG
+ options =3D "";
+ if (! isempty (size))
+ options =3D strcat (" size ", size);
+ endif
+ new_terminal =3D strcat ("svg", options);
+
endif
=
drawnow (new_terminal, name);
-- =
Francesco Potort=EC (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: [email protected]
Web: http://fly.isti.cnr.it/ Key: fly.isti.cnr.it/public.key