===================================================================
RCS file: lwlib/RCS/xlwtabs.c,v
retrieving revision 1.1
diff -u -r1.1 lwlib/xlwtabs.c
--- lwlib/xlwtabs.c	1999/11/11 04:51:04	1.1
+++ lwlib/xlwtabs.c	1999/11/19 01:24:08
@@ -131,6 +131,10 @@
 	offset(selectInsensitive), XtRImmediate, (XtPointer) True},
   {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
 	offset(font), XtRString, (XtPointer) XtDefaultFont},
+#ifdef USE_XFONTSET
+  {XtNfontSet,  XtCFontSet, XtRFontSet, sizeof(XFontSet),
+     offset(fontset), XtRString, (XtPointer) "XtDefaultFontSet"},
+#endif
   {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension),
 	offset(internalWidth), XtRImmediate, (XtPointer)4 },
   {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension),
@@ -467,7 +471,73 @@
     newTw->manager.navigation_type = XmTAB_GROUP ;
     newTw->manager.traversal_on = True ;
 #endif
+
+#ifdef USE_XFONTSET
+    newTw->tabs.font_ascent = 0;
+    newTw->tabs.font_descent = 0;
+#endif
+}
+
+#ifdef USE_XFONTSET
+/* compute ascent and descent of font */
+static void TabsInitMb (TabsWidget tw)
+{
+  XFontStruct **fontstruct_list;
+  char **fontname_list;
+  XFontStruct *font;
+  int fontcount = XFontsOfFontSet (tw->tabs.fontset, &fontstruct_list,
+				       &fontname_list);
+  tw->tabs.font_ascent = 0;
+  tw->tabs.font_descent = 0;
+  while (--fontcount >= 0)
+    {
+      if (!(font = fontstruct_list[fontcount])) continue;
+      if (font->ascent > (int) tw->tabs.font_ascent)
+	tw->tabs.font_ascent = font->ascent;
+      if (font->descent > (int) tw->tabs.font_descent)
+	tw->tabs.font_descent = font->descent;
+    }
+}
+
+# ifdef MULE
+static char *
+convert_strdup (char *string)
+{
+  int i, j, latin_jis_flag = 0, len = strlen (string);
+  char *ret_val = (char*)xmalloc (len + 1);
+  for (i = 0, j = 0; i < len + 1; i++)
+    {
+      switch ((unsigned char)string [i])
+	{
+	case 0x90: /* LEADING_BYTE_JAPANESE_JISX0208_1978 */
+	case 0x92: /* LEADING_BYTE_JAPANESE_JISX0208 */
+	case 0x94: /* LEADING_BYTE_JAPANESE_JISX0212 */
+	  break;
+	case 0x89: /* LEADING_BYTE_KATAKANA_JISX0201 */
+	  ret_val [j] = 0x8e;
+	  j++;
+	  break;
+	case 0x8A: /* LEADING_BYTE_LATIN_JISX0201 */
+	  latin_jis_flag = 1;
+	  break;
+	default:
+	  if (latin_jis_flag)
+	    {
+	      ret_val [j] = (string [i] - 0x80);
+	      latin_jis_flag = 0;
+	    }
+	  else
+	    {
+	      ret_val [j] = string [i];
+	    }
+	  j ++;
+	  break;
+	}
+    }
+  return ret_val;
 }
+# endif /* MULE */
+#endif /* USE_XFONT_SET */
 
 
 	/* Init the constraint part of a new tab child.  Compute the
@@ -1435,10 +1505,32 @@
 		x+tab->tabs.lbm_x, y+tab->tabs.lbm_y) ;
 	  }
 
+#ifdef USE_XFONTSET
+	  if (lbl != NULL)
+	    {
+	      if (tw->tabs.fontset != NULL)
+		{
+		  char *reallabel = convert_strdup (lbl);
+		  if (!reallabel) reallabel = lbl;
+		  XmbDrawString (dpy, win, tw->tabs.fontset, gc,
+				 x+tab->tabs.l_x, y+tab->tabs.l_y,
+				 reallabel, strlen (reallabel));
+		  if (reallabel != lbl)
+		    xfree (reallabel);
+		}
+	    }
+	  else
+	    {
+	      XDrawString (dpy, win, gc,
+			   x+tab->tabs.l_x, y+tab->tabs.l_y,
+			   lbl, strlen (lbl)) ;
+	    }
+#else
 	  if( lbl != NULL && tw->tabs.font != NULL )
 	    XDrawString(dpy,win,gc,
-	      x+tab->tabs.l_x, y+tab->tabs.l_y,
-	      lbl, (int)strlen(lbl)) ;
+			x+tab->tabs.l_x, y+tab->tabs.l_y,
+			lbl, (int)strlen(lbl)) ;
+#endif
 	}
 
 	if( child == tw->tabs.hilight )
@@ -1608,6 +1700,9 @@
 	String		lbl = tab->tabs.label != NULL ?
 				tab->tabs.label : XtName(w) ;
 	XFontStruct	*font = tw->tabs.font ;
+#ifdef USE_XFONTSET
+	XFontSet        fontset = tw->tabs.fontset;
+#endif
 	int		iw = tw->tabs.internalWidth ;
 
 	tab->tabs.width = iw + SHADWID*2 ;
@@ -1620,6 +1715,32 @@
 	  tab->tabs.lbm_y = (tw->tabs.tab_height - tab->tabs.lbm_height)/2 ;
 	}
 
+#ifdef USE_XFONTSET
+	if (lbl != NULL)
+	  {
+	    if (fontset != NULL)
+	      {
+		XRectangle ri, rl;
+		char *reallabel = convert_strdup (lbl);
+		if (!reallabel) reallabel = lbl;
+		XmbTextExtents (fontset, reallabel, strlen (reallabel), &ri, &rl);
+		tab->tabs.width += rl.width + iw;
+		if (tw->tabs.font_ascent == 0 || tw->tabs.font_descent == 0)
+		  TabsInitMb (tw);
+		tab->tabs.l_y = (tw->tabs.tab_height
+				 + tw->tabs.font_ascent
+				 - tw->tabs.font_descent) / 2;
+		if (reallabel != lbl) xfree (reallabel);
+	      }
+	    else if (font != NULL)
+	      {
+		tab->tabs.width += XTextWidth( font, lbl, (int)strlen(lbl) ) + iw ;
+		tab->tabs.l_y = (tw->tabs.tab_height +
+				 tw->tabs.font->max_bounds.ascent -
+				 tw->tabs.font->max_bounds.descent)/2 ;
+	      }
+	  }
+#else
 	if( lbl != NULL && font != NULL )
 	{
 	  tab->tabs.width += XTextWidth( font, lbl, (int)strlen(lbl) ) + iw ;
@@ -1627,6 +1748,7 @@
 	 	 tw->tabs.font->max_bounds.ascent -
 		 tw->tabs.font->max_bounds.descent)/2 ;
 	}
+#endif
 }
 
 
===================================================================
RCS file: lwlib/RCS/xlwtabsP.h,v
retrieving revision 1.1
diff -u -r1.1 lwlib/xlwtabsP.h
--- lwlib/xlwtabsP.h	1999/11/11 04:55:23	1.1
+++ lwlib/xlwtabsP.h	1999/11/19 02:12:45
@@ -70,6 +70,10 @@
 typedef struct {
     /* resources */
     XFontStruct	*font ;
+#ifdef USE_XFONTSET
+    XFontSet fontset ;
+    Dimension font_ascent, font_descent;
+#endif
     Dimension   internalHeight, internalWidth ;
     Widget	topWidget ;
     XtCallbackList callbacks ;
