Index: kit/CHANGELOG
diff -u kit/CHANGELOG:1.9 kit/CHANGELOG:removed
--- kit/CHANGELOG:1.9	Sat Sep  5 00:11:21 1998
+++ kit/CHANGELOG	Mon Nov  8 05:10:03 1999
@@ -1,51 +0,0 @@
-CHANGELOG for magicpoint
-$Id: CHANGELOG,v 1.9 1998/09/04 15:11:21 onoe Exp $
-
-Fri Sep  5 1998  onoe@sm.sony.co.jp
-	* handle key inputs from invoked terminal as pressed on Xserver,
-	  even if the Xserver is running on a remote host.
-
-Mon Aug 26 1998  itojun@iijlab.net
-	* new copyright. (BSDish copyright without clause 3)
-
-Mon Aug 25 1998  itojun@iijlab.net
-	* print.c: better x11/freetype/vflib -> postscript font mapping.
-
-Mon Aug 23 1998  kato@wide.ad.jp
-	* embedded image support (added mgpembed.pl and embed.c)
-
-Mon Aug 22 1998  itojun@iijlab.net
-	* added contrib/xmindpath, MindPath PocketPoint user-level driver.
-
-Fri Jul 10 11:57:59 JST 1998  itojun@iijlab.net
-	* cache gs-generated image file.
-	  Suggested by: luigi@FreeBSD.org
-
-Mon Jul  6 11:38:32 JST 1998  itojun@iijlab.net
-	* capable of handling GB2312 and KSC5601 encoding.
-	  they must be encoded by using iso-2022 like escape sequences.
-	  EUC-cn or EUC-kr does not work.
-	* -x option is added.
-
-Thu Jul  2 18:04:16 JST 1998  itojun@iijlab.net
-	* eliminate gsview.
-	* revamp "xfont" directive. (see SYNTAX for detail)
-
-Thu Jun 25 13:10:28 JST 1998  itojun@iijlab.net
-	* print.c: color postscript support by "mgp2ps -c".
-
-changes between 1.02a and 1.03a:
-	* To allow color name that has space inbetween ("dark blue"), 
-	  color name after directives SHOULD come with doublequote.
-	  Therefore,
-		%fore blue
-	  should be
-		%fore "blue"
-	  At this moment, doublequote can be ommitted for backward
-	  compatibility.  We may require to have doublequote in the future.
-	  Font names and other string parameter obeys the same rule.
-	* %image is now capable of rendering encapsulated postscript files
-	  (*.eps).
-		%image foo.eps
-	  should work fine.
-	  By using -X option, you can specify device name for ghostscript.
Index: kit/ctlwords.pl
diff -u kit/ctlwords.pl:1.2 kit/ctlwords.pl:removed
--- kit/ctlwords.pl:1.2	Sat Sep  5 06:05:08 1998
+++ kit/ctlwords.pl	Mon Nov  8 05:10:04 1999
@@ -1,12 +0,0 @@
-#! /usr/bin/perl
-$counter = 0;	# 0 origin
-print "/* generated by ctlwords.awk. do not edit by hand. */\n";
-
-while (<>) {
-	next if (!/^\/\*CTL\*\//);
-	next if ($_ !~ /(CTL_[A-Z0-9]+)/);
-
-	$word = $1;
-	print "#define $word\t$counter\n";
-	$counter++;
-}
Index: kit/draw.c
diff -u kit/draw.c:1.157 kit/draw.c:1.158
--- kit/draw.c:1.157	Fri Sep 10 16:13:51 1999
+++ kit/draw.c	Sun Nov  7 02:28:42 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.157 1999/09/10 07:13:51 itojun Exp $
+ * $Id: draw.c,v 1.158 1999/11/06 17:28:42 nishida Exp $
  */
 
 #include "mgp.h"
@@ -2709,6 +2709,8 @@
 	} else
 		yzoomrate = 100;
 #else
+	if (!ximagesize) ximagesize = 100;
+	if (!yimagesize) yimagesize = 100;
 	xzoomrate = ximagesize;
 	yzoomrate = yimagesize;
 	image_zoomratio(state, &xzoomrate, &yzoomrate, zoomflag, width, height);
Index: kit/mgp.c
diff -u kit/mgp.c:1.106 kit/mgp.c:1.107
--- kit/mgp.c:1.106	Fri Sep 10 16:13:46 1999
+++ kit/mgp.c	Sun Nov  7 02:14:55 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.c,v 1.106 1999/09/10 07:13:46 itojun Exp $
+ * $Id: mgp.c,v 1.107 1999/11/06 17:14:55 itojun Exp $
  */
 
 static char *mgp_version = "1.06a (990728)";
@@ -87,6 +87,7 @@
 static char *dumpdir = NULL;
 
 char *gsdevice = DEFAULT_GSDEV;
+char *htmlimage;
 
 static time_t srctimestamp;
 
@@ -215,7 +216,7 @@
 		mgpwdir = p;
 	}
 
-#define ACCEPTOPTS	"BdvVob:c:eg:f:hlGp:qt:Q:PST:D:CORw:X:x:nF:"
+#define ACCEPTOPTS	"BdvVob:c:eg:f:hlGp:qt:Q:PST:D:CORw:X:x:nF:E:"
 	while ((opt = getopt(argc, argv, ACCEPTOPTS)) != -1) {
 #undef ACCEPTOPTS
 		switch (opt) {
@@ -352,6 +353,10 @@
 				cache_value = atoi(p2);
 			break;
 
+		case 'E':
+			htmlimage = optarg;
+			break;
+
 		case 'h':
 		default:
 			mgp_usage(progname);
@@ -434,6 +439,22 @@
 	FILE *txt;
 	int page;
 	char *childdebug;
+	char convdb[][3][16] = {{ "jpg", "cjpeg", "djpeg" },
+				{ "png", "pnmtopng", "pngtopnm" },
+				{ NULL, NULL, NULL }};
+	int inum = 0;
+
+	/* check image type */
+	if (htmlimage) {
+		for (inum = 0; *convdb[inum] != NULL; inum++) {
+			if (strcmp(*convdb[inum], htmlimage) == 0)
+				break;
+		}
+		if (*convdb[inum] == NULL) {
+			fprintf(stderr, "unknwon image type %s.\n", htmlimage);
+			cleanup(-1);
+		}
+	}
 
 	/* check if we can write to the directory */
 	sprintf(buf, "%s/%ld", dumpdir, (long)time((time_t *)NULL));
@@ -455,19 +476,22 @@
 		state_goto(&state, page, 0);
 		draw_page(&state, NULL);
 
+
+#define EXT convdb[inum][0]
+
 		/*
-		 * dump out jpg image
+		 * dump out image
 		 */
 		fprintf(stderr, "(full image)");
 		sprintf(buf, "xwintoppm -silent -name MagicPoint | "
-			"cjpeg %s > %s/mgp%05d.jpg",
-			childdebug, dumpdir, page);
+			"%s %s > %s/mgp%05d.%s",
+			convdb[inum][1], childdebug, dumpdir, page, EXT);
 		system(buf);	/*XXX security hole*/
 		fprintf(stderr, "(thumbnail)");
-		sprintf(buf, "djpeg %s/mgp%05d.jpg | "
-			"pnmscale 0.25 | cjpeg %s > %s/mgp%05d.idx.jpg",
-			dumpdir, page, childdebug,
-			dumpdir, page);
+		sprintf(buf, "%s %s/mgp%05d.%s | "
+			"pnmscale 0.25 | %s %s > %s/mgp%05d.idx.%s",
+			convdb[inum][2], dumpdir, page, EXT, convdb[inum][1], childdebug,
+			dumpdir, page, EXT);
 		system(buf);	/*XXX security hole*/
 
 		/*
@@ -502,13 +526,13 @@
 		fprintf(html, "<BR>Page %d: %s<BR>\n", page, page_title(page));
 		fprintf(html, "<HR>\n");
 		if (window_width < 0 || window_height < 0) {
-			fprintf(html, "<IMG SRC=\"mgp%05d.jpg\" "
+			fprintf(html, "<IMG SRC=\"mgp%05d.%s\" "
 				"ALT=\"Page %d\">\n",
-				page, page);
+				page, EXT, page);
 		} else {
-			fprintf(html, "<IMG SRC=\"mgp%05d.jpg\" "
+			fprintf(html, "<IMG SRC=\"mgp%05d.%s\" "
 				"WIDTH=%d HEIGHT=%d ALT=\"Page %d\"><BR>\n",
-				page, window_width, window_height,
+				page, EXT, window_width, window_height,
 				page);
 		}
 		fprintf(html, "<HR>Generated by "
@@ -567,15 +591,15 @@
 	for (page = start_page; page <= maxpage; page++) {
 		if (window_width < 0 || window_height < 0) {
 			fprintf(html, "<A HREF=\"mgp%05d.html\">"
-				"<IMG SRC=\"mgp%05d.idx.jpg\" "
+				"<IMG SRC=\"mgp%05d.idx.%s\" "
 				"ALT=\"Page %d\"></A>\n",
-				page, page, page);
+				page, page, EXT, page);
 		} else {
 			fprintf(html, "<A HREF=\"mgp%05d.html\">"
-				"<IMG SRC=\"mgp%05d.idx.jpg\" "
+				"<IMG SRC=\"mgp%05d.idx.%s\" "
 				"WIDTH=%d HEIGHT=%d "
 				"ALT=\"Page %d\"></A>\n",
-				page, page, window_width / 4,
+				page, page, EXT, window_width / 4,
 				window_height / 4, page);
 		}
 	}
Index: kit/mgp.h
diff -u kit/mgp.h:1.112 kit/mgp.h:1.113
--- kit/mgp.h:1.112	Mon Sep 13 13:23:07 1999
+++ kit/mgp.h	Sun Nov  7 02:14:57 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.h,v 1.112 1999/09/13 04:23:07 itojun Exp $
+ * $Id: mgp.h,v 1.113 1999/11/06 17:14:57 itojun Exp $
  */
 
 #include <stdio.h>
@@ -603,6 +603,7 @@
 #endif
 extern char *back_clname;
 extern char *gsdevice;
+extern char *htmlimage;
 
 extern char *mgpwdir;
 extern char mgpwdirname[];
Index: kit/print.c
diff -u kit/print.c:1.83 kit/print.c:1.85
--- kit/print.c:1.83	Sun Oct 31 03:41:36 1999
+++ kit/print.c	Sun Nov  7 02:11:33 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: print.c,v 1.83 1999/10/30 18:41:36 nishida Exp $
+ * $Id: print.c,v 1.85 1999/11/06 17:11:33 nishida Exp $
  */
 /*
  * Paper size selection code is based on psutil.c by Angus J. C. Duggan
@@ -482,7 +482,7 @@
 	fprintf(fp, "} bind def\n");
 
 	/* show with line wrapping */
-	fprintf(fp, "/initcharsize { /charsize 0 def /imgsize 0 def } def\n");
+	fprintf(fp, "/initcharsize { /charsize 0 def /imgsize 0 def resety} def\n");
 	fprintf(fp, "initcharsize\n");
 	fprintf(fp, "/setcharsize {\n");
 	fprintf(fp, "  dup charsize gt { dup /charsize exch def } if pop\n");
@@ -758,8 +758,12 @@
 	nimagepool = 0;
 	ntextpool = 0;
 
-	if (curlinenum == 0)
+	if (curlinenum == 0){
 		print_pagebackground();
+#if 0
+		fprintf(fp, "initcharsize %d setcharsize\n", char_size[0]);
+#endif
+	}
 }
 
 static void
@@ -794,15 +798,17 @@
 	/*
 	 * if we have nothing on the line, skip it
 	 */
-	if (!ntextpool && !nimagepool)
+	if (!ntextpool && !nimagepool){
+		fprintf(fp, "initcharsize %d setcharsize\n", char_size[0]);
 		goto done;
+	}
 
 	/*
 	 * push strings in reverse order.
 	 */
 	fprintf(fp, "initcharsize\n");
 	fprintf(fp, "0 %% sentinel for text width computation\n");
-	fprintf(fp, "gsave newpath 0 0 moveto resety\n");
+	fprintf(fp, "gsave newpath 0 0 moveto\n");
 
 	for (i = ntextpool - 1; 0 <= i; i--) {
 		if (!textpool[i].text) {
Index: kit/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/mgp-old1.gif
Index: kit/sample/mgp-old2.gif
Index: kit/sample/mgp-old3.gif
Index: kit/sample/mgp1.gif
Index: kit/sample/mgp2.gif
Index: kit/sample/mgp3.gif
Index: kit/sample/v6header.gif
