Index: term/svg.trm
===================================================================
RCS file: /cvsroot/gnuplot/gnuplot/term/svg.trm,v
retrieving revision 1.177
diff -u -r1.177 svg.trm
--- term/svg.trm 9 Aug 2016 11:50:57 -0000 1.177
+++ term/svg.trm 19 Aug 2016 03:36:51 -0000
@@ -132,6 +132,8 @@
static char *SVG_scriptdir = NULL;
static TBOOLEAN SVG_mouseable = FALSE;
static TBOOLEAN SVG_standalone = FALSE;
+static TBOOLEAN SVG_domterm = FALSE;
+static TBOOLEAN SVG_emit_doctype = TRUE;
static TBOOLEAN SVG_groupFilledIsOpen = FALSE; /* open pm3d group flag*/
static TBOOLEAN SVG_inTextBox = FALSE;
@@ -200,6 +202,7 @@
static void SVG_local_reset __PROTO((void));
static void SVG_DefineFillPattern __PROTO((int fillpat));
static void SVG_MoveForced __PROTO((unsigned int x, unsigned int y));
+static void SVG_write_preamble __PROTO ((void));
/* Points to source of requested embedded font */
static char *SVG_embedded_font = NULL;
@@ -544,6 +547,19 @@
continue;
}
+ if (almost_equals(c_token, "nodoc$type")) {
+ c_token++;
+ SVG_emit_doctype = FALSE;
+ continue;
+ }
+
+ if (almost_equals(c_token, "domterm")) {
+ c_token++;
+ SVG_emit_doctype = FALSE;
+ SVG_domterm = TRUE;
+ continue;
+ }
+
if (equals(c_token, "name")) {
c_token++;
SVG_name = try_to_get_string();
@@ -715,6 +731,16 @@
"standalone ");
}
+ if (SVG_domterm) {
+ sprintf(term_options + strlen(term_options),
+ "domterm ");
+ }
+
+ if (! SVG_emit_doctype) {
+ sprintf(term_options + strlen(term_options),
+ "nodoctype ");
+ }
+
if (SVG_name) {
sprintf(term_options + strlen(term_options),
"name \"%s\" ", SVG_name);
@@ -774,10 +800,6 @@
TERM_PUBLIC void
SVG_init ()
{
- int len;
- double stroke_width;
- char *svg_encoding = "";
-
/* setup pens*/
SVG_pens[0].width = SVG_LineWidth;
strcpy (SVG_pens[0].color, "white"); /* should really be background */
@@ -834,7 +856,42 @@
term->h_tic = term->v_char / 2;
term->v_tic = term->v_char / 2;
-/* write file header*/
+ if (multiplot)
+ SVG_write_preamble();
+}
+
+/*------------------------------------------------------------------------------------------------------------------------------------
+ SVG_graphics
+------------------------------------------------------------------------------------------------------------------------------------*/
+TERM_PUBLIC void
+SVG_graphics ()
+{
+ if (! multiplot)
+ SVG_write_preamble();
+
+ /* EAM 5-May-2004 We must force a new group with fill:none in order for */
+ /* multiple plots per page to work. Otherwise new plots are black-filled */
+ SVG_GroupOpen();
+
+ SVG_fillPattern = -1;
+ SVG_fillPatternIndex = 0;
+ SVG_groupFilledIsOpen = FALSE;
+ SVG_color_mode = TC_DEFAULT;
+ SVG_pathIsOpen = FALSE;
+
+/* reset position*/
+
+ SVG_xLast = SVG_yLast = UINT_MAX;
+}
+
+static void
+SVG_write_preamble ()
+{
+ int len;
+ double stroke_width;
+ char *svg_encoding = "";
+
+ /* write file header*/
switch (encoding) {
case S_ENC_ISO8859_1: svg_encoding = "encoding=\"iso-8859-1\" "; break;
@@ -856,11 +913,15 @@
break;
}
- fprintf (gpoutfile,
- "\n"
- "\n"
- "\n\n", gpoutfile);
+ if (multiplot)
+ fputs("\n\n", gpoutfile);
}
/*------------------------------------------------------------------------------------------------------------------------------------
@@ -2169,7 +2217,7 @@
SVG_options, SVG_init, SVG_reset, SVG_text, null_scale, SVG_graphics,
SVG_move, SVG_vector, SVG_linetype, SVG_put_text, SVG_text_angle,
SVG_justify_text, SVG_point, do_arrow, SVG_set_font, do_pointsize,
- TERM_CAN_MULTIPLOT | TERM_CAN_DASH | TERM_ALPHA_CHANNEL|TERM_LINEWIDTH,
+ TERM_CAN_DASH | TERM_ALPHA_CHANNEL|TERM_LINEWIDTH,
0 /* suspend */, 0 /* resume */ , SVG_fillbox, SVG_linewidth
#ifdef USE_MOUSE
, 0, 0, 0, 0, 0 /* no mouse support for svg */
@@ -2222,6 +2270,8 @@
" {fontfile }",
" {rounded|butt|square} {solid|dashed} {linewidth }",
" {background }",
+" {nodoctype}",
+" {domterm}",
"",
" where and are the size of the SVG plot to generate,",
" `dynamic` allows a svg-viewer to resize plot, whereas the default",
@@ -2263,6 +2313,10 @@
" or may contain the records necessary to create a hypertext reference to",
" the desired font. Gnuplot will look for the requested file using the",
" directory list in the GNUPLOT_FONTPATH environmental variable.",
-" NB: You must embed an svg font, not a TrueType or PostScript font."
+" NB: You must embed an svg font, not a TrueType or PostScript font.",
+"",
+" The `nodoctype` options skips the and headers.",
+" The `domterm` prepends escape sequences to display the output inline",
+" on a DomTerm terminal emulator. See http://domterm.org ."
END_HELP(svg)
#endif