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 Jan  1 05:10:01 2001
@@ -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 Jan  1 05:10:01 2001
@@ -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.177 kit/draw.c:1.179
--- kit/draw.c:1.177	Tue Dec  5 00:55:59 2000
+++ kit/draw.c	Tue Dec 26 20:54:17 2000
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.177 2000/12/04 15:55:59 nishida Exp $
+ * $Id: draw.c,v 1.179 2000/12/26 11:54:17 nishida Exp $
  */
 
 #include "mgp.h"
@@ -129,7 +129,6 @@
 static void regist_background_pixmap __P((XImageInfo *, Image *));
 
 #define CHECK_CACHE {if (caching){caching = -1; return;}}
-#define MINIMUM_ASCENT 1
 
 static int
 ispsfilename(p0)
@@ -580,6 +579,7 @@
 				cp->ctm_ximagesize, cp->ctm_yimagesize, 0,
 				cp->ctm_zoomflag, 0);
 		}
+		state->brankline = 0;
 	    }
 		break;
 
@@ -681,7 +681,7 @@
 
 	case CTL_LINEEND:
 		/* blank lines */
-		if (state->maxascent + state->maxdescent < MINIMUM_ASCENT) {	/*XXX*/
+		if (state->brankline) {	/*XXX*/
 			state->maxascent = char_size[caching];
 			state->maxdescent = VERT_GAP(char_size[caching]);
 		}
@@ -820,6 +820,7 @@
 	state->maxascent = 0;
 	state->maxdescent = 0;
 	state->linewidth = 0;
+	state->brankline = 1;
 	while ((obj = state->obj))
 		obj_free(state, obj);
 }
@@ -876,10 +877,15 @@
 	}
 
 	state->ypos += state->maxascent;
-	if (VERT_GAP(state->maxascent) < state->maxdescent)
+
+	/* 
+  	 * we should ignore height of images to calculate line gap.
+	 * suggested by Toru Terao 
+	 */ 
+	if (VERT_GAP(char_size[caching]) < state->maxdescent)
 		state->ypos += state->maxdescent;
 	else
-		state->ypos += VERT_GAP(state->maxascent);
+		state->ypos += VERT_GAP(char_size[caching]);
 	state->ypos += 2;
 }
 
@@ -1120,6 +1126,8 @@
 
 	while (len) {
 		code = charset16 ? p[0] * 256 + p[1] : p[0];
+		if (code != ' ') 
+			state->brankline = 0; /* This isn't brankline */
 
 #if 0
 		if (code == ' ') {
@@ -3039,6 +3047,7 @@
 	}
 
 	cp = NULL;
+	state->brankline = 0;
 }
 
 static void
@@ -3083,11 +3092,7 @@
 	state->ypos += width + swidth + VERT_GAP(char_size[caching]) / 2;
 	if (state->maxascent < width + swidth)
 		state->maxascent = width + swidth;
-
-	/* state->maxascent shouldn't be less than MINIMUM_ASCENT,
-	   otherwise mgp regards this line as blank line. */
-	if (state->maxascent < MINIMUM_ASCENT)
-		state->maxascent = MINIMUM_ASCENT;
+	state->brankline = 0;
 }
 
 static void
Index: kit/mgp.h
diff -u kit/mgp.h:1.123 kit/mgp.h:1.124
--- kit/mgp.h:1.123	Mon Dec  4 18:21:27 2000
+++ kit/mgp.h	Tue Dec 26 15:20:05 2000
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.h,v 1.123 2000/12/04 09:21:27 nishida Exp $
+ * $Id: mgp.h,v 1.124 2000/12/26 06:20:05 nishida Exp $
  */
 
 #include <stdio.h>
@@ -386,6 +386,7 @@
 	int maxascent;
 	int maxdescent;
 	u_int linewidth;
+	u_int brankline;
 	struct ctrl *xfont;
 	struct render_object *obj, *objlast;
 };
Index: kit/mgp.man
diff -u kit/mgp.man:1.56 kit/mgp.man:1.57
--- kit/mgp.man:1.56	Sat Aug 28 03:48:34 1999
+++ kit/mgp.man	Tue Dec 26 15:20:05 2000
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\" 
-.\"	$Id: mgp.man,v 1.56 1999/08/27 18:48:34 itojun Exp $
+.\"	$Id: mgp.man,v 1.57 2000/12/26 06:20:05 nishida Exp $
 .\"
 .Dd November 1997
 .Dt MGP 1
@@ -46,6 +46,7 @@
 .Op Fl w Ar wdir
 .Op Fl x Ar engine
 .Op Fl D Ar htmldir
+.Op Fl E Ar htmlimage
 .Op Fl F Ar mode,effect,value
 .Op Fl Q Ar quality
 .Op Fl T Ar timestampfile
@@ -183,8 +184,11 @@
 .Li jpeg
 package
 .Pc .
+.It Fl E Ar htmlimage
+Specifies html image type. Now "jpg" and "png" are supported.
+default value is "jpg". It works when -D option is set.
 .It Fl F Ar mode,effect,value
-specifies forward page cache options.
+Specifies forward page cache options.
 .Ar Mode ,
 .Ar effect
 and
@@ -379,7 +383,7 @@
 .Xr mgpembed 1
 .\"
 .Sh AUTHOR CONTACT
-Yoshifumi Nishida <nishida@sfc.wide.ad.jp>
+Yoshifumi Nishida <nishida@csl.sony.co.jp>
 .\"
 .Sh CONTRIBUTION
 Jun-ichiro Hagino <itojun@itojun.org>, Akira Kato <kato@wide.ad.jp>,
Index: kit/print.c
diff -u kit/print.c:1.88 kit/print.c:1.90
--- kit/print.c:1.88	Mon Aug  7 14:50:28 2000
+++ kit/print.c	Wed Dec 27 16:47:51 2000
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: print.c,v 1.88 2000/08/07 05:50:28 nishida Exp $
+ * $Id: print.c,v 1.90 2000/12/27 07:47:51 nishida Exp $
  */
 /*
  * Paper size selection code is based on psutil.c by Angus J. C. Duggan
@@ -64,7 +64,7 @@
 	int xsiz;
 	int ysiz;
 	int eps;
-        int target_text;    /* by A. Ito */
+	int target_text;    /* by A. Ito */
 } imagepool[256];		/*enough?*/
 static int nimagepool = 0;
 static struct textpool {
@@ -753,16 +753,17 @@
 		back = cp->ctl_value;
 		break;
 
-/* MARK and AGAIN processing by A.Ito, 14 Jul. 2000 */
+	/* 
+     * MARK and AGAIN processing by A.Ito, 14 Jul. 2000 
+     */
 	case CTL_MARK:
-                fprintf(fp,"/markx xpos def /marky ypos def\n");
+		fprintf(fp,"/markx xpos def /marky ypos def\n");
 		break;
 
 	case CTL_AGAIN:
-                fprintf(fp,"markx marky moveto /xpos markx def /ypos marky def\n");
+		fprintf(fp,"markx marky moveto /xpos markx def /ypos marky def\n");
 		break;
 
-
 	default:
 		break;
 	}
@@ -906,7 +907,7 @@
 				fprintf(fp, "%d 0 rmoveto\n", textpool[i].xsiz);
 			}
 		}
-		fprintf(fp, "/xpos%d currentpoint pop def\n",i);
+		fprintf(fp, "/xpos%d currentpoint pop def\n", i);
 	}
 
 	ntextpool = 0;
@@ -918,6 +919,7 @@
 		if (mgp_flag & FL_VERBOSE)
 			fprintf(fp, "%% emit the content of imagepool\n");
 		cp1 = imagepool[i].image;
+#if 0
 		if (!cp1) {
 		        fprintf(fp, "/xpos xpos%d def xpos ypos moveto\n",
 			        imagepool[i].target_text);
@@ -927,6 +929,17 @@
 			cp1->ctm_ximagesize, cp1->ctm_yimagesize, 0,
 			cp1->ctm_zoomflag);
 		fprintf(fp, "%d setimgsize\n", imagepool[i].ysiz);	/*XXX*/
+#else
+		if (cp1) {
+			image_load_print(cp1->ctm_fname, cp1->ctm_numcolor,
+				cp1->ctm_ximagesize, cp1->ctm_yimagesize, 0,
+				cp1->ctm_zoomflag);
+			fprintf(fp, "%d setimgsize\n", imagepool[i].ysiz);	/*XXX*/
+		}
+        fprintf(fp, "/xpos xpos%d def xpos ypos moveto\n",
+	        imagepool[i].target_text);
+#endif
+
 	}
 	nimagepool = 0;
     }
@@ -1321,50 +1334,39 @@
 	char *epsname;
 	Image *myimage;
 	float xzoom, yzoom;
+	int x1, y1, x2, y2, width, height, swidth, sheight;
 	struct render_state state;
-
-	if ((epsname = checkeps(cp->ctm_fname))) {
-		int x1, y1, x2, y2, width, height, swidth, sheight, xim, yim;
 
-		if (ps_boundingbox(epsname, &x1, &y1, &x2, &y2) < 0)
-			goto noneps;
+	if ((epsname = checkeps(cp->ctm_fname)) &&  
+			(ps_boundingbox(epsname, &x1, &y1, &x2, &y2) < 0)) {
 
 		width = x2 - x1;
 		height = y2 - y1;
-		xim = (!cp->ctm_ximagesize ? 100 : cp->ctm_ximagesize);
-		yim = (!cp->ctm_yimagesize ? 100 : cp->ctm_yimagesize);
-
-#if 0
-		switch (cp->ctm_zoomflag) {
-		case 0:	/* relative to screen size */
-			swidth = window_width * xim / 100;
-			sheight = window_height * yim / 100;
-			break;
-		case 1:	/* relative to the loaded image */
-			swidth = width * xim / 100;
-			sheight = height * yim / 100;
-			break;
-		case 2:	/* relative to screen pixels: don't know how to handle */
-			swidth = width;
-			sheight = height;
-			break;
+	} else {
+		myimage = loadImage(cp->ctm_fname, mgp_flag & FL_VERBOSE);
+		if (!myimage) {
+			fprintf(stderr, "failed to open %s\n", cp->ctm_fname);
+			exit(1);
 		}
-#else
-		xzoom = (float) xim;
-		yzoom = (float) yim;
+		width = myimage->width;
+		height = myimage->height;
+		freeImage(myimage);
+	}
+		xzoom = (!cp->ctm_ximagesize ? 100 : cp->ctm_ximagesize);
+		yzoom = (!cp->ctm_yimagesize ? 100 : cp->ctm_yimagesize);
+
 		state.width = window_width;
 		state.height = window_height;
 		image_zoomratio(&state, &xzoom, &yzoom, cp->ctm_zoomflag,
 			width, height);
 		swidth = (int) width * xzoom / 100;
 		sheight = (int) height * yzoom / 100;
-#endif
+
 		pool->xsiz = swidth;
 		pool->ysiz = sheight;
 		pool->xoffset = linewidth;
 		pool->image = cp;
 		return;
-	}
 
 noneps:
 	myimage = loadImage(cp->ctm_fname, mgp_flag & FL_VERBOSE);
@@ -1388,7 +1390,7 @@
 	int backflag;
 	int zoomflag;
 {
-	Image *myimage;
+	Image *myimage, *image;
 	Pixmap mypixmap;
 	XImageInfo *ximageinfo;
 	XImage	*print_image;
@@ -1452,6 +1454,11 @@
 	state.height = window_height;
 	image_zoomratio(&state, &xzoomrate, &yzoomrate, zoomflag,
 		width, height);
+	image = myimage;
+	myimage = zoom(image, xzoomrate, yzoomrate, verbose);
+	freeImage(image);
+	width = myimage->width;
+	height = myimage->height;
 #endif
 
 	if (! (ximageinfo= imageToXImage(display, screen, visual, depth,
@@ -1473,10 +1480,10 @@
 		xpos = 0;
 		break;
 	case AL_CENTER:
-		xpos = (window_width - width * xzoomrate /100) / 2;
+		xpos = (window_width - width) / 2;
 		break;
 	case AL_RIGHT:
-		xpos = window_width - width * xzoomrate /100;
+		xpos = window_width - width;
 		break;
 	}
 
@@ -1488,11 +1495,8 @@
 					AllPlanes, ZPixmap);
 
 	fprintf(fp, "gsave\n");
-/*
-	fprintf(fp, "%d ypos %d sub translate\n",
-		xpos + paper_xmargin, print_height);
-*/
-/* by A. Ito */
+
+	/* fixed by A.Ito */
 	fprintf(fp, "xpos ypos %d sub translate\n",
 		print_height); 
 	fprintf(fp, "%d %d scale\n", print_width, print_height);
Index: kit/image/gif.h
diff -u kit/image/gif.h:1.2 kit/image/gif.h:removed
--- kit/image/gif.h:1.2	Mon Dec 28 17:23:03 1998
+++ kit/image/gif.h	Mon Jan  1 05:10:02 2001
@@ -1,72 +0,0 @@
-/* gif.h:
- *
- * gifin.h
- * kirk johnson
- * november 1989
- * external interface to gifin.c
- *
- * Copyright 1989 Kirk L. Johnson (see the included file
- * "kljcpyrght.h" for complete copyright information)
- */
-
-/*
- * gifin return codes
- */
-#define GIFIN_SUCCESS       0   /* success */
-#define GIFIN_DONE          1   /* no more images */
-
-#define GIFIN_ERR_BAD_SD   -1   /* bad screen descriptor */
-#define GIFIN_ERR_BAD_SEP  -2   /* bad image separator */
-#define GIFIN_ERR_BAD_SIG  -3   /* bad signature */
-#define GIFIN_ERR_EOD      -4   /* unexpected end of raster data */
-#define GIFIN_ERR_EOF      -5   /* unexpected end of input stream */
-#define GIFIN_ERR_FAO      -6   /* file already open */
-#define GIFIN_ERR_IAO      -7   /* image already open */
-#define GIFIN_ERR_NFO      -8   /* no file open */
-#define GIFIN_ERR_NIO      -9   /* no image open */
-
-/*
- * colormap indices 
- */
-
-#define GIF_RED  0
-#define GIF_GRN  1
-#define GIF_BLU  2
-
-/*
- * typedef BYTE for convenience
- */
-
-typedef unsigned char BYTE;
-
-static int gifin_open_file();
-static int gifin_open_image();
-static int gifin_get_pixel();
-#if 0
-static int gifin_close_image();
-#endif
-static int gifin_close_file();
-static int gifin_load_cmap();
-static int gifin_skip_extension();
-static int gifin_read_data_block();
-static int gifin_push_string();
-static void gifin_add_string();
-static void gifin_fatal();
-
-/* #defines, typedefs, and such
- */
-
-#define GIF_SIG      "GIF87a"
-#define GIF_SIG_89   "GIF89a"
-#define GIF_SIG_LEN  6          /* GIF signature length */
-#define GIF_SD_SIZE  7          /* GIF screen descriptor size */
-#define GIF_ID_SIZE  9          /* GIF image descriptor size */
-
-#define GIF_SEPARATOR   ','     /* GIF image separator */
-#define GIF_EXTENSION   '!'     /* GIF extension block marker */
-#define GIF_TERMINATOR  ';'     /* GIF terminator */
-
-#define STAB_SIZE  4096         /* string table size */
-#define PSTK_SIZE  4096         /* pixel stack size */
-
-#define NULL_CODE  -1           /* string table null code */
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
