chimera-1.51$B$G$H$j$"$($:F|K\8l$NI=<($H0u:~$,=PMh$k$h$&$K$7$^$7$?!#F|K\(B
$B8l(BPS$BBP1~$NItJ,$O(B $BIY;NDL$NEOIt$5$s$,8x3+$5$l$F$$$k(BMosaic$BMQ$N%Q%C%A$r%^!<(B
$B%8$5$;$F$b$i$$$^$7$?!#0J2<$OCm0UE@$G$9!#(B

1. X11R5$B$b$7$/$O(BX11R6$B$G%3%s%Q%$%k=PMh$^$9!#(BR5+Ximp$B$N>l9g!"(Bconfig$B$r<B9T(B
   $B$7$?8e$K!"(BCommon.tmpl$B$N(BKANJI_DEFINES$B$K(B-DXIMP$B$rDI2C$7$F2<$5$$!#(B

2. $B0J2<$N4D6-$GF0:n$9$k$3$H$r3NG'$7$F$$$^$9!#(B

	ULTRIX V4.3	X11R5+Xsi
	SunOS R4.1.3	X11R5+Xsi or X11R5+Ximp
	DEC OSF/1 V2.0	X11R5+Xsi
	IRIX R5.1	X11R5+Xsi
	BSD/386 V1.1	X11R5+Xsi or X11R6

3. X11R5+Xsi$B$N>l9g!"5/F0;~$K(B
	Warning: Missing charsets in String to FontSet conversion
   $B$H$$$&%o!<%K%s%0%a%C%;!<%8$,=P$k$H;W$$$^$9!#$A$c$s$HF|K\8l$,I=<($5(B
   $B$l$F$$$k$N$J$iL5;k$7$F$bBg>fIW$G$9!#$A$J$_$K!"(BR5+Xsi$B$J$i$P!"(B
   lib/X11/nls/ja_JP.ujis$B$N(B`jisx0212.1990-0'$B$H(B`omron_udc_ja-0'$B$N9T$r%3(B
   $B%a%s%H%"%&%H$9$l$P=P$J$/$J$k$O$:$G$9!#(B

4. $B5/F0;~$K!"(B
	Can't setlocale to ja_JP.XXX
   $B$H$$$&%o!<%K%s%0%a%C%;!<%8$,=P$k>l9g$O!"F|K\8l(B(EUC)$B$N%m%1!<%kL>$,0c(B
   $B$C$F$$$k$N$G!"(B`-xnllanguage ja_JP.EUC',`-xnllanguage ja_JP.ujis'$B$J(B
   $B$I$r;XDj$7$F5/F0$7$F$/$@$5$$!#(B

   $B$=$l$G$b%o!<%K%s%0%a%C%;!<%8$,L5$/$J$i$J$$>l9g!"(BOS$B$,%5%]!<%H$7$F$$$k(B
   $B%m%1!<%k$H(BXlib$B$,%5%]!<%H$7$F$$$k%m%1!<%k$,0c$C$F$$$^$9!#$3$N>l9g!"(B 
   config$B$r<B9T$7$?8e$K(BCommon.tmpl$B$N(BKANJI_DEFINES$B$K(B-DSETLOCALE$B$rDI2C$9(B
   $B$7$F!"%3%s%Q%$%k$9$l$P0l1~F0$/$h$&$K$J$k$H;W$$$^$9!#(B

5. $B%G%U%)%k%H$G$O(BJIS$B$*$h$S(BEUC$B$KBP1~$7$^$9!#(B
   SJIS$B$rI=<($9$k>l9g!"(B`-xnllanguage ja_JP.mscode'(Xsi$B$N>l9g(B)
   `-xnllanguage ja_JP.SJIS'$B$N%*%W%7%g%s$r5/F0;~$KIU$1$F2<$5$$!#(B 
   latin-1$B$J$i(B`-xnllanguage lt_LN.bit8'(Xsi$B$N>l9g(B)$B$G$9!#(B

6. $B%*%W%7%g%s(B`-xnllanguage'$B$NBe$o$j$K!"%j%=!<%9(B`xnlLanguage'$B$,;HMQ$G$-(B
   $B$^$9!#$3$N%*%W%7%g%s(B/$B%j%=!<%9$O!";HMQ$9$k%3!<%I%;%C%H$K1~$8$?%m%1!<%k(B
   $B$r;XDj$9$k$N$G$9$,!"(BJIS$B$r;HMQ$9$k>l9g$G$b(BEUC$B$N%m%1!<%k$r;XDj$7$F2<(B
   $B$5$$(B($BFbIt$G(BJIS->EUC$B$N%3!<%IJQ49$r$9$k$?$a(B)$B!#(B

   $B$&$^$/!"$3$N%m%1!<%k$H%U%)%s%H%;%C%H$r;XDj$9$l$P(B($B%U%)%s%H%;%C%H$N%j(B
   $B%=!<%9L>$O(BHTML.h$B$r;2>H(B) $BCf9q8l!"4Z9q8l$NJ8>O$bI=<(=PMh$k$H;W$$$^$9!#(B

7. $B$&$^$/%3%s%Q%$%k$,=PMh$J$+$C$??M0J30$O%Q%C%A$r8+$J$$$h$&$K$7$F$/$@(B
   $B$5$$!#L\$,Ie$j$^$9!#(B

8. $BF|K\8l2=$NItJ,$NLdBj(B/$B%P%0Ey$O(B mituru-k@is.aist-nara.ac.jp $B$^$G!#(B

*** Common.tmpl.dist.orig	Fri May 20 10:08:21 1994
--- Common.tmpl.dist	Fri May 20 10:08:36 1994
***************
*** 33,35 ****
--- 33,38 ----
  TERMLIB = XXXTERMLIB
  TERMINC = XXXTERMINC
  TERMFLAG = XXXTERMFLAG
+ 
+ KANJI_DEFINES = -DKANJI -DL10N -DNAIST
+ 
*** libhtmlw/HTML-PSformat.c.orig	Fri May 20 10:08:14 1994
--- libhtmlw/HTML-PSformat.c	Fri May 20 10:08:36 1994
***************
*** 105,110 ****
--- 105,117 ----
  		} \
  }
  	
+ /* Added by kazu@ftk.fujitsu.co.jp */
+ #ifdef	L10N
+ #define NIHONGO_MASK	(1<<7)
+ #define G2		0x8e
+ #define G3		0x8f
+ #define KANA_MASK	~(~0<<7)
+ #endif
  
  /* for regular-font, bold-font, italic-font, fixed-font */
  typedef enum { RF, BF, IF, FF } PS_fontstyle;
***************
*** 260,266 ****
--- 267,277 ----
   |
  */
  
+ #ifdef KANJI
+ static void PSfont ARG3( HTMLWidget,hw, XFontSet, font, int,fontfamily) {
+ #else
  static void PSfont ARG3( HTMLWidget,hw, XFontStruct *,font, int,fontfamily) {
+ #endif /* KANJI */
  
  	PS_fontstyle fn;
  	int style, size;
***************
*** 271,276 ****
--- 282,291 ----
  	};
  
  	static char fnchar[4][3] = {"RF", "BF", "IF", "FF"};
+ #ifdef	L10N
+ 	static char kfnchar[4][4] = {"KRF", "KBF","KRF","KBF"};
+ 	static char knfnchar[4][4] = {"KNF", "KNF","KNF","KNF"};
+ #endif
  
  	/* fontsizes as set in gui.c and in HTML.c (listing font is only
  	 * defined in HTML.c)
***************
*** 337,343 ****
--- 352,368 ----
  	/* NULL case - reflush old font or the builtin default: */
  	if (hw==NULL || font==NULL) {
  		if (PS_oldfs != 0)
+ #ifdef	L10N
+ 		{
+ #endif
  			PSprintf( "%2s %d SF\n", fnchar[PS_oldfn], PS_oldfs);
+ #ifdef	L10N
+ 			PSprintf( "/FN %2s D\n", fnchar[PS_oldfn]);
+ 			PSprintf( "/FNS %d D\n", PS_oldfs);
+ 			PSprintf( "/KFN %3s D\n", kfnchar[PS_oldfn]);
+ 			PSprintf( "/KNFN %3s D\n", knfnchar[PS_oldfn]);
+ 		}
+ #endif
  		return;
  	}
  	/* added the next line in case xmosaic version 199.4 has more fonts */
***************
*** 373,378 ****
--- 398,412 ----
  
  	/* check size, by looking at the size of the regular font */
  	size = 1;
+ #ifdef KANJI
+ 	if (FontAscent(hw->html.bold_font) > medium_fontascent[fontfamily]) {
+ 		/* large font */
+ 		size = 2;
+ 	} else if (FontAscent(hw->html.bold_font) < medium_fontascent[fontfamily]) {
+ 		/* small font */
+ 		size = 0;
+ 	}
+ #else
  	if (hw->html.bold_font->ascent > medium_fontascent[fontfamily]) {
  		/* large font */
  		size = 2;
***************
*** 380,385 ****
--- 414,420 ----
  		/* small font */
  		size = 0;
  	}
+ #endif /* KANJI */
  	fn = fontstyle[style];
  	fs = fontsizes[fontfamily][size][style];
  	PS_fontascent = fontascent[fontfamily][size][style];
***************
*** 386,391 ****
--- 421,432 ----
  
  	if (fn != PS_oldfn || fs != PS_oldfs) {
  		PSprintf( "%2s %d SF\n", fnchar[fn], fs);
+ #ifdef	L10N
+ 		PSprintf( "/FN %2s D\n", fnchar[fn]);
+ 		PSprintf( "/FNS %d D\n", fs);
+ 		PSprintf( "/KFN %3s D\n", kfnchar[fn]);
+ 		PSprintf( "/KNFN %3s D\n", knfnchar[fn]);
+ #endif
  		PS_oldfn=fn, PS_oldfs=fs;
  	}
  }
***************
*** 533,538 ****
--- 574,583 ----
  		"NewCenturySchlbk-Roman", "NewCenturySchlbk-Bold",
  			"NewCenturySchlbk-Italic",
  		"Lucida", "Lucida-Bold", "Lucida-Italic",
+ #ifdef	L10N
+ 		"Ryumin-Light-EUC-H","GothicBBB-Medium-EUC-H",
+ 		"Ryumin-Light.Katakana",
+ #endif
  	};
  
  	static char *txt[] = {
***************
*** 576,581 ****
--- 621,631 ----
  	PSprintf("/RF {/%s} D\n", fontname[font*3]);
  	PSprintf("/BF {/%s} D\n", fontname[font*3+1]);
  	PSprintf("/IF {/%s} D\n", fontname[font*3+2]);
+ #ifdef	L10N
+ 	PSprintf("/KRF {/%s} D\n", fontname[12]);
+ 	PSprintf("/KBF {/%s} D\n", fontname[13]);
+ 	PSprintf("/KNF {/%s} D\n", fontname[14]);
+ #endif
  
  	PSinit_latin1();
  
***************
*** 613,619 ****
--- 663,673 ----
  static void PStext ARG2(String,t, int,underline) {
  	String	tp, t2;
  	int	nspecial=0, nisochar=0;
+ #ifdef	L10N
+ 	void PSkprint();
+ #endif
  
+ 	
  	tp=t;
  	/* count # of special char's in text */
  	while (*tp != '\0') {
***************
*** 626,632 ****
--- 680,690 ----
  	
  	if (nspecial == 0 && nisochar == 0) {
  		/*  no special char's, send out original string */
+ #ifdef	L10N
+ 		PSkprint(t,(underline)?'S': 'S');
+ #else
  		PSprintf("(%s)%c\n", t, (underline)?'U':'S');
+ #endif
  		return;
  	}
  	/*  create t2 to hold original text + "\"'s */
***************
*** 645,650 ****
--- 703,709 ----
  		if (*t == L_PAREN || *t == R_PAREN || *t == B_SLASH) {
  			*(tp++) = B_SLASH;
  			*(tp++) = *t;
+ #ifndef	L10N
  		} else if (*(unsigned char *)t > (unsigned char) MAX_ASCII) {
  			 /*  convert to octal */
  			*(tp++) = B_SLASH;
***************
*** 651,656 ****
--- 710,716 ----
  			*(tp++) = ((int)(*(unsigned char *)t)>>6 & 007) + '0';
  			*(tp++) = ((int)(*(unsigned char *)t)>>3 & 007) + '0';
  			*(tp++) = ((int)(*(unsigned char *)t) & 007) + '0';
+ #endif	/* L10N */
  		} else {
  			*(tp++) = *t;
  		}
***************
*** 657,663 ****
--- 717,727 ----
  		t++;
  	}
  	*(tp) = '\0';
+ #ifdef	L10N
+ 	PSkprint(t2,(underline)?'S': 'S');
+ #else
  	PSprintf("(%s)%c\n", t2, (underline)?'U':'S');
+ #endif
  
  	free(t2);
  }
***************
*** 1423,1429 ****
--- 1487,1497 ----
  
  			PSfont(hw, eptr->font, fontfamily);	/* set font */
  			if (PS_fontascent == 0) 
+ #ifdef KANJI
+ 				ascent = FontAscent(eptr->font);
+ #else
  				ascent = eptr->font->ascent;
+ #endif /* KANJI */
  			else
  				ascent = PS_fontascent;
  			PSmove_offset(eptr->y_offset + ascent);
***************
*** 1436,1443 ****
--- 1504,1515 ----
  			int offset;
  
  			PSfont(hw, eptr->font, fontfamily);
+ #ifdef KANJI
+ 			width = FontLogicalWidth(eptr->font);
+ #else
  			width = eptr->font->max_bounds.lbearing +
  					eptr->font->max_bounds.rbearing;
+ #endif /* KANJI */
  			/* the next line is a hack to get a good position of the
  			 * bullet in most practical cases, otherwise the
  			 * bullet may appear just a bit too low (for large fonts)
***************
*** 1450,1458 ****
--- 1522,1538 ----
  				offset = eptr->line_height -
  					eptr->next->line_height +
  					eptr->y_offset +
+ #ifdef KANJI
+ 					FontAscent(eptr->next->font);
+ #else
  					eptr->next->font->ascent;
+ #endif /* KANJI */
  			else
+ #ifdef KANJI
+ 				offset = eptr->y_offset + FontAscent(eptr->font);
+ #else
  				offset = eptr->y_offset + eptr->font->ascent;
+ #endif /* KANJI */
  
  		  	PSmove_offset(offset - width/4);
  		  	PSbullet(eptr->indent_level, eptr->line_height);
***************
*** 1483,1485 ****
--- 1563,1669 ----
  	return( PS_string);
  }
  
+ /* Follow lines added by kazu@ftk.fujitsu.co.jp */
+ #ifdef	L10N
+ void PSkprint(text,command)
+ unsigned char *text;
+ unsigned char command;
+ {
+ 	unsigned char *drawdata;
+ 	unsigned char *PS_DrawAscii(),*PS_DrawKana(),*PS_DrawGaiji(),*PS_DrawKanji();
+ 
+ 	drawdata = text;
+ 	while(*drawdata != '\0'){
+ 		if(!(*drawdata & NIHONGO_MASK)){
+ 			drawdata = PS_DrawAscii(drawdata,command);
+ 			continue;
+ 		}
+ 		if(*drawdata == G2){
+ 			drawdata = PS_DrawKana(drawdata,command);
+ 			continue;
+ 		}
+ 		if(*drawdata == G3){
+ 			drawdata = PS_DrawGaiji(drawdata,command);
+ 			continue;
+ 		}
+ 		drawdata = PS_DrawKanji(drawdata,command);
+ 	}
+ }
+ 
+ unsigned char *PS_DrawAscii(data,command)
+ unsigned char *data;
+ unsigned char command;
+ {
+ 	PSprintf("(");
+ 	while(!(*data & NIHONGO_MASK) && *data != '\0'){
+ 		PSprintf("%c",*data++);
+ 	}
+ 	PSprintf(")%c\n",command);
+ 	return(data);
+ }
+ 
+ unsigned char *PS_DrawKanji(data,command)
+ unsigned char *data;
+ unsigned char command;
+ {
+ #ifdef NAIST
+ 	PSprintf("KFN findfont FNS scalefont setfont\n");
+ 	PSprintf("(");
+ 	while(*data & NIHONGO_MASK && *data != G2 && 
+ 	      *data != G3 && *data != '\0'){
+ 		/*
+ 		fprintf(stderr,"%c%c",*data,*(data+1));
+ 		*/
+ 		PSprintf("%c%c",*data,*(data+1));
+ 		data += 2;
+ 	}
+ 	/*
+ 	fprintf(stderr,"\n");
+ 	*/
+ 	PSprintf(")%c\n",command);
+ 	PSprintf("FN findfont FNS scalefont setfont\n");
+ 	return(data);
+ #else
+ 	PSprintf("KFN findfont FNS scalefont setfont\n");
+ 	PSprintf("<");
+ 	while(*data & NIHONGO_MASK && *data != G2 && 
+ 	      *data != G3 && *data != '\0'){
+ 		PSprintf("%x%x ",*data++,*data++);
+ 	}
+ 	PSprintf(">%c\n",command);
+ 	PSprintf("FN findfont FNS scalefont setfont\n");
+ 	return(data);
+ #endif
+ }
+ 
+ unsigned char *PS_DrawKana(data,command)
+ unsigned char *data;
+ unsigned char command;
+ {
+ 	PSprintf("KNFN findfont FNS scalefont setfont\n");
+ 	PSprintf("(");
+ 	while(*data == G2 && *data != '\0'){
+ 		PSprintf("\\%o",(*++data) & KANA_MASK);
+ 		++data;
+ 	}
+ 	PSprintf(")%c\n",command);
+ 	PSprintf("FN findfont FNS scalefont setfont\n");
+ 	return(data);
+ }
+ 
+ unsigned char *PS_DrawGaiji(data,command)
+ unsigned char *data;
+ unsigned char command;
+ {
+ 	PSprintf("KFN findfont FNS scalefont setfont\n");
+ 	PSprintf("<");
+ 	while(*data == G3 && *data != '\0'){
+ 		PSprintf("%x%x ",*++data,*++data);
+ 		++data;
+ 	}
+ 	PSprintf(">%c\n",command);
+ 	PSprintf("FN findfont FNS scalefont setfont\n");
+ 	return(data);
+ }
+ 
+ #endif	/* L10N */
*** libhtmlw/HTML.c.orig	Fri May 20 10:08:14 1994
--- libhtmlw/HTML.c	Fri May 20 10:08:37 1994
***************
*** 459,465 ****
--- 459,550 ----
  		XtOffset (HTMLWidget, html.scroll_y),
  		XtRInt, 0
  	},
+ #ifdef KANJI
+ #define F14  "-adobe-times-medium-r-*--14-*,-*-*-medium-r-*--14-*"
+ #define F14I "-adobe-times-medium-i-*--14-*,-*-*-medium-r-*--14-*"
+ #define F14B "-adobe-times-bold-r-*--14-*,-*-*-medium-r-*--14-*"
+ #define F16B "-adobe-times-bold-r-*--17-*,-*-*-medium-r-*--16-*"
+ #define F24B "-adobe-times-bold-r-*--24-*,-*-*-medium-r-*--24-*"
+ #define	FFIX "-misc-*-medium-r-*--14-*"
  
+ 	{	XtNfontSet,
+ 		XtCFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.font),
+ 		XtRString, F14
+ 	},
+ 
+ 	{	WbNitalicFontSet,
+ 		WbCItalicFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.italic_font),
+ 		XtRString, F14I
+ 	},
+ 
+ 	{	WbNboldFontSet,
+ 		WbCBoldFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.bold_font),
+ 		XtRString, F14B
+ 	},
+ 
+ 	{	WbNfixedFontSet,
+ 		WbCFixedFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.fixed_font),
+ 		XtRString, FFIX
+ 	},
+ 
+ 	{	WbNheader1FontSet,
+ 		WbCHeader1FontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.header1_font),
+ 		XtRString, F24B
+ 	},
+ 
+ 	{	WbNheader2FontSet,
+ 		WbCHeader2FontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.header2_font),
+ 		XtRString, F16B
+ 	},
+ 
+ 	{	WbNheader3FontSet,
+ 		WbCHeader3FontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.header3_font),
+ 		XtRString, F16B
+ 	},
+ 
+ 	{	WbNheader4FontSet,
+ 		WbCHeader4FontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.header4_font),
+ 		XtRString, F14B
+ 	},
+ 
+ 	{	WbNheader5FontSet,
+ 		WbCHeader5FontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.header5_font),
+ 		XtRString, F14B
+ 	},
+ 
+ 	{	WbNheader6FontSet,
+ 		WbCHeader6FontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.header6_font),
+ 		XtRString, F14B
+ 	},
+ 
+ 	{	WbNaddressFontSet,
+ 		WbCAddressFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.address_font),
+ 		XtRString, F14I
+ 	},
+ 
+ 	{	WbNplainFontSet,
+ 		WbCPlainFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.plain_font),
+ 		XtRString, FFIX
+ 	},
+ 
+ 	{	WbNlistingFontSet,
+ 		WbCListingFontSet, XtRFontSet, sizeof (XFontSet),
+ 		XtOffset (HTMLWidget, html.listing_font),
+ 		XtRString, F14
+ 	},
+ #else
  	{	XtNfont,
  		XtCFont, XtRFontStruct, sizeof (XFontStruct *),
  		XtOffset (HTMLWidget, html.font),
***************
*** 537,542 ****
--- 622,628 ----
  		XtOffset (HTMLWidget, html.listing_font),
  		XtRString, "-adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-*"
  	},
+ #endif /* KANJI */
                    
          {       WbNpreviouslyVisitedTestFunction,
                  WbCPreviouslyVisitedTestFunction, XtRPointer, 
***************
*** 1891,1896 ****
--- 1977,1985 ----
  	start = 0;
  	end = hw->html.line_count - 1;
  
+ #ifdef KANJI
+ 	guess = end;
+ #else
  	/*
  	 * Heuristic to speed up redraws by guessing at the starting line.
  	 */
***************
*** 1900,1905 ****
--- 1989,1995 ----
  	{
  		guess = end;
  	}
+ #endif /* KANJI */
  	while (guess > 0)
  	{
  		if ((hw->html.line_array[guess] != NULL)&&
***************
*** 2381,2386 ****
--- 2471,2483 ----
  		end_pos = epos;
  	}
  
+ #ifdef KANJI
+ 	if (start->type == E_TEXT)
+ 	    SetByte1(start->edata, &start_pos);
+ 	if (end->type == E_TEXT)
+ 	    SetByte2(end->edata, &end_pos);
+ #endif /* KANJI */
+ 
  	eptr = start;
  	while ((eptr != NULL)&&(eptr != end))
  	{
***************
*** 2462,2467 ****
--- 2559,2570 ----
  
  	start = hw->html.select_start;
  	end = hw->html.select_end;
+ #ifdef KANJI
+ 	if (start->type == E_TEXT)
+ 	    SetByte1(start->edata, &hw->html.sel_start_pos);
+ 	if (end->type == E_TEXT)
+ 	    SetByte2(end->edata, &hw->html.sel_end_pos);
+ #endif /* KANJI */
  	start_pos = hw->html.sel_start_pos;
  	end_pos = hw->html.sel_end_pos;
  	DrawSelection(hw, start, end, start_pos, end_pos);
***************
*** 2516,2521 ****
--- 2619,2631 ----
  		end_pos = epos;
  	}
  
+ #ifdef KANJI
+ 	if (start->type == E_TEXT)
+ 	    SetByte1(start->edata, &start_pos);
+ 	if (end->type == E_TEXT)
+ 	    SetByte2(end->edata, &end_pos);
+ #endif /* KANJI */
+ 
  	eptr = start;
  	while ((eptr != NULL)&&(eptr != end))
  	{
***************
*** 3366,3372 ****
--- 3476,3486 ----
  					hw->html.select_end,
  					hw->html.sel_start_pos,
  					hw->html.sel_end_pos,
+ #ifdef KANJI
+ 					FontLogicalWidth(hw->html.font),
+ #else
  					hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  					hw->html.margin_width);
  				}
  				else
***************
*** 3377,3383 ****
--- 3491,3501 ----
  					hw->html.select_end,
  					hw->html.sel_start_pos,
  					hw->html.sel_end_pos,
+ #ifdef KANJI
+ 					FontLogicalWidth(hw->html.font),
+ #else
  					hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  					hw->html.margin_width);
  				}
  				XStoreBuffer(XtDisplay((Widget)hw),
***************
*** 3578,3584 ****
--- 3696,3706 ----
  			    tptr = ParseTextToString(hw->html.select_start,
  				hw->html.select_start, hw->html.select_end,
  				hw->html.sel_start_pos, hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  			    ptr = tptr;
  			    while ((ptr != NULL)&&(*ptr != '\0'))
***************
*** 4255,4261 ****
--- 4377,4387 ----
  				hw->html.formatted_elements,
  				hw->html.select_start, hw->html.select_end,
  				hw->html.sel_start_pos, hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  		}
  		else
***************
*** 4263,4271 ****
--- 4389,4415 ----
  			text = ParseTextToString(hw->html.formatted_elements,
  				hw->html.select_start, hw->html.select_end,
  				hw->html.sel_start_pos, hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  		}
+ #ifdef KANJI
+ 		if (*target == XA_COMPOUND_TEXT(d) || *target == XA_TEXT(d)) {
+ 		    	char *ctext;
+ 			int  mblen, clength, dummy1, dummy2;
+ 			XTextProperty xtp;
+ 
+ 			*type = XA_COMPOUND_TEXT(d);
+ 			XmbTextListToTextProperty(d, &text, 1,
+ 						  XCompoundTextStyle, &xtp);
+ 			text = (char*)realloc(text, strlen(xtp.value));
+ 			strcpy(text, xtp.value);
+ 			XFree(xtp.value);
+ 		}
+ #endif /* KANJI */
  		*value = text;
  		*length = strlen(*value);
  		*format = 8;
***************
*** 4298,4304 ****
--- 4442,4452 ----
  				hw->html.formatted_elements,
  				hw->html.select_start, hw->html.select_end,
  				hw->html.sel_start_pos, hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  		}
  		else
***************
*** 4306,4312 ****
--- 4454,4464 ----
  			text = ParseTextToString(hw->html.formatted_elements,
  				hw->html.select_start, hw->html.select_end,
  				hw->html.sel_start_pos, hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  		}
  		*value = XtMalloc(4);
***************
*** 4397,4403 ****
--- 4549,4559 ----
  	{
  		tptr = ParseTextToPSString(hw, start, start, end,
  				0, 0,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  	}
  	else if (pretty)
***************
*** 4404,4410 ****
--- 4560,4570 ----
  	{
  		tptr = ParseTextToPrettyString(hw, start, start, end,
  				0, 0,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  	}
  	else
***************
*** 4411,4417 ****
--- 4571,4581 ----
  	{
  		tptr = ParseTextToString(start, start, end,
  				0, 0,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  	}
  	if (tptr != NULL)
***************
*** 5254,5260 ****
--- 5418,5428 ----
  				hw->html.select_end,
  				hw->html.sel_start_pos,
  				hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  			}
  			else
***************
*** 5265,5271 ****
--- 5433,5443 ----
  				hw->html.select_end,
  				hw->html.sel_start_pos,
  				hw->html.sel_end_pos,
+ #ifdef KANJI
+ 				FontLogicalWidth(hw->html.font),
+ #else
  				hw->html.font->max_bounds.width,
+ #endif /* KANJI */
  				hw->html.margin_width);
  			}
  			XStoreBuffer(XtDisplay((Widget)hw),
***************
*** 6148,6150 ****
--- 6320,6360 ----
  	}
  }
  
+ #ifdef KANJI
+ 
+ SetByte1(text, pos)
+      char *text;
+      int  *pos;
+ {
+     int	 i, prev;
+ 
+     i = prev = 0;
+     while (text[i] && i <= *pos) {
+ 	prev = i;
+ 	if (text[i] & 0x80)
+ 	    i += 2;
+ 	else
+ 	    i++;
+     }
+     *pos = prev;
+ }
+ 
+ SetByte2(text, pos)
+      char *text;
+      int  *pos;
+ {
+     int	 i, prev;
+ 
+     i = prev = 0;
+     while (text[i] && i <= *pos) {
+ 	prev = i;
+ 	if (text[i] & 0x80)
+ 	    i += 2;
+ 	else
+ 	    i++;
+     }
+     *pos = (prev + i) >> 1;
+ }
+ 
+ #endif /* KANJI */
+ 	    
*** libhtmlw/HTML.h.orig	Fri May 20 10:08:15 1994
--- libhtmlw/HTML.h	Fri May 20 10:08:38 1994
***************
*** 218,224 ****
--- 218,228 ----
  	int type;
  	ImageInfo *pic_data;
  	WidgetInfo *widget_data;
+ #ifdef KANJI
+ 	XFontSet font;
+ #else	
  	XFontStruct *font;
+ #endif /* KANJI */
  	int alignment;
  	Boolean internal;
  	Boolean selected;
***************
*** 390,395 ****
--- 394,413 ----
  #define	WbNimageBorders		"imageBorders"
  #define	WbNdelayImageLoads	"delayImageLoads"
  #define	WbNisIndex		"isIndex"
+ #ifdef KANJI
+ #define	WbNitalicFontSet	"italicFontSet"
+ #define	WbNboldFontSet		"boldFontSet"
+ #define	WbNfixedFontSet		"fixedFontSet"
+ #define	WbNheader1FontSet	"header1FontSet"
+ #define	WbNheader2FontSet	"header2FontSet"
+ #define	WbNheader3FontSet	"header3FontSet"
+ #define	WbNheader4FontSet	"header4FontSet"
+ #define	WbNheader5FontSet	"header5FontSet"
+ #define	WbNheader6FontSet	"header6FontSet"
+ #define	WbNaddressFontSet	"addressFontSet"
+ #define	WbNplainFontSet		"plainFontSet"
+ #define	WbNlistingFontSet	"listingFontSet"
+ #else
  #define	WbNitalicFont		"italicFont"
  #define	WbNboldFont		"boldFont"
  #define	WbNfixedFont		"fixedFont"
***************
*** 402,407 ****
--- 420,426 ----
  #define	WbNaddressFont		"addressFont"
  #define	WbNplainFont		"plainFont"
  #define	WbNlistingFont		"listingFont"
+ #endif /* KANJI */
  #define	WbNanchorCallback	"anchorCallback"
  #define	WbNlinkCallback		"linkCallback"
  #define	WbNsubmitFormCallback	"submitFormCallback"
***************
*** 440,445 ****
--- 459,478 ----
  #define	WbCImageBorders		"ImageBorders"
  #define	WbCDelayImageLoads	"DelayImageLoads"
  #define	WbCIsIndex		"IsIndex"
+ #ifdef KANJI
+ #define	WbCItalicFontSet	"ItalicFontSet"
+ #define	WbCBoldFontSet		"BoldFontSet"
+ #define	WbCFixedFontSet		"FixedFontSet"
+ #define	WbCHeader1FontSet	"Header1FontSet"
+ #define	WbCHeader2FontSet	"Header2FontSet"
+ #define	WbCHeader3FontSet	"Header3FontSet"
+ #define	WbCHeader4FontSet	"Header4FontSet"
+ #define	WbCHeader5FontSet	"Header5FontSet"
+ #define	WbCHeader6FontSet	"Header6FontSet"
+ #define	WbCAddressFontSet	"AddressFontSet"
+ #define	WbCPlainFontSet		"PlainFontSet"
+ #define	WbCListingFontSet	"ListingFontSet"
+ #else
  #define	WbCItalicFont		"ItalicFont"
  #define	WbCBoldFont		"BoldFont"
  #define	WbCFixedFont		"FixedFont"
***************
*** 452,457 ****
--- 485,491 ----
  #define	WbCAddressFont		"AddressFont"
  #define	WbCPlainFont		"PlainFont"
  #define	WbCListingFont		"ListingFont"
+ #endif /* KANJI */
  #define	WbCPreviouslyVisitedTestFunction "PreviouslyVisitedTestFunction"
  #define	WbCResolveImageFunction "ResolveImageFunction"
  #define	WbCResolveDelayedImage "ResolveDelayedImage"
*** libhtmlw/HTMLP.h.orig	Fri May 20 10:08:15 1994
--- libhtmlw/HTMLP.h	Fri May 20 10:08:38 1994
***************
*** 145,150 ****
--- 145,165 ----
  	Boolean			is_index;
  	int			percent_vert_space;
  
+ #ifdef KANJI
+ 	XFontSet		font;
+ 	XFontSet		italic_font;
+ 	XFontSet		bold_font;
+ 	XFontSet		fixed_font;
+ 	XFontSet		header1_font;
+ 	XFontSet		header2_font;
+ 	XFontSet		header3_font;
+ 	XFontSet		header4_font;
+ 	XFontSet		header5_font;
+ 	XFontSet		header6_font;
+ 	XFontSet		address_font;
+ 	XFontSet		plain_font;
+ 	XFontSet		listing_font;
+ #else
  	XFontStruct		*font;
  	XFontStruct		*italic_font;
  	XFontStruct		*bold_font;
***************
*** 158,163 ****
--- 173,179 ----
  	XFontStruct		*address_font;
  	XFontStruct		*plain_font;
  	XFontStruct		*listing_font;
+ #endif /* KANJI */
  
          XtPointer		previously_visited_test;
          XtPointer		resolveImage;
*** libhtmlw/HTMLformat.c.orig	Fri May 20 10:08:15 1994
--- libhtmlw/HTMLformat.c	Fri May 20 10:08:39 1994
***************
*** 62,67 ****
--- 62,70 ----
  #include <ctype.h>
  #include "HTMLP.h"
  
+ #ifdef KANJI
+ #include <X11/Xlocale.h>
+ #endif /* KANJI */
  
  /*
   * I need my own is ispunct function because I need a closing paren
***************
*** 128,134 ****
--- 131,141 ----
   * To allow arbitrary nesting of font changes
   */
  typedef struct font_rec {
+ #ifdef KANJI
+         XFontSet    font;
+ #else
  	XFontStruct *font;
+ #endif /* KANJI */
  	struct font_rec *next;
  } FontRec;
  
***************
*** 137,144 ****
--- 144,156 ----
  static DescRec *ListData;
  static FontRec FontBase;
  static FontRec *FontStack;
+ #ifdef KANJI
+ static XFontSet	currentFont;
+ static XFontSet	saveFont;
+ #else
  static XFontStruct *currentFont;
  static XFontStruct *saveFont;
+ #endif /* KANJI */
  static unsigned long Fg;
  static unsigned long Bg;
  static int Width;
***************
*** 180,185 ****
--- 192,200 ----
  static char *CompWord = NULL;
  static int CompWordLen = 0;
  
+ #ifdef KANJI
+ #define XTextExtents		TextExtents
+ #endif /* KANJI */
  
  
  /*
***************
*** 189,195 ****
--- 204,214 ----
  CreateElement(hw, type, fp, x, y, edata)
  	HTMLWidget hw;
  	int type;
+ #ifdef KANJI
+ 	XFontSet fp;
+ #else
  	XFontStruct *fp;
+ #endif /* KANJI */
  	int x, y;
  	char *edata;
  {
***************
*** 198,204 ****
--- 217,227 ----
  
  	if (fp != NULL)
  	{
+ #ifdef KANJI
+ 	        baseline = FontAscent(fp);
+ #else
  		baseline = fp->max_bounds.ascent;
+ #endif /* KANJI */
  	}
  	else
  	{
***************
*** 700,706 ****
--- 723,733 ----
  SetElement(hw, type, fp, x, y, edata)
  	HTMLWidget hw;
  	int type;
+ #ifdef KANJI
+ 	XFontSet fp;
+ #else
  	XFontStruct *fp;
+ #endif /* KANJI */
  	int x, y;
  	char *edata;
  {
***************
*** 710,716 ****
--- 737,747 ----
  
  	if (fp != NULL)
  	{
+ #ifdef KANJI
+ 	        baseline = FontAscent(fp);
+ #else
  		baseline = fp->max_bounds.ascent;
+ #endif /* KANJI */
  	}
  	else
  	{
***************
*** 1332,1342 ****
--- 1363,1380 ----
   */
  void
  NewFont(fp)
+ #ifdef KANJI
+ 	XFontSet fp;
+ #else
  	XFontStruct *fp;
+ #endif /* KANJI */
  {
  	/*
  	 * Deal with bad Lucidia descents.
  	 */
+ #ifdef KANJI
+         LineHeight = FontHeight(fp);
+ #else
  	if (fp->descent > fp->max_bounds.descent)
  	{
  		LineHeight = fp->max_bounds.ascent + fp->descent;
***************
*** 1345,1350 ****
--- 1383,1389 ----
  	{
  		LineHeight = fp->max_bounds.ascent + fp->max_bounds.descent;
  	}
+ #endif /* KANJI */
  }
  
  
***************
*** 1559,1565 ****
--- 1598,1608 ----
  {
  	int baseline;
  
+ #ifdef KANJI
+ 	baseline = FontAscent(Current->font);
+ #else
  	baseline = Current->font->max_bounds.ascent;
+ #endif
  
  	if (BaseLine == -100)
  	{
***************
*** 1655,1660 ****
--- 1698,1706 ----
  	 * Deal with bad Lucidia descents.
  	 */
  	l_height = LineHeight;
+ #ifdef KANJI
+ 	LineHeight = FontHeight(hw->html.font);
+ #else
  	if (hw->html.font->descent > hw->html.font->max_bounds.descent)
  	{
  		LineHeight = hw->html.font->max_bounds.ascent +
***************
*** 1665,1673 ****
--- 1711,1724 ----
  		LineHeight = hw->html.font->max_bounds.ascent +
  			hw->html.font->max_bounds.descent;
  	}
+ #endif /* KANJI */
  
  	NeedSpace = 0;
+ #ifdef KANJI
+ 	width = FontWidth(hw->html.font);
+ #else
  	width = hw->html.font->max_bounds.width;
+ #endif /* KANJI */
  	SetElement(hw, E_BULLET, hw->html.font, *x, *y, (char *)NULL);
  	LineHeight = l_height;
  /*
***************
*** 1714,1721 ****
--- 1765,1776 ----
  
  	sprintf(buf, "%d.", val);
  
+ #ifdef KANJI
+ 	width = FontWidth(hw->html.font);
+ #else
  	width = hw->html.font->max_bounds.lbearing +
  		hw->html.font->max_bounds.rbearing;
+ #endif /* KANJI */
  	XTextExtents(currentFont, buf, strlen(buf), &dir,
  		&ascent, &descent, &all);
  	my_x = *x - (width / 2) - all.width;
***************
*** 2006,2011 ****
--- 2061,2071 ----
          XCharStruct all;
  	char *line;
  	int line_x;
+ #ifdef KANJI
+ 	int after_kanji, is_wide;
+ 	is_wide = strncmp(setlocale(LC_CTYPE, NULL), "lt_LN", 5);
+ 	after_kanji = 1;
+ #endif /* KANJI */
  
  	text = mptr->text;
  
***************
*** 2026,2031 ****
--- 2086,2096 ----
  		stripped_space = 0;
  		added_space = 0;
  		start = end;
+ #ifdef KANJI
+ 		if (is_wide && after_kanji && *start == '\n')
+ 		    start++;
+ 		after_kanji = 0;
+ #endif /* KANJI */
  		while (((int)((unsigned char)*start) < 128)&&(isspace(*start)))
  		{
  			stripped_space = 1;
***************
*** 2036,2041 ****
--- 2101,2113 ----
  		while (((int)((unsigned char)*end) > 127)||
  			((!isspace(*end))&&(*end != '\0')))
  		{
+ #ifdef KANJI
+ 		        if (is_wide && (unsigned char)*end > 127) {
+ 			    end += 2;
+ 			    after_kanji = 1;
+ 			    break;
+ 			}
+ #endif /* KANJI */
  			end++;
  		}
  
***************
*** 2865,2871 ****
--- 2937,2947 ----
  
  static void
  PushFont(font)
+ #ifdef KANJI
+         XFontSet font;
+ #else
  	XFontStruct *font;
+ #endif /* KANJI */
  {
  	FontRec *fptr;
  
***************
*** 2882,2891 ****
--- 2958,2975 ----
  }
  
  
+ #ifdef KANJI
+ static XFontSet
+ #else
  static XFontStruct *
+ #endif /* KANJI */
  PopFont()
  {
+ #ifdef KANJI
+ 	XFontSet font;
+ #else
  	XFontStruct *font;
+ #endif /* KANJI */
  	FontRec *fptr;
  
  	if (FontStack->next != NULL)
***************
*** 3037,3043 ****
--- 3121,3131 ----
  	int *x, *y;
  {
  	struct mark_up *mark;
+ #ifdef KANJI
+ 	XFontSet font;
+ #else
  	XFontStruct *font;
+ #endif /* KANJI */
  	int type, width;
  
  	mark = mptr;
***************
*** 3831,3837 ****
--- 3919,3929 ----
  		case M_MENU:
  		case M_DIRECTORY:
  			ConditionalLineFeed(hw, x, y, 1);
+ #ifdef KANJI
+ 			width = FontWidth(hw->html.font);
+ #else
  			width = hw->html.font->max_bounds.width;
+ #endif /* KANJI */
  			/*
  			 * If this is the outermost level of indentation,
  			 * add another linefeed for more white space.
***************
*** 3924,3930 ****
--- 4016,4026 ----
  		case M_DESC_LIST:
  			ConditionalLineFeed(hw, x, y, 1);
  			ConditionalLineFeed(hw, x, y, 2);
+ #ifdef KANJI
+ 			width = FontWidth(hw->html.font);
+ #else
  			width = hw->html.font->max_bounds.width;
+ #endif /* KANJI */
  			if (mark->is_end)
  			{
  				if (DescType->type == D_TEXT)
***************
*** 4001,4007 ****
--- 4097,4107 ----
  			break;
  		case M_DESC_TITLE:
  			ConditionalLineFeed(hw, x, y, 1);
+ #ifdef KANJI
+ 			width = FontWidth(hw->html.font);
+ #else
  			width = hw->html.font->max_bounds.width;
+ #endif /* KANJI */
  			/*
  			 * Special hack.  Don't indent again for
  			 * multiple <dt>'s in a row.
***************
*** 4019,4025 ****
--- 4119,4129 ----
  			*x = TextIndent;
  			break;
  		case M_DESC_TEXT:
+ #ifdef KANJI
+ 			width = FontWidth(hw->html.font);
+ #else
  			width = hw->html.font->max_bounds.width;
+ #endif /* KANJI */
  
  			/*
  			 * For a compact list we want to stay on the same
***************
*** 4582,4589 ****
--- 4686,4697 ----
  	int x, y, width;
  	int partial;
  
+ #ifdef KANJI
+ 	ascent = FontAscent(eptr->font);
+ #else
  	XSetFont(XtDisplay(hw), hw->html.drawGC, eptr->font->fid);
  	ascent = eptr->font->max_bounds.ascent;
+ #endif /* KANJI */
  	width = -1;
  	partial = 0;
  
***************
*** 4666,4671 ****
--- 4774,4786 ----
  
  		XSetForeground(XtDisplay(hw), hw->html.drawGC, bg);
  
+ #ifdef KANJI
+ 		XFillRectangle(XtDisplay(hw->html.view),
+ 			       XtWindow(hw->html.view),
+ 			       hw->html.drawGC, x, y,
+ 			       (unsigned int)all.width,
+ 			       (unsigned int)FontHeight(eptr->font));
+ #else
  		height = (eptr->font->max_bounds.ascent - eptr->font->ascent);
  		if (height > 0)
  		{
***************
*** 4685,4690 ****
--- 4800,4806 ----
  				(unsigned int)all.width, (unsigned int)height);
  		}
  		width = all.width;
+ #endif /* KANJI */
  	}
  #endif /* NO_EXTRA_FILLS */
  
***************
*** 4691,4700 ****
--- 4807,4824 ----
  	XSetForeground(XtDisplay(hw), hw->html.drawGC, fg);
  	XSetBackground(XtDisplay(hw), hw->html.drawGC, bg);
  
+ #ifdef KANJI
+ 	XmbDrawImageString(XtDisplay(hw->html.view), XtWindow(hw->html.view),
+ 		eptr->font,
+ 		hw->html.drawGC,
+ 		x, y + ascent,
+ 		(char *)tdata, tlen);
+ #else
  	XDrawImageString(XtDisplay(hw->html.view), XtWindow(hw->html.view),
  		hw->html.drawGC,
  		x, y + ascent,
  		(char *)tdata, tlen);
+ #endif /* KANJI */
  
  	if (eptr->underline_number)
  	{
***************
*** 4733,4740 ****
--- 4857,4868 ----
  			width = all.width;
  		}
  
+ #ifdef KANJI
+ 		ly = y + FontHeight(eptr->font) - 1;
+ #else
  		ly = (int)(y + eptr->font->max_bounds.ascent +
  				eptr->font->descent - 1);
+ #endif /* KANJI */
  
  		for (i=0; i<eptr->underline_number; i++)
  		{
***************
*** 4774,4783 ****
--- 4902,4916 ----
  			width = all.width;
  		}
  
+ #ifdef KANJI
+ 		ly = y + FontHeight(eptr->font) - 1;
+ 		ly = ly - FontHeight(hw->html.font) / 2;
+ #else		
  		ly = (int)(y + eptr->font->max_bounds.ascent +
  				eptr->font->descent - 1);
  		ly = ly - ((hw->html.font->max_bounds.ascent +
  			hw->html.font->descent) / 2);
+ #endif /* KANJI */
  
  		XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view),
  			hw->html.drawGC,
***************
*** 4839,4844 ****
--- 4972,4981 ----
  /*
  	width = eptr->font->max_bounds.width;
  */
+ #ifdef KANJI
+ 	width = FontWidth(eptr->font);
+ 	line_height = FontHeight(eptr->font);
+ #else
  	width = eptr->font->max_bounds.lbearing +
  		eptr->font->max_bounds.rbearing;
  	/*
***************
*** 4854,4864 ****
--- 4991,5005 ----
  		line_height = eptr->font->max_bounds.ascent +
  			eptr->font->max_bounds.descent;
  	}
+ #endif /* KANJI */
+ 
  	x1 = eptr->x;
  	y1 = eptr->y + eptr->y_offset + (line_height / 2) - (width / 4);
  	x1 = x1 - hw->html.scroll_x;
  	y1 = y1 - hw->html.scroll_y;
+ #ifndef KANJI
  	XSetFont(XtDisplay(hw), hw->html.drawGC, eptr->font->fid);
+ #endif /* !KANJI */
  	XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg);
  	XSetBackground(XtDisplay(hw), hw->html.drawGC, eptr->bg);
  	if (eptr->indent_level < 2)
***************
*** 5210,5215 ****
--- 5351,5359 ----
  	/*
  	 * Heuristic to speed up redraws by guessing at the starting line.
  	 */
+ #ifdef KANJI
+ 	guess = hw->html.line_count - 1;
+ #else
  	guess = y / (hw->html.font->max_bounds.ascent +
  		hw->html.font->max_bounds.descent);
  	if (guess > (hw->html.line_count - 1))
***************
*** 5216,5221 ****
--- 5360,5366 ----
  	{
  		guess = hw->html.line_count - 1;
  	}
+ #endif /* KANJI */
  	while (guess > 0)
  	{
  		if ((hw->html.line_array[guess] != NULL)&&
***************
*** 5274,5279 ****
--- 5419,5427 ----
  	/*
  	 * Deal with bad Lucidia descents.
  	 */
+ #ifdef KANJI
+ 	ty2 = eptr->y + FontHeight(eptr->font);
+ #else
  	if (eptr->font->descent > eptr->font->max_bounds.descent)
  	{
  		ty2 = eptr->y + eptr->font->max_bounds.ascent +
***************
*** 5284,5289 ****
--- 5432,5438 ----
  		ty2 = eptr->y + eptr->font->max_bounds.ascent +
  			eptr->font->max_bounds.descent;
  	}
+ #endif /* KANJI */
  	line = eptr->line_number;
  	/*
  	 * Searches on this line should extend to the top of the
***************
*** 5327,5332 ****
--- 5476,5484 ----
  			/*
  			 * Deal with bad Lucidia descents.
  			 */
+ #ifdef KANJI
+ 			ty2 = eptr->y + FontHeight(eptr->font);
+ #else
  			if(eptr->font->descent > eptr->font->max_bounds.descent)
  			{
  				ty2 = eptr->y + eptr->font->max_bounds.ascent +
***************
*** 5337,5342 ****
--- 5489,5495 ----
  				ty2 = eptr->y + eptr->font->max_bounds.ascent +
  					eptr->font->max_bounds.descent;
  			}
+ #endif /* KANJI */
  			line = eptr->line_number;
  			/*
  			 * Searches on this line should extend to the top of
***************
*** 5443,5449 ****
--- 5596,5606 ----
  		 * always be <= to this, but just in case, start at the end
  		 * of the string if it is not.
  		 */
+ #ifdef KANJI
+ 		epos = ((x - rptr->x) / FontWidth(rptr->font)) + 1;
+ #else
  		epos = ((x - rptr->x) / rptr->font->max_bounds.width) + 1;
+ #endif /* KANJI */
  		if (epos >= rptr->edata_len - 1)
  		{
  			epos = rptr->edata_len - 2;
***************
*** 6201,6208 ****
--- 6358,6370 ----
  		}
  		mptr = mptr->next;
  	}
+ #ifdef KANJI
+ 	width = FontWidth(hw->html.plain_font);
+ 	lwidth = FontWidth(hw->html.listing_font);
+ #else
  	width = pwidth * hw->html.plain_font->max_bounds.width;
  	lwidth = lwidth * hw->html.listing_font->max_bounds.width;
+ #endif /* KANJI */
  	if (lwidth > width)
  	{
  		width = lwidth;
***************
*** 6210,6212 ****
--- 6372,6453 ----
  	return(width);
  }
  
+ #ifdef KANJI
+ int
+ FontWidth(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return ext->max_ink_extent.width;
+ }
+ 
+ int
+ FontLogicalWidth(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return ext->max_logical_extent.width;
+ }
+ 
+ int
+ FontHeight(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return ext->max_ink_extent.height;
+ }
+ 
+ int
+ FontLogicalHeight(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return ext->max_logical_extent.height;
+ }
+ 
+ int
+ FontAscent(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return -ext->max_ink_extent.y;
+ }
+ 
+ int
+ FontLogicalAscent(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return -ext->max_logical_extent.y;
+ }
+ 
+ int
+ FontDescent(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return ext->max_ink_extent.height + ext->max_ink_extent.y;
+ }
+ 
+ int
+ FontLogicalDescent(fs)
+      XFontSet fs;
+ {
+     XFontSetExtents *ext = XExtentsOfFontSet(fs);
+     return ext->max_logical_extent.height + ext->max_logical_extent.y;
+ }
+ 
+ 
+ 
+ TextExtents(fs, str, len, dir, ascent, descent, all)
+      XFontSet fs;
+      char *str;
+      int len, *dir, *ascent, *descent;
+      XCharStruct *all;
+ {
+     XRectangle logical, ink;
+     XmbTextExtents(fs, str, len, &ink, &logical);
+     all->width = logical.width;
+ }
+     
+ #endif /* KANJI */
*** libhtmlw/HTMLparse.c.orig	Fri May 20 10:08:16 1994
--- libhtmlw/HTMLparse.c	Fri May 20 10:08:39 1994
***************
*** 763,768 ****
--- 763,772 ----
  	struct mark_up *mark;
  	struct mark_up *list;
  	struct mark_up *current;
+ #ifdef KANJI
+ 	char *p, *q, *new_str;
+ 	int is_shift;
+ #endif /* KANJI */
  #ifdef TIMING
  gettimeofday(&Tv, &Tz);
  fprintf(stderr, "HTMLParse enter (%d.%d)\n", Tv.tv_sec, Tv.tv_usec);
***************
*** 780,785 ****
--- 784,810 ----
  		return(NULL);
  	}
  
+ #ifdef KANJI
+ 	p = str;
+ 	q = new_str = (char*)malloc(strlen(str) + 1);
+ 	is_shift = 0;
+ 	while (*p) {
+ 	    if (*p == '\033' && *(p + 1) == '$') {
+ 		is_shift = 1;
+ 		p += (*(p + 2) == '(' ? 4 : 3);
+ 	    } else if (*p == '\033' && *(p + 1) == '(') {
+ 		is_shift = 0;
+ 		p += 3;
+ 	    } else if (is_shift) {
+ 		*q++ = *p++ | 0x80;
+ 	    } else {
+ 		*q++ = *p++;
+ 	    }
+ 	}
+ 	*q = '\0';
+ 	str = new_str;
+ #endif /* KANJI */
+ 
  	list = NULL;
  	current = NULL;
  
***************
*** 939,944 ****
--- 964,972 ----
  gettimeofday(&Tv, &Tz);
  fprintf(stderr, "HTMLParse exit (%d.%d)\n", Tv.tv_sec, Tv.tv_usec);
  #endif
+ #ifdef KANJI
+ 	free(new_str);
+ #endif /* KANJI */
  	return(list);
  }
  
*** libhtmlw/Imakefile.orig	Fri May 20 10:08:17 1994
--- libhtmlw/Imakefile	Fri May 20 10:08:39 1994
***************
*** 1,6 ****
  #include <../Common.tmpl>
  
! DEFINES = -DISINDEX_SUBMIT $(XRELEASE) -DFAKE_EXPOSE -D_NO_PROTO
  
  HEADERS = HTML.h HTMLP.h HTMLamp.h
  
--- 1,7 ----
  #include <../Common.tmpl>
  
! DEFINES = -DISINDEX_SUBMIT $(XRELEASE) -DFAKE_EXPOSE -D_NO_PROTO \
! 	    $(KANJI_DEFINES)
  
  HEADERS = HTML.h HTMLP.h HTMLamp.h
  
*** src/Imakefile.orig	Fri May 20 10:08:17 1994
--- src/Imakefile	Fri May 20 10:08:39 1994
***************
*** 12,18 ****
  MPROFLIB = /local/misc/lib/libc_mp.a -ldl
  */
  
! DEFINES = $(MYFLAGS) $(XRELEASE) $(SOCKSFLAG) $(TERMFLAG)
  
  INCLUDES = -I../libhtmlw -I../mxw $(TERMINC)
  
--- 12,18 ----
  MPROFLIB = /local/misc/lib/libc_mp.a -ldl
  */
  
! DEFINES = $(MYFLAGS) $(XRELEASE) $(SOCKSFLAG) $(TERMFLAG) $(KANJI_DEFINES)
  
  INCLUDES = -I../libhtmlw -I../mxw $(TERMINC)
  
*** src/main.c.orig	Fri May 20 10:08:19 1994
--- src/main.c	Fri May 20 10:13:55 1994
***************
*** 72,77 ****
--- 72,99 ----
  #include "util.h"
  #include "conf.h"
  
+ #ifdef KANJI
+ #include <X11/Xlocale.h>
+ 
+ #ifdef SETLOCALE
+ char* setlocale(int type, const char* new)
+ {
+     static char locale[16] = "C";
+ 
+     if (new != NULL)
+         strcpy(locale, new);
+     return locale;
+ }
+ #endif /* SETLOCALE */
+ 
+ #if XRELEASE==5 && !defined(sgi) && !defined(XIMP)
+ #define EUC_LOCALE	"ja_JP.ujis"
+ #else
+ #define EUC_LOCALE	"ja_JP.EUC"
+ #endif
+ 
+ #endif /* KANJI */
+ 
  /*
   * convenience routines.  the ifdef is bogus.
   */
***************
*** 154,159 ****
--- 176,185 ----
  #define offset(field) XtOffset(HTMLRoot *, field)
  static XtResource       resource_list[] =
  {
+ #ifdef KANJI
+   { "locale", "xnlLanguage", XtRString, sizeof(char *),
+ 	offset(locale), XtRImmediate, EUC_LOCALE },
+ #endif /* KANJI */
    { "actionVerify", "ActionVerify", XtRBoolean, sizeof(Boolean),
  	offset(actionVerify), XtRString, "False" },
    { "contentFile", "ContentFile", XtRString, sizeof(char *),
***************
*** 363,368 ****
--- 389,399 ----
     * it is hidden away just to make main() smaller not because it is
     * a logical break or anything.  main was just too damn big.
     */
+ #ifdef KANJI
+   if(!setlocale (LC_CTYPE, root.locale))
+       fprintf(stderr, "Can't setlocale to %s\n", root.locale);
+ #endif /* KANJI */
+ 
    CreateWidgets(&root);
  
    XtRealizeWidget(root.toplevel);
*** src/widget.h.orig	Fri May 20 10:08:20 1994
--- src/widget.h	Fri May 20 10:08:40 1994
***************
*** 94,99 ****
--- 94,104 ----
    Boolean showTitle;
    Cursor left_ptr;
    Cursor watch;
+ #ifdef KANJI
+   char *locale;
+   char *ltnLocale;
+   char *wideLocale;
+ #endif /* KANJI */
  } HTMLRoot;
  
  /*
