diff -urN 980416/README.i18n xclass/README.i18n
--- 980416/README.i18n	Thu Jan  1 09:00:00 1970
+++ xclass/README.i18n	Thu Apr 30 15:28:00 1998
@@ -0,0 +1,48 @@
+XClass95 i18n + XIM$BBP1~(B				98.4.8
+
+make$B$N<j=g(B
+
+	(1) $B%=!<%9$NF~<j(B
+	    $B8=:_$O(Bxclass-hc980331.tgz$B$KBP$9$k%Q%C%A$K$J$C$F$$$k(B
+	(2) $BE83+(B
+	(3) $B%Q%C%AEv$F(B
+	(4) configure
+	(5) make
+	    $BL$BP1~$N(Bclient$B$N(Bmake$B$O<:GT$7$^$9$,!"5$$K$7$J$$$G2<$5$$!#$^$?!"(B
+	  make$B$K<:GT$7$J$/$F$b@5>o$KF0$+$J$$(Bclient$B$b$"$j$^$9!#(B
+
+$BN10UE@(B
+
+	$B!&(Bi18n$B$G;H$&$K$O!"4D6-JQ?t(BLANG$B$r@_Dj$9$kI,MW$,$"$k(B
+	$B!&(BXIM$B$r;H$&$K$O!"4D6-JQ?t(BXMODIFIERS$B$r@_Dj$9$kI,MW$,$"$k(B
+	$B!&(Bclient$B$N(BMakefile$B$O%i%$%V%i%j$^$G$O8+$F$J$$$N$G!"(Blib/libxclass$B$r$$$8$C(B
+	  $B$?8e$O%P%$%J%j$r:o=|$7$F$+$i(Bmake$B$9$kI,MW$,$"$k(B
+	$B!&F1MM$K%X%C%@%U%!%$%k$b8+$F$J$$$N$G!"(Binclude/xclass$B$r$$$8$C$?8e$O%3%s(B
+	  $B%Q%$%k$+$i$d$jD>$7$?J}$,$$$$>l9g$,B?$$(B
+	$B!&$=$l$>$l$N%G%#%l%/%H%j$N(BMakefile$B$O>e0L$N(BMakefile$B$+$i4D6-$r0z$-7Q$$$G(B
+	  $B$$$J$$!#$@$+$iC1FH$G(Bmake$B$7$F$b@5>o$KF0:n$9$k(B
+
+i18n$B$G$d$C$?:n6H(B
+
+	$B!&(BXFontStruct -> XFontSet -> OFont
+	$B!&",$K$^$D$o$k=t!9(B
+	$B!&%G%U%)%k%H$G;H$&%U%)%s%H$NJQ99(B
+	$B!&(Bfont metrix$B$N=hM}$N2~NI(B
+	$B!&(Bnotepad$B0J30$N(Bclient$B$N(Bi18n$B2=(B
+
+i18n$B$G$^$@$d$C$F$J$$:n6H(B
+
+	$B!&A45!G=$N%F%9%H(B
+
+i18n$B$K4X78$J$/2~NI$9$kE@(B
+
+	$B!&(Bnotepad$B$N%m%8%C%/$r%^%H%b$K$9$k(B
+	$B!&%3!<%IFb?o=j$K$"$k7h$aBG$A$r2?$H$+$9$k(B
+	$B!&(Bfont metrix$B$N=hM}$N2~NI(B($B$b$C$H%^%H%b$K$9$k(B)
+
+$B$d$C$?$i$$$$$H;W$&$3$H(B
+
+	$B!&%j%=!<%94IM}(B
+
+  $B%P%0Ey$NJs9p$O;d(B(ogochan@linux.or.jp)$B$^$G!#0BDj$7$?$H$3$m$GK\2H$NJ}(B
+$B$K(Bcontribute$B$9$kM=Dj$G$9!#(B
diff -urN 980416/clients/cdplay/Makefile.in xclass/clients/cdplay/Makefile.in
--- 980416/clients/cdplay/Makefile.in	Mon Mar 23 00:20:06 1998
+++ xclass/clients/cdplay/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/cdplay/main.cc xclass/clients/cdplay/main.cc
--- 980416/clients/cdplay/main.cc	Mon Jan 12 00:20:18 1998
+++ xclass/clients/cdplay/main.cc	Fri May  1 18:38:20 1998
@@ -145,19 +145,17 @@
 
 
   XGCValues gcv;
-  int mask = GCFont | GCForeground | GCBackground;
+  int mask = GCForeground | GCBackground;
 
   //--- Prepare the font for the Display
 
-  font = XLoadQueryFont(GetDisplay(),
-	"-adobe-utopia-medium-r-normal-*-24-*-*-*-*-*-iso8859-1");
+  font = new OFont(GetDisplay(),"-*-*medium-r-normal--14-*");
 
   if (font == NULL)
     FatalError("Unable to find font\n");
 
   gcv.foreground = _client->GetColorByName("cyan");
   gcv.background = _blackPixel;
-  gcv.font = font->fid;
 
   _gc = XCreateGC(GetDisplay(), _id, mask, &gcv);
 
diff -urN 980416/clients/cdplay/main.h xclass/clients/cdplay/main.h
--- 980416/clients/cdplay/main.h	Sun Jan 11 23:29:08 1998
+++ xclass/clients/cdplay/main.h	Thu Apr 30 15:28:00 1998
@@ -86,7 +86,7 @@
 
   int blink, ViewMode;
 
-  XFontStruct *font;
+  OFont *font ;
   GC _gc;
 
   OMedium *omedium;
diff -urN 980416/clients/cdplay/playlist.cc xclass/clients/cdplay/playlist.cc
--- 980416/clients/cdplay/playlist.cc	Thu Jan  8 01:42:03 1998
+++ xclass/clients/cdplay/playlist.cc	Thu Apr 30 15:28:00 1998
@@ -45,7 +45,7 @@
   driveframe = new OXCompositeFrame(this, 10, 10, HORIZONTAL_FRAME);
   drivelabel = new OXLabel(driveframe, new OString("Device:"));
   driveframe->AddFrame(drivelabel, centerleftlayout);
-  drive = new OXTextEntry(driveframe, drive_b = new OTextBuffer(100));
+  drive = new OXTextEntry(driveframe, drive_b = new OTextBuffer(100),0);
   drive->SetWidth(300);
   drive->ChangeOptions(FIXED_WIDTH | SUNKEN_FRAME | DOUBLE_BORDER);
   driveframe->AddFrame(drive, toprightlayout);
@@ -54,7 +54,7 @@
   authorframe = new OXCompositeFrame(this, 10, 10, HORIZONTAL_FRAME);
   authorlabel = new OXLabel(authorframe, new OString("Author:"));
   authorframe->AddFrame(authorlabel, centerleftlayout);
-  author = new OXTextEntry(authorframe, author_b = new OTextBuffer(100));
+  author = new OXTextEntry(authorframe, author_b = new OTextBuffer(100),0);
   author->SetWidth(300);
   author->ChangeOptions(FIXED_WIDTH | SUNKEN_FRAME | DOUBLE_BORDER);
   authorframe->AddFrame(author, toprightlayout);
@@ -62,7 +62,7 @@
   titleframe = new OXCompositeFrame(this, 10, 10, HORIZONTAL_FRAME);
   titlelabel = new OXLabel(titleframe, new OString("Title:"));
   titleframe->AddFrame(titlelabel, centerleftlayout);
-  title = new OXTextEntry(titleframe, title_b = new OTextBuffer(100));
+  title = new OXTextEntry(titleframe, title_b = new OTextBuffer(100),0);
   title->SetWidth(300);
   title->ChangeOptions(FIXED_WIDTH | SUNKEN_FRAME | DOUBLE_BORDER);
   titleframe->AddFrame(title, toprightlayout);
@@ -110,7 +110,7 @@
   tracktitleframe = new OXCompositeFrame(this, 10, 10, HORIZONTAL_FRAME);
   tracktitlelabel = new OXLabel(tracktitleframe, new OString("Track x   "));
   tracktitle = new OXTextEntry(tracktitleframe, 
-                               tracktitle_b = new OTextBuffer(100));
+                               tracktitle_b = new OTextBuffer(100),0);
   tracktitle->Associate(this);
   settitlebutton = new OXTextButton(tracktitleframe,
                               new OHotString(" Set Title "), B_OK);
diff -urN 980416/clients/desktop/Makefile.in xclass/clients/desktop/Makefile.in
--- 980416/clients/desktop/Makefile.in	Mon Mar 23 00:20:34 1998
+++ xclass/clients/desktop/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lXext -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/desktop/OXFolder.cc xclass/clients/desktop/OXFolder.cc
--- 980416/clients/desktop/OXFolder.cc	Fri Feb 27 23:19:47 1998
+++ xclass/clients/desktop/OXFolder.cc	Thu Apr 30 15:28:00 1998
@@ -40,7 +40,7 @@
 GC OXFolderLabel::_defaultGC;
 //GC OSelectedPicture::_selectedGC;
 GC OXFolderContainer::_lineGC;
-XFontStruct *OXFolderLabel::_defaultFontStruct;
+OFont *OXFolderLabel::_defaultFont;
 
 Cursor OXFolder::_defaultCursor;
 
@@ -66,28 +66,28 @@
 void OXFolderLabel::_DoRedraw() {
   XGCValues gcval;
   int tw, x, y;
+  int th;
   
-  tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
+  _font->Extents(_text->GetString(), _text->GetLength(), &tw, &th);
 
   // center text
 
   x = (GetWidth() - tw) >> 1;
-  y = ((GetHeight() - (_fontStruct->max_bounds.ascent +
-                       _fontStruct->max_bounds.descent)) >> 1);
+  y = ((GetHeight() - th) >> 1);
 
   if (_active) {
     SetBackgroundColor(_defaultSelectedBackground);
     XClearWindow(GetDisplay(), _id);
     gcval.foreground = _whitePixel;
     XChangeGC(GetDisplay(), _normGC, GCForeground, &gcval);
-    _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _text->Draw(GetDisplay(), _id, _font, _normGC, x, y + th);
   } else {
     SetBackgroundColor(_client->GetColorByName("turquoise4"));
     XClearWindow(GetDisplay(), _id);
 //    gcval.foreground = _blackPixel;
     gcval.foreground = _whitePixel;
     XChangeGC(GetDisplay(), _normGC, GCForeground, &gcval);
-    _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _text->Draw(GetDisplay(), _id, _font, _normGC, x, y + th);
   }
 }
 
diff -urN 980416/clients/desktop/OXFolder.h xclass/clients/desktop/OXFolder.h
--- 980416/clients/desktop/OXFolder.h	Wed Jan 28 22:57:14 1998
+++ xclass/clients/desktop/OXFolder.h	Thu Apr 30 15:28:00 1998
@@ -68,12 +68,12 @@
 class OXFolderLabel : public OXLabel {
 protected:
   static GC _defaultGC;
-  static XFontStruct *_defaultFontStruct;
+  static OFont *_defaultFont;
 
 public:
   OXFolderLabel(const OXWindow *p, OString *text,
                 GC norm = _defaultGC,
-                XFontStruct *font = _defaultFontStruct,
+                OFont *font = _defaultFont,
                 unsigned int options = VERTICAL_FRAME,
                 unsigned long back = _whitePixel) :
     OXLabel(p, text, norm, font, options, back) { _active = False; }
diff -urN 980416/clients/desktop/OXNewClient.cc xclass/clients/desktop/OXNewClient.cc
--- 980416/clients/desktop/OXNewClient.cc	Wed Jan 28 22:56:47 1998
+++ xclass/clients/desktop/OXNewClient.cc	Thu Apr 30 15:28:00 1998
@@ -35,15 +35,15 @@
   XGCValues gval;
   unsigned long gmask;
 
-  OXFolderLabel::_defaultFontStruct = XLoadQueryFont(_dpy, "-adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-1");
+  OXFolderLabel::_defaultFont = new OFont(_dpy, "-*-*medium-r-normal--14-*");
 
-  gmask = GCForeground | GCBackground | GCFont |
+  gmask = GCForeground | GCBackground |
           GCFillStyle | GCGraphicsExposures;
   gval.fill_style = FillSolid;
   gval.graphics_exposures = False;
   gval.foreground = _forecolor;
   gval.background = _backcolor;
-  gval.font = OXFolderLabel::_defaultFontStruct->fid;
+  //  gval.font = OXFolderLabel::_defaultFontStruct->fid;
   OXFolderLabel::_defaultGC = XCreateGC(_dpy, _Root->GetId(), gmask, &gval);
 
   gmask = GCForeground | GCBackground | GCFunction | GCFillStyle |
diff -urN 980416/clients/explorer/Makefile.in xclass/clients/explorer/Makefile.in
--- 980416/clients/explorer/Makefile.in	Mon Mar 23 00:20:47 1998
+++ xclass/clients/explorer/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/explorer/OXNewClient.cc xclass/clients/explorer/OXNewClient.cc
--- 980416/clients/explorer/OXNewClient.cc	Fri Apr 25 02:46:40 1997
+++ xclass/clients/explorer/OXNewClient.cc	Thu Apr 30 15:28:00 1998
@@ -32,15 +32,15 @@
   XGCValues gval;
   unsigned long gmask;
 
-  OXStatusBar::_defaultFontStruct = XLoadQueryFont(_dpy, "-adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-1");
+  OXStatusBar::_defaultFont = new OFont(_dpy, "-*-*-medium-r-normal--14-*");
 
-  gmask = GCForeground | GCBackground | GCFont |
+  gmask = GCForeground | GCBackground |
           GCFillStyle | GCGraphicsExposures;
   gval.fill_style = FillSolid;
   gval.graphics_exposures = False;
   gval.foreground = _forecolor;
   gval.background = _backcolor;
-  gval.font = OXStatusBar::_defaultFontStruct->fid;
+//  gval.font = OXStatusBar::_defaultFontStruct->fid;
   OXStatusBar::_defaultGC = XCreateGC(_dpy, _Root->GetId(), gmask, &gval);
 
 }
diff -urN 980416/clients/explorer/OXNewWidgets.cc xclass/clients/explorer/OXNewWidgets.cc
--- 980416/clients/explorer/OXNewWidgets.cc	Thu Jan  8 01:42:04 1998
+++ xclass/clients/explorer/OXNewWidgets.cc	Thu Apr 30 15:28:00 1998
@@ -26,7 +26,7 @@
 
 
 GC OXStatusBar::_defaultGC;
-XFontStruct *OXStatusBar::_defaultFontStruct;
+OFont *OXStatusBar::_defaultFont;
 
 
 //-------------------------------------------------------------------
@@ -34,30 +34,32 @@
 OXStatusBar::OXStatusBar(const OXWindow *p, int w, int h,
               unsigned int options, unsigned long back) :
   OXFrame(p, w, h, options, back) {
+	int ht;
 
     _bw = 2;
     _status_info = NULL;
 
-    int ht = _defaultFontStruct->max_bounds.ascent +
-             _defaultFontStruct->max_bounds.descent;
+    ht = _defaultFont->Height();
 
-    _yt = 2 + _defaultFontStruct->max_bounds.ascent;
+    _yt = ht;
 
     Resize(w, ht + 5);
 }
 
+#define	MSGW	200
+
 void OXStatusBar::DrawBorder() {
 
   //OXFrame::DrawBorder();
   if (_w > 170) {
-    XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, 150, 0);
+    XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, MSGW, 0);
     XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, 0, _h-2);
-    XDrawLine (GetDisplay(), _id, _hilightGC, 0, _h-1, 150, _h-1);
-    XDrawLine (GetDisplay(), _id, _hilightGC, 150, _h-1, 150, 0);
+    XDrawLine (GetDisplay(), _id, _hilightGC, 0, _h-1, MSGW, _h-1);
+    XDrawLine (GetDisplay(), _id, _hilightGC, MSGW, _h-1, MSGW, 0);
 
-    XDrawLine (GetDisplay(), _id, _shadowGC, 154, 0, _w-2, 0);
-    XDrawLine (GetDisplay(), _id, _shadowGC, 154, 0, 154, _h-2);
-    XDrawLine (GetDisplay(), _id, _hilightGC, 154, _h-1, _w-1, _h-1);
+    XDrawLine (GetDisplay(), _id, _shadowGC, MSGW+4, 0, _w-2, 0);
+    XDrawLine (GetDisplay(), _id, _shadowGC, MSGW+4, 0, MSGW+4, _h-2);
+    XDrawLine (GetDisplay(), _id, _hilightGC, MSGW+4, _h-1, _w-1, _h-1);
     XDrawLine (GetDisplay(), _id, _hilightGC, _w-1, _h-1, _w-1, 0);
   } else {
     XDrawLine (GetDisplay(), _id, _shadowGC, 0, 0, _w-2, 0);
diff -urN 980416/clients/explorer/OXNewWidgets.h xclass/clients/explorer/OXNewWidgets.h
--- 980416/clients/explorer/OXNewWidgets.h	Thu Jan  8 01:42:04 1998
+++ xclass/clients/explorer/OXNewWidgets.h	Thu Apr 30 15:28:00 1998
@@ -34,7 +34,7 @@
 class OXStatusBar : public OXFrame {
 protected:
   static GC _defaultGC;
-  static XFontStruct *_defaultFontStruct;
+  static OFont *_defaultFont;
 
 public:
   OXStatusBar(const OXWindow *p, int w, int h,
@@ -54,7 +54,7 @@
   virtual void _DoRedraw() {
     OXFrame::_DoRedraw();
     if (_status_info)
-      _status_info->Draw(GetDisplay(), _id, _defaultGC, 5, _yt);
+      _status_info->Draw(GetDisplay(), _id, _defaultFont, _defaultGC, 5, _yt);
   }
 
   OString *_status_info;
diff -urN 980416/clients/explorer/main.cc xclass/clients/explorer/main.cc
--- 980416/clients/explorer/main.cc	Wed Apr  8 22:58:06 1998
+++ xclass/clients/explorer/main.cc	Fri May  1 18:34:40 1998
@@ -430,7 +430,7 @@
 
   //-------------- status bar
 
-  _statusBar = new OXStatusBar(this, 60, 10);
+  _statusBar = new OXStatusBar(this, 80, 10);
 
   AddFrame(_statusBar, new OLayoutHints(LHINTS_BOTTOM | LHINTS_EXPAND_X,
 		 		        0, 0, 3, 0));
diff -urN 980416/clients/fileview/Makefile.in xclass/clients/fileview/Makefile.in
--- 980416/clients/fileview/Makefile.in	Mon Mar 23 00:20:55 1998
+++ xclass/clients/fileview/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/fileview/OXTextView.cc xclass/clients/fileview/OXTextView.cc
--- 980416/clients/fileview/OXTextView.cc	Sat May 10 01:37:38 1997
+++ xclass/clients/fileview/OXTextView.cc	Thu Apr 30 15:28:00 1998
@@ -8,19 +8,17 @@
                          unsigned int options, unsigned long back) :
   OXFrame(parent, x, y, options, back) {
     XGCValues gcv;
-    int mask = GCFont | GCForeground | GCBackground;
+    XRectangle ink, log;
+    int mask = GCForeground | GCBackground;
 
-    font = XLoadQueryFont(GetDisplay(),
-//           "-adobe-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
-           "8x13");
+    font = new OFont(GetDisplay(),"-*-*medium-r-normal--14-*");
 
-    _th = font->ascent + font->descent;
+    _th = font->Height();
 
     SetBackgroundColor(back);
 
     gcv.foreground = _client->GetColorByName("black");
     gcv.background = back;
-    gcv.font = font->fid;
 
     _gc = XCreateGC(GetDisplay(), _id, mask, &gcv);
 
@@ -76,7 +74,6 @@
   }
 
   fclose(fp);
-
   // Remember the number of lines, and initialize the current line
   // number to be 0.
 
@@ -108,7 +105,7 @@
   while (index < nlines && yloc < _h) {
     yloc += _th;
     if ((yloc - _th <= rect.y + rect.height) && (yloc >= rect.y))
-      XDrawImageString(GetDisplay(), _id, _gc, MARGIN, yloc - font->descent,
+      XmbDrawImageString(GetDisplay(), _id, font->FontSet(), _gc, MARGIN, yloc,
                        chars[index], lnlen[index]);
     ++index;
   }
diff -urN 980416/clients/fileview/OXTextView.h xclass/clients/fileview/OXTextView.h
--- 980416/clients/fileview/OXTextView.h	Sat May 10 01:37:30 1997
+++ xclass/clients/fileview/OXTextView.h	Thu Apr 30 15:28:00 1998
@@ -8,7 +8,7 @@
 #include <xclass/OXFrame.h>
 #include <xclass/OXWidgets.h>
 #include <xclass/OXScrollBar.h>
-
+#include <xclass/OFont.h>
 
 #define MAXLINESIZE 300
 #define MAXLINES    5000
@@ -17,7 +17,7 @@
 
 class OXTextFrame : public OXFrame {
 protected:
-  XFontStruct *font;
+  OFont *font;
   GC _gc;
 
 public:
diff -urN 980416/clients/fileview/test.doc xclass/clients/fileview/test.doc
--- 980416/clients/fileview/test.doc	Thu Jan  1 09:00:00 1970
+++ xclass/clients/fileview/test.doc	Thu Apr 30 15:28:00 1998
@@ -0,0 +1,3 @@
+EUC
+漢字入り
+日本語ファイル
diff -urN 980416/clients/gview/Makefile.in xclass/clients/gview/Makefile.in
--- 980416/clients/gview/Makefile.in	Sun Mar 29 23:45:39 1998
+++ xclass/clients/gview/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} @CXXFLAGS@ -DUSE_XIM
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/gview/OXDialogs.cc xclass/clients/gview/OXDialogs.cc
--- 980416/clients/gview/OXDialogs.cc	Tue Mar 31 02:46:30 1998
+++ xclass/clients/gview/OXDialogs.cc	Thu Apr 30 15:28:00 1998
@@ -147,7 +147,7 @@
     lprintCommand = new OXLabel(f3, new OHotString("Print &command:"));
     tbprintCommand = new OTextBuffer(20);
     tbprintCommand->AddText(0, *printProg);
-    printCommand = new OXTextEntry(f3, tbprintCommand);
+    printCommand = new OXTextEntry(f3, tbprintCommand,1);
     printCommand->Associate(this);
     printCommand->Resize(100, printCommand->GetDefaultHeight());
     L5 = new OLayoutHints(LHINTS_LEFT | LHINTS_CENTER_Y, 3, 5, 0, 0);
@@ -159,7 +159,7 @@
     lprinter = new OXLabel(f4, new OHotString("&Printer name:"));
     tbprinter = new OTextBuffer(20);
     tbprinter->AddText(0, *printerName);
-    printer = new OXTextEntry(f4, tbprinter); 
+    printer = new OXTextEntry(f4, tbprinter,1); 
     printer->Associate(this);
     printer->Resize(100, printer->GetDefaultHeight());
     f4->AddFrame(lprinter, L5);
diff -urN 980416/clients/gview/OXPageLBEntry.cc xclass/clients/gview/OXPageLBEntry.cc
--- 980416/clients/gview/OXPageLBEntry.cc	Mon Mar 30 00:51:44 1998
+++ xclass/clients/gview/OXPageLBEntry.cc	Thu Apr 30 15:28:00 1998
@@ -61,7 +61,7 @@
     XSetForeground(GetDisplay(), _normGC, _blackPixel);
   }
 
-  _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+  _text->Draw(GetDisplay(), _id, _font, _normGC , x, y + _font->Height() );
   if (_flags & PLBE_CHECKMARK) DrawCheckMark(_normGC);
   if (_flags & PLBE_RADIOMARK) DrawRCheckMark(_normGC);
 }
diff -urN 980416/clients/irc/Makefile.in xclass/clients/irc/Makefile.in
--- 980416/clients/irc/Makefile.in	Mon Mar 23 00:21:26 1998
+++ xclass/clients/irc/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/irc/OGC.cc xclass/clients/irc/OGC.cc
--- 980416/clients/irc/OGC.cc	Thu Jan 15 19:58:33 1998
+++ xclass/clients/irc/OGC.cc	Thu Apr 30 15:28:00 1998
@@ -6,14 +6,16 @@
 
 OGC::OGC(OXClient * c, char * color) {
   XGCValues gcv;
-  int mask = GCForeground | GCFont | GCFillStyle | GCGraphicsExposures;
+  int mask = GCForeground | GCFillStyle | GCGraphicsExposures;
 
   gcv.foreground = c->GetColorByName(color);
   gcv.fill_style = FillSolid;
   gcv.graphics_exposures = False;
-  gcv.font = (_font = XLoadQueryFont(c->GetDisplay(), "fixed"))->fid;
+//  gcv.font = (_font = XLoadQueryFont(c->GetDisplay(), "fixed"))->fid;
 
   _gc = XCreateGC(c->GetDisplay(), c->GetRoot()->GetId(), mask, &gcv);
+
+  _font = new OFont(c->GetDisplay(),"-*-*medium-r-normal--14-*");
 
   _color = new OString(color);
 }
diff -urN 980416/clients/irc/OGC.h xclass/clients/irc/OGC.h
--- 980416/clients/irc/OGC.h	Thu Jan 15 20:05:56 1998
+++ xclass/clients/irc/OGC.h	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
   OGC * _next;
   GC _gc;
-  XFontStruct * _font;
+  OFont * _font;
 
   const char * GetColor() {return(_color->GetString());}
 protected:
diff -urN 980416/clients/irc/OLineDoc.cc xclass/clients/irc/OLineDoc.cc
--- 980416/clients/irc/OLineDoc.cc	Thu Jan 15 20:22:01 1998
+++ xclass/clients/irc/OLineDoc.cc	Thu Apr 30 15:28:00 1998
@@ -52,7 +52,7 @@
   int  cnt;
   char c, *src;
   char line[MAXLINESIZE], *dst;
-  int lh = _gc->_font->ascent + _gc->_font->descent;
+  int lh = _gc->_font->Height();
 
   src = buf;
   dst = line;
@@ -69,10 +69,10 @@
     if (cnt++ >= MAXLINESIZE-1) break;
   }
   *dst = '\0';
-  chars = new char[strlen(line) + 1];
-  strcpy(chars, line);
+  chars = new wchar_t[strlen(line) + 1];
+  mbstowcs(chars,line,strlen(line));
   lnlen = strlen(chars);
-  _h = lh * (int)(lnlen / 80) + lh;
+  _h = ( lh * (int)lnlen ) / 80 + lh;
   _w = 80;
   return True;
 }
@@ -90,7 +90,7 @@
 void OLineDoc::Layout() {
   ll = ((_w = _style_server->GetDocWidth()) - (2 * MARGIN)) / 6;
   if (!ll) ll = 1;
-  _h = _gc->_font->ascent + _gc->_font->descent;
+  _h = _gc->_font->Height();
   _h *= (1 + (int)(lnlen / ll));
 }
 
@@ -98,11 +98,10 @@
                           int x, int y, XRectangle *rect) {
   int i;
   GC gc = _gc->_gc;
-  int ld = _gc->_font->ascent;
-  int lh = ld + _gc->_font->descent;
+  int lh = _gc->_font->Height();
 
   for(i = 0; i <= (int)(lnlen / ll); i++) {
-    XDrawString(dpy, d, gc, x + MARGIN, y + i*lh + ld,
+    XwcDrawString(dpy, d, _gc->_font->FontSet(),gc, x + MARGIN, y + i*(lh+1) + lh,
                 chars+i*ll, (lnlen<ll*(i+1)) ? lnlen-ll*i : ll);
   }
 }
diff -urN 980416/clients/irc/OLineDoc.h xclass/clients/irc/OLineDoc.h
--- 980416/clients/irc/OLineDoc.h	Thu Jan 15 20:22:17 1998
+++ xclass/clients/irc/OLineDoc.h	Thu Apr 30 15:28:00 1998
@@ -6,6 +6,7 @@
 
 #include "OViewDoc.h"
 #include "OGC.h"
+#include <xclass/Locale.h>
 
 #define MAXLINESIZE 8000
 #define MARGIN 3
@@ -40,7 +41,7 @@
 
 protected:
 
-  char *chars;   // line of text
+  wchar_t *chars;   // line of text
   int lnlen;     // length of line
 };
 
diff -urN 980416/clients/irc/OTextDoc.cc xclass/clients/irc/OTextDoc.cc
--- 980416/clients/irc/OTextDoc.cc	Thu Jan 15 20:14:34 1998
+++ xclass/clients/irc/OTextDoc.cc	Thu Apr 30 15:28:00 1998
@@ -89,7 +89,7 @@
                           int x, int y, XRectangle *rect) {
   OLineDoc * i;
   //GC gc = _gc->_gc;
-  int lh = _gc->_font->ascent + _gc->_font->descent;
+  int lh = _gc->_font->Height();
   int yloc = y;
 
   i = _lines;
diff -urN 980416/clients/irc/OXChannel.cc xclass/clients/irc/OXChannel.cc
--- 980416/clients/irc/OXChannel.cc	Fri Jan 16 00:57:47 1998
+++ xclass/clients/irc/OXChannel.cc	Thu Apr 30 15:28:00 1998
@@ -50,7 +50,7 @@
 
   AddFrame(_f, expandxexpandylayout);
 
-  _sayentry = new OXMyTextEntry(this, _say = new OTextBuffer(1000));
+  _sayentry = new OXTextEntry(this, _say = new OTextBuffer(1000),1);
   _sayentry->ChangeOptions(FIXED_WIDTH | SUNKEN_FRAME | DOUBLE_BORDER);
   AddFrame(_sayentry, topexpandxlayout);
 
diff -urN 980416/clients/irc/OXChannel.h xclass/clients/irc/OXChannel.h
--- 980416/clients/irc/OXChannel.h	Thu Jan 15 20:33:27 1998
+++ xclass/clients/irc/OXChannel.h	Thu Apr 30 15:28:00 1998
@@ -55,7 +55,7 @@
 
   OXCompositeFrame * _f;
 
-  OXMyTextEntry * _sayentry;
+  OXTextEntry * _sayentry;
   OTextBuffer * _say;
 
   OXChannel * _next;
diff -urN 980416/clients/irc/OXIrc.cc xclass/clients/irc/OXIrc.cc
--- 980416/clients/irc/OXIrc.cc	Thu Jan 15 20:24:22 1998
+++ xclass/clients/irc/OXIrc.cc	Thu Apr 30 15:28:00 1998
@@ -31,7 +31,7 @@
 
   SetLayoutManager(new OVerticalLayout(this));
 
-  _channelentry = new OXMyTextEntry(this, _channel = new OTextBuffer(100));
+  _channelentry = new OXTextEntry(this, _channel = new OTextBuffer(100),1);
   _channelentry->ChangeOptions(FIXED_WIDTH | SUNKEN_FRAME | DOUBLE_BORDER);
   AddFrame(_channelentry, topexpandxlayout);
 
diff -urN 980416/clients/irc/OXIrc.h xclass/clients/irc/OXIrc.h
--- 980416/clients/irc/OXIrc.h	Thu Jan 15 20:22:46 1998
+++ xclass/clients/irc/OXIrc.h	Thu Apr 30 15:28:00 1998
@@ -47,7 +47,7 @@
 protected:
   OTimer * _timer;
 
-  OXMyTextEntry * _channelentry;
+  OXTextEntry * _channelentry;
   OTextBuffer * _channel;
 
   OTextDoc * _log;
diff -urN 980416/clients/irc/OXMyTextEntry.cc xclass/clients/irc/OXMyTextEntry.cc
--- 980416/clients/irc/OXMyTextEntry.cc	Mon Jan 12 20:46:41 1998
+++ xclass/clients/irc/OXMyTextEntry.cc	Thu Apr 30 15:28:00 1998
@@ -97,7 +97,7 @@
                 _widgetID, keysym);
                 //_widgetID, 0L);
 
-  _cursor_x = 4 + XTextWidth(_fontStruct, _text->GetString(), _cursor_ix);
+  _cursor_x = 4 + _font->Width(_text->GetString(), _cursor_ix);
   _client->NeedRedraw(this);
   return True;
 }
diff -urN 980416/clients/irc/OXMyTextEntry.h xclass/clients/irc/OXMyTextEntry.h
--- 980416/clients/irc/OXMyTextEntry.h	Mon Jan 12 20:46:41 1998
+++ xclass/clients/irc/OXMyTextEntry.h	Thu Apr 30 15:28:00 1998
@@ -7,7 +7,7 @@
 class OXMyTextEntry : public OXTextEntry {
 public:
   OXMyTextEntry(const OXWindow *p, OTextBuffer *text) :
-      OXTextEntry(p, text) {}
+      OXTextEntry(p, text, 1) {}
 
   int HandleKey(XKeyEvent *event);
 };
diff -urN 980416/clients/irc/OXNameList.cc xclass/clients/irc/OXNameList.cc
--- 980416/clients/irc/OXNameList.cc	Mon Jan 12 20:46:41 1998
+++ xclass/clients/irc/OXNameList.cc	Thu Apr 30 15:28:00 1998
@@ -164,14 +164,13 @@
 //-----------------------------------------------------------------
 
 OXName::OXName(const OXWindow *p, OHotString *s, OXPopupMenu *menu, 
-	       GC norm, XFontStruct *font, unsigned int options) :
+	       GC norm, OFont *font, unsigned int options) :
   OXMenuTitle(p, s, menu, norm, font, options) {
   int tw;
 
-  tw = XTextWidth(_fontStruct, _label->GetString(), _label->GetLength());
+  tw = font->Width(_label->GetString(), _label->GetLength());
 
-  Resize(tw + 8, _fontStruct->max_bounds.ascent +
-                 _fontStruct->max_bounds.descent + 4);
+  Resize(tw + 8, font->Height() + 4);
 } 
 
 void OXName::SetState(int state) {
@@ -199,7 +198,7 @@
   const char * name = _label->GetString();
   int x, y;
 
-  x = (_w - XTextWidth(_fontStruct, name, strlen(name))) >> 1;
+  x = (_w - _font->Width(name, strlen(name))) >> 1;
   y = 2;
   if (_state) {
     _options |= SUNKEN_FRAME;
@@ -210,11 +209,11 @@
   }
   OXFrame::_DoRedraw();
   if (_state) {
-    _label->Draw(GetDisplay(), _id, _normGC,
-                 x+1, y + _fontStruct->max_bounds.ascent+1);
+    _label->Draw(GetDisplay(), _id, _font,_normGC, 
+                 x+1, y + _font->Height()+1);
   } else {
-    _label->Draw(GetDisplay(), _id, _normGC,
-                 x, y + _fontStruct->max_bounds.ascent);
+    _label->Draw(GetDisplay(), _id, _font,_normGC, 
+                 x, y + _font->Height());
   }
 }
 
diff -urN 980416/clients/irc/OXNameList.h xclass/clients/irc/OXNameList.h
--- 980416/clients/irc/OXNameList.h	Mon Jan 12 20:46:41 1998
+++ xclass/clients/irc/OXNameList.h	Thu Apr 30 15:28:00 1998
@@ -16,7 +16,7 @@
 public:
   OXName(const OXWindow *p, OHotString *s, OXPopupMenu *menu, 
 	      GC norm = _defaultGC,
-	      XFontStruct *font = _defaultFontStruct,
+	      OFont *font = _defaultFont,
 	      unsigned int options = 0);
 
   void SetState(int state);
diff -urN 980416/clients/login/Makefile.in xclass/clients/login/Makefile.in
--- 980416/clients/login/Makefile.in	Mon Mar 23 00:21:34 1998
+++ xclass/clients/login/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/login/main.cc xclass/clients/login/main.cc
--- 980416/clients/login/main.cc	Sun Jan 11 01:03:50 1998
+++ xclass/clients/login/main.cc	Thu Apr 30 15:28:00 1998
@@ -25,6 +25,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <xclass/Locale.h>
 #include <xclass/OXClient.h>
 #include <xclass/OXWindow.h>
 #include <xclass/OXFrame.h>
@@ -92,8 +93,8 @@
   userl   = new OXLabel(hframe1, new OHotString("&User Name:"));
   passl   = new OXLabel(hframe2, new OHotString("&Password:  "));
   lly     = new OLayoutHints(LHINTS_TOP | LHINTS_LEFT, 0, 0, 15, 15);
-  user    = new OXTextEntry(hframe1, new OTextBuffer(50));
-  passwd  = new OXTextEntry(hframe2, new OTextBuffer(50));
+  user    = new OXTextEntry(hframe1, new OTextBuffer(50),1);
+  passwd  = new OXTextEntry(hframe2, new OTextBuffer(50),1);
   pic     = clientX->GetPicture("login-key.xpm", login_key_xpm);
   icon1   = new OXIcon(this, pic, 48, 48);
   tly     = new OLayoutHints(LHINTS_TOP | LHINTS_LEFT | LHINTS_EXPAND_X, 0, 20, 0, 0);
diff -urN 980416/clients/paint/Makefile.in xclass/clients/paint/Makefile.in
--- 980416/clients/paint/Makefile.in	Mon Mar 23 00:22:20 1998
+++ xclass/clients/paint/Makefile.in	Thu Apr 30 15:28:00 1998
@@ -14,7 +14,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@ -DRGBF=${RGBF}
+CXXFLAGS=${INCLUDES} @CXXFLAGS@ -DRGBF=${RGBF} -DUSE_XIM
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/paint/OXDialogs.cc xclass/clients/paint/OXDialogs.cc
--- 980416/clients/paint/OXDialogs.cc	Fri Mar 13 01:16:28 1998
+++ xclass/clients/paint/OXDialogs.cc	Thu Apr 30 15:28:00 1998
@@ -62,11 +62,11 @@
     _widthLabel  = new OXLabel(_f2, new OHotString("&Width:"));
     _heightLabel = new OXLabel(_f2, new OHotString("&Height:"));
 
-    _widthTE = new OXTextEntry(_f2, _widthTB = new OTextBuffer(10));
+    _widthTE = new OXTextEntry(_f2, _widthTB = new OTextBuffer(10),1);
     _widthTE->Associate(this);
     _widthTE->Resize(60, _widthTE->GetDefaultHeight());
 
-    _heightTE = new OXTextEntry(_f2, _heightTB = new OTextBuffer(10));
+    _heightTE = new OXTextEntry(_f2, _heightTB = new OTextBuffer(10),1);
     _heightTE->Associate(this);
     _heightTE->Resize(60, _heightTE->GetDefaultHeight());
 
@@ -201,11 +201,11 @@
     _textLabel  = new OXLabel(_f2, new OHotString("&Text:"));
     _fontLabel = new OXLabel(_f2, new OHotString("&Font:"));
 
-    _textTE = new OXTextEntry(_f2, _textTB = new OTextBuffer(200));
+    _textTE = new OXTextEntry(_f2, _textTB = new OTextBuffer(200),1);
     _textTE->Associate(this);
     _textTE->Resize(200, _textTE->GetDefaultHeight());
 
-    _fontTE = new OXTextEntry(_f2, _fontTB = new OTextBuffer(200));
+    _fontTE = new OXTextEntry(_f2, _fontTB = new OTextBuffer(200),1);
     _fontTE->Associate(this);
     _fontTE->Resize(200, _fontTE->GetDefaultHeight());
 
diff -urN 980416/clients/paint/OXPaintCanvas.cc xclass/clients/paint/OXPaintCanvas.cc
--- 980416/clients/paint/OXPaintCanvas.cc	Wed Apr 15 18:30:51 1998
+++ xclass/clients/paint/OXPaintCanvas.cc	Thu Apr 30 15:28:01 1998
@@ -103,9 +103,9 @@
   _buffer_nextensions = 0;
 
   _text_string = NULL;
-  _font_struct = NULL;
+  _font = NULL;
 
-  SetFont(XLoadQueryFont(GetDisplay(), "fixed"));
+  SetFont("-*-*medium-r-normal--14-*");
   SetText("Text");
 
   _hot.x = _hot.y = NOT_SET;
@@ -1249,39 +1249,39 @@
             InWindowX(_image->width - 1), InWindowY(_image->height - 1));
 }
 
-void OXPaintCanvas::SetFont(XFontStruct *font_struct) {
-  _font_struct = font_struct;
+void OXPaintCanvas::SetFont(char *font_name) {
+  XRectangle rect;
 
-  if (_font_struct && _text_string) {
-    int         direction, ascent, descent;
-    XCharStruct size;
-
-    XTextExtents(_font_struct, _text_string, strlen(_text_string), 
-                 &direction, &ascent, &descent, &size);
-
-    _text_rbearing = size.rbearing;
-    _text_lbearing = size.lbearing;
-    _text_ascent   = size.ascent;
-    _text_descent  = size.descent;
+  if (_font != NULL ) delete _font;
+
+  _font = new OFont(GetDisplay(),font_name);
+  strcpy(_font_name,font_name);
+
+  if (_font && _text_string) {
+
+	_font->Extents(_text_string, strlen(_text_string),&rect);
+
+    _text_rbearing = rect.width;
+    _text_lbearing = 0;
+    _text_ascent   = rect.height;
+    _text_descent  = 0;
   }
 }
 
 void OXPaintCanvas::SetText(char *s) {
 
+  XRectangle rect;
   if (_text_string) delete[] _text_string;
   _text_string = _NewString(s);
 
-  if (_font_struct && _text_string) {
-    int          direction, ascent, descent;
-    XCharStruct  size;
-
-    XTextExtents(_font_struct, _text_string, strlen(_text_string), 
-                 &direction, &ascent, &descent, &size );
-
-    _text_rbearing = size.rbearing;
-    _text_lbearing = size.lbearing;
-    _text_ascent   = size.ascent;
-    _text_descent  = size.descent;
+  if (_font && _text_string) {
+
+	_font->Extents(_text_string, strlen(_text_string),&rect);
+
+    _text_rbearing = rect.width;
+    _text_lbearing = 0;
+    _text_ascent   = rect.height;
+    _text_descent  = 0;
   }
 }
 
@@ -2840,7 +2840,7 @@
   XGCValues  gcv;
   int        x, y, i, j, width, height;
 
-  if (!_text_string || ! _font_struct || strlen(_text_string) == 0)
+  if (!_text_string || ! _font || strlen(_text_string) == 0)
     return;
 
   // To draw text: 
@@ -2853,12 +2853,11 @@
 
   // create white pixmap size of text extent with depth one
   pixmap = XCreatePixmap(GetDisplay(), _id, width, height, 1);
-  gcv.font       = _font_struct->fid;
   gcv.function   = GXcopy;
   gcv.foreground = _whitePixel; //WhitePixel(dpy, _screen);
   gcv.background = _whitePixel; //WhitePixel(dpy, _screen);
   gc = XCreateGC(GetDisplay(), pixmap, 
-                 GCFunction | GCFont | GCForeground | GCBackground, 
+                 GCFunction | GCForeground | GCBackground, 
                  &gcv);
 
   // clear pixmap
@@ -2868,7 +2867,7 @@
   x = (_text_lbearing < 0) ? - _text_lbearing : 0;
   y = _text_ascent /* - 1 */; // include pad
   XSetForeground(GetDisplay(), gc, _blackPixel /*BlackPixel(dpy, _screen)*/);
-  XDrawString(GetDisplay(), pixmap, gc, x, y,
+  XmbDrawString(GetDisplay(), pixmap, _font->FontSet(), gc, x, y,
               _text_string, strlen(_text_string));
 
   // get image of text
diff -urN 980416/clients/paint/OXPaintCanvas.h xclass/clients/paint/OXPaintCanvas.h
--- 980416/clients/paint/OXPaintCanvas.h	Wed Mar 18 02:53:25 1998
+++ xclass/clients/paint/OXPaintCanvas.h	Thu Apr 30 15:28:01 1998
@@ -8,6 +8,7 @@
 #include <X11/xpm.h>
 
 #include <xclass/OXFrame.h>
+#include <xclass/OFont.h>
 
 #include "OColorTable.h"
 
@@ -148,9 +149,10 @@
   void    Refresh(int x, int y, int width, int height);
   void    SetGrid(int state);
   int     GridState() const { return _grid; }
-  void    SetFont(XFontStruct *font_struct);
+  void    SetFont(char *font_name);
   void    SetText(char *s);
   const char *GetText() const { return _text_string; }
+  const char *GetFontName() const { return _font_name; }
   int     IsStored() const { return (_storage != NULL); }
   void    SetChanged() { _changed = True; }
   void    ClearChanged() { _changed = False; }
@@ -266,7 +268,8 @@
   int          _nextensions, _buffer_nextensions;
   XpmExtension *_extensions, *_buffer_extensions;
 
-  XFontStruct *_font_struct;
+  OFont       *_font;
+  char        _font_name[256];
   char        *_text_string; 
   int         _text_lbearing, _text_rbearing;
   int         _text_ascent, _text_descent; 
diff -urN 980416/clients/paint/main.cc xclass/clients/paint/main.cc
--- 980416/clients/paint/main.cc	Fri Mar 13 01:24:03 1998
+++ xclass/clients/paint/main.cc	Thu Apr 30 15:28:01 1998
@@ -801,10 +801,11 @@
   char text[256], font[256];
 
   strcpy(text, _pcanvas->GetText());
-  strcpy(font, "-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
+  strcpy(font, _pcanvas->GetFontName());
 
   new OXTextDialog(_client->GetRoot(), this, 10, 10, 0, text, font);
   _pcanvas->SetText(text);
+  _pcanvas->SetFont(font);
 }
 
 
diff -urN 980416/clients/run/Makefile.in xclass/clients/run/Makefile.in
--- 980416/clients/run/Makefile.in	Mon Mar 23 00:22:29 1998
+++ xclass/clients/run/Makefile.in	Thu Apr 30 15:28:01 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -DUSE_XIM @CXXFLAGS@
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/run/main.cc xclass/clients/run/main.cc
--- 980416/clients/run/main.cc	Thu Jan 22 01:06:44 1998
+++ xclass/clients/run/main.cc	Thu Apr 30 15:28:01 1998
@@ -35,7 +35,7 @@
 class RunTextEntry : public OXTextEntry {
 public:
   RunTextEntry(const OXWindow * p, OTextBuffer * text, int ID) : 
-    OXTextEntry(p, text, ID) {} 
+    OXTextEntry(p, text, 0, ID) {} 
 
   virtual int HandleKey(XKeyEvent * event);
 };
diff -urN 980416/clients/test/Makefile.in xclass/clients/test/Makefile.in
--- 980416/clients/test/Makefile.in	Mon Mar 23 00:24:40 1998
+++ xclass/clients/test/Makefile.in	Thu Apr 30 15:28:01 1998
@@ -12,7 +12,7 @@
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} @CXXFLAGS@
+CXXFLAGS=${INCLUDES} @CXXFLAGS@ -DUSE_XIM
 LIBS=-L${top_srcdir}/lib/libxclass -lxclass ${x_libraries}
 EXTRALIBS=-lXpm -lX11
 LDFLAGS=@LDFLAGS@
diff -urN 980416/clients/test/wintest.cc xclass/clients/test/wintest.cc
--- 980416/clients/test/wintest.cc	Mon Jan 12 02:12:24 1998
+++ xclass/clients/test/wintest.cc	Thu Apr 30 15:28:01 1998
@@ -262,7 +262,7 @@
   _testButton->Associate(this);
   _statusFrame->AddFrame(_testButton, new OLayoutHints(LHINTS_TOP | LHINTS_LEFT,
                                                        2, 0, 2, 2));
-  _testText = new OXTextEntry(_statusFrame, new OTextBuffer(100));
+  _testText = new OXTextEntry(_statusFrame, new OTextBuffer(100),1);
   _testText->Resize(300, _testText->GetDefaultHeight());
   _statusFrame->AddFrame(_testText, new OLayoutHints(LHINTS_TOP | LHINTS_LEFT,
                                                      10, 2, 2, 2));
@@ -625,8 +625,8 @@
     ltitle = new OXLabel(f4, new OString("Title:"));
     lmsg   = new OXLabel(f5, new OString("Message:"));
 
-    title = new OXTextEntry(f4, tbtitle = new OTextBuffer(100));
-    msg   = new OXTextEntry(f5, tbmsg = new OTextBuffer(100));
+    title = new OXTextEntry(f4, tbtitle = new OTextBuffer(100),1);
+    msg   = new OXTextEntry(f5, tbmsg = new OTextBuffer(100),1);
 
     tbtitle->AddText(0, "MsgBox");
     tbmsg->AddText(0, "This is a test message box.");
@@ -761,8 +761,8 @@
 
     vframe1 = new OXVerticalFrame(this, 0, 0, 0);
 
-    teh1 = new OXTextEntry(vframe1, tbh1 = new OTextBuffer(10), HId1);
-    tev1 = new OXTextEntry(vframe1, tbv1 = new OTextBuffer(10), VId1);
+    teh1 = new OXTextEntry(vframe1, tbh1 = new OTextBuffer(10), HId1,1);
+    tev1 = new OXTextEntry(vframe1, tbv1 = new OTextBuffer(10), VId1,1);
     tbh1->AddText(0, "0");
     tbv1->AddText(0, "0");
 
@@ -780,8 +780,8 @@
     vframe1->Resize(100, 100);
  
     vframe2 = new OXVerticalFrame(this, 0, 0, 0);
-    teh2 = new OXTextEntry(vframe2, tbh2 = new OTextBuffer(10), HId2);
-    tev2 = new OXTextEntry(vframe2, tbv2 = new OTextBuffer(10), VId2);
+    teh2 = new OXTextEntry(vframe2, tbh2 = new OTextBuffer(10), HId2,1);
+    tev2 = new OXTextEntry(vframe2, tbv2 = new OTextBuffer(10), VId2,1);
     tbh2->AddText(0, "0");
     tbv2->AddText(0, "0");
 
diff -urN 980416/configure xclass/configure
--- 980416/configure	Mon Mar 23 00:35:21 1998
+++ xclass/configure	Thu Apr 30 15:28:01 1998
@@ -2003,6 +2003,7 @@
 	  clients/Makefile \
           clients/cdplay/Makefile \
           clients/clock/Makefile \
+          clients/teleapo/Makefile \
           clients/desktop/Makefile \
           clients/explorer/Makefile \
           clients/fileview/Makefile \
diff -urN 980416/configure.in xclass/configure.in
--- 980416/configure.in	Mon Mar 23 00:33:07 1998
+++ xclass/configure.in	Thu Apr 30 15:28:01 1998
@@ -84,6 +84,7 @@
 	  clients/Makefile \
           clients/cdplay/Makefile \
           clients/clock/Makefile \
+          clients/teleapo/Makefile \
           clients/desktop/Makefile \
           clients/explorer/Makefile \
           clients/fileview/Makefile \
diff -urN 980416/include/xclass/Locale.h xclass/include/xclass/Locale.h
--- 980416/include/xclass/Locale.h	Thu Jan  1 09:00:00 1970
+++ xclass/include/xclass/Locale.h	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,123 @@
+#define	X_LOCALE
+
+#ifdef X_LOCALE
+
+#include <stdlib.h>
+#if	0
+#include <wchar.h>
+#endif
+#include <X11/Xfuncproto.h>
+#include <X11/Xosdefs.h>
+#include <X11/Xlocale.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+_XFUNCPROTOBEGIN
+extern int _Xmblen (
+#if NeedFunctionPrototypes
+  const char *s, size_t n
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern int _Xmbtowc (
+#if NeedFunctionPrototypes
+  wchar_t *wstr, const char *str, size_t len
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern int _Xwctomb (
+#if NeedFunctionPrototypes
+  char *str, wchar_t wc
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern size_t _Xmbstowcs (
+#if NeedFunctionPrototypes
+  wchar_t *wstr, const char *str, size_t len
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern size_t _Xwcstombs (
+#if NeedFunctionPrototypes
+  char *str, const wchar_t *wstr, size_t len
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern size_t _Xwcslen (
+#if NeedFunctionPrototypes
+  const wchar_t *wstr
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern wchar_t* _Xwcscpy (
+#if NeedFunctionPrototypes
+  wchar_t *wstr1, const wchar_t *wstr2
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern wchar_t* _Xwcsncpy (
+#if NeedFunctionPrototypes
+  wchar_t *wstr1, const wchar_t *wstr2, size_t len
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern int _Xwcscmp (
+#if NeedFunctionPrototypes
+  const wchar_t *wstr1, const wchar_t *wstr2
+#endif
+);
+_XFUNCPROTOEND
+
+_XFUNCPROTOBEGIN
+extern int _Xwcsncmp (
+#if NeedFunctionPrototypes
+  const wchar_t *wstr1, const wchar_t *wstr2, size_t len
+#endif
+);
+_XFUNCPROTOEND
+
+/* 
+ * mblen, mbtowc, and mbstowcs of the locale "ja_JP.eucJP" are buggy.
+ */
+
+#if	0
+#ifdef MB_CUR_MAX
+# undef MB_CUR_MAX
+#endif
+#define MB_CUR_MAX 4
+#endif
+
+#define mblen _Xmblen
+#define mbtowc _Xmbtowc
+
+#define wctomb(a,b)	_Xwctomb ((a),(b))
+#define mbstowcs(a,b,c)	_Xmbstowcs ((a),(b),(c))
+#define wcstombs(a,b,c) _Xwcstombs ((a),(b),(c))
+#define wcslen(a)	_Xwcslen ((a))
+#define wcscpy(a,b)	_Xwcscpy ((a),(b))
+#define wcsncpy(a,b,c)	_Xwcsnpy ((a),(b),(c))
+
+#ifdef  __cplusplus
+}
+#endif
+#else
+#include <locale.h>
+#endif /* X_LOCALE */
diff -urN 980416/include/xclass/OFont.h xclass/include/xclass/OFont.h
--- 980416/include/xclass/OFont.h	Thu Jan  1 09:00:00 1970
+++ xclass/include/xclass/OFont.h	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,51 @@
+/**************************************************************************
+
+    This file is part of Xclass95, a Win95-looking GUI toolkit.
+    Copyright (C) 1996, 1997 David Barth, Hector Peraza.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+**************************************************************************/
+
+#ifndef __OFONT_H
+#define __OFONT_H
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <X11/Xlib.h>
+#include <xclass/Locale.h>
+
+class OFont {
+public:
+	OFont(Display *d,const char *name);
+	virtual	~OFont();
+	XFontSet	FontSet() const { return _font; }
+	virtual	int	Width(const char *s, const size_t len);
+	virtual	int	Width(const char *s);
+	virtual	int	Width(const wchar_t *s, const size_t len);
+	virtual	int	Height(const char *s, const size_t len);
+	virtual	int	Height(const char *s);
+	virtual	int	Height(const wchar_t *s, const size_t len);
+	virtual	int	Height();
+	virtual	Extents(const char *s, const size_t len, XRectangle *rect);
+	virtual	Extents(const char *s, const size_t len, int *x, int *y);
+
+protected:
+  XFontSet _font;
+  Display  *_dpy;
+};
+
+#endif  // __OFONT_H
diff -urN 980416/include/xclass/OPicture.h xclass/include/xclass/OPicture.h
--- 980416/include/xclass/OPicture.h	Fri Apr 10 18:00:00 1998
+++ xclass/include/xclass/OPicture.h	Thu Apr 30 15:28:01 1998
@@ -24,6 +24,7 @@
 
 #include <limits.h>
 #include <string.h>
+#include <stdio.h>
 
 #include <X11/Xlib.h>
 #include <X11/xpm.h>
diff -urN 980416/include/xclass/OString.h xclass/include/xclass/OString.h
--- 980416/include/xclass/OString.h	Fri Apr 18 03:25:01 1997
+++ xclass/include/xclass/OString.h	Thu Apr 30 15:28:01 1998
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include <X11/Xlib.h>
+#include <xclass/OFont.h>
 
 class OString {
 public:
@@ -45,10 +46,10 @@
   int GetLength() const { return _len; }
   const char *GetString() const { return _string; }
 
-  virtual void Draw(Display *dpy, XID id, GC gc, int x, int y);
+  virtual void Draw(Display *dpy, XID id, OFont *font, GC gc, int x, int y);
   virtual void DrawWrapped(Display *dpy, XID id, GC gc,
-                           int x, int y, int w, XFontStruct *font);
-  virtual int GetLines(XFontStruct *font, int w);
+                           int x, int y, int w, OFont *font);
+  virtual int GetLines(OFont *font, int w);
 
 protected:
   char *_string;
@@ -60,7 +61,7 @@
   OHotString(const char *s);
 
   int GetHotChar() const { return _hotchar; }
-  virtual void Draw(Display *dpy, XID id, GC gc, int x, int y);
+  virtual void Draw(Display *dpy, XID id, OFont *font, GC gc, int x, int y);
 
 protected:
   char _hotchar;
diff -urN 980416/include/xclass/OTextBuffer.h xclass/include/xclass/OTextBuffer.h
--- 980416/include/xclass/OTextBuffer.h	Tue Apr  1 17:17:24 1997
+++ xclass/include/xclass/OTextBuffer.h	Thu Apr 30 15:28:01 1998
@@ -23,31 +23,41 @@
 #define __OTEXTBUFFER_H
 
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 
 #include <X11/Xlib.h>
+#include <xclass/Locale.h>
 
+extern	size_t	strlen(const wchar_t *);
 
 class OTextBuffer {
 public:
   OTextBuffer()
-    { _buffer = NULL; _bfrlen = 0; }
-  OTextBuffer(unsigned length)
-    { _buffer = new char[_bfrlen = length]; *_buffer = '\0'; }
-  ~OTextBuffer()
-    { if (_buffer) delete[] _buffer; }
+    { _cbuffer = NULL; _wbuffer = NULL; _bfrlen = 0; }
+  OTextBuffer(unsigned length);
+  ~OTextBuffer()	{
+	  if (_cbuffer) delete[] _cbuffer;
+	  if (_wbuffer) delete[] _wbuffer;
+	}
 
-  unsigned GetTextLength() const { return strlen(_buffer); }
+  unsigned GetTextLength() const { return strlen(_wbuffer); }
   unsigned GetBufferLength() const { return _bfrlen; }
-  const char *GetString() const { return _buffer; }
+  const wchar_t *GetWString();
+  const char	*GetString();
 
+  void AddText(int pos, const wchar_t *text);
   void AddText(int pos, const char *text);
-  void AddText(int pos, const char *text, int length);
+  void AddText(int pos, const wchar_t *text, int length);
   void RemoveText(int pos, int length);
-  void Clear() { if (_buffer) *_buffer = '\0'; }
+  void Clear()	{
+	  if (_wbuffer) *_wbuffer = '\0';
+	  if (_cbuffer) *_cbuffer = '\0';
+  }
 
 protected:
-  char *_buffer;
+  wchar_t	*_wbuffer;
+  char		*_cbuffer;
   unsigned _bfrlen;
 };
 
diff -urN 980416/include/xclass/OXButton.h xclass/include/xclass/OXButton.h
--- 980416/include/xclass/OXButton.h	Sun Jan 11 01:41:18 1998
+++ xclass/include/xclass/OXButton.h	Thu Apr 30 15:28:01 1998
@@ -79,12 +79,12 @@
 
 class OXTextButton : public OXButton {
 protected:
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
 
 public:
   OXTextButton(const OXWindow *p, OHotString *s, int ID,
-           GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
+           GC norm = _defaultGC, OFont *font = _defaultFont,
            unsigned int option = RAISED_FRAME | DOUBLE_BORDER);
   virtual ~OXTextButton();
 
@@ -118,13 +118,13 @@
 
 class OXCheckButton : public OXButton {
 protected:
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
   static GC _defaultGC;
 
 public:
   OXCheckButton(const OXWindow *p, OHotString *s, int ID,
-                GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
+                GC norm = _defaultGC, OFont *font = _defaultFont,
                 unsigned int option = 0);
   virtual ~OXCheckButton();
 
@@ -146,13 +146,13 @@
 class OXRadioButton : public OXButton {
 protected:
   static const OPicture *_on, *_off;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
   static GC _defaultGC;
 
 public:
   OXRadioButton(const OXWindow *p, OHotString *s, int ID,
-                GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
+                GC norm = _defaultGC, OFont *font = _defaultFont,
                 unsigned int option = 0);
   virtual ~OXRadioButton();
 
diff -urN 980416/include/xclass/OXFSDDListBox.h xclass/include/xclass/OXFSDDListBox.h
--- 980416/include/xclass/OXFSDDListBox.h	Wed Apr  8 22:56:07 1998
+++ xclass/include/xclass/OXFSDDListBox.h	Thu Apr 30 15:28:01 1998
@@ -49,13 +49,13 @@
   static unsigned long _selPixel;
   static GC _defaultGC;
   GC _normGC;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
 
 public:
   OXTreeLBEntry(const OXWindow *p,
             OString *text, const OPicture *pic, int ID, OString *path = NULL,
-            GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
+            GC norm = _defaultGC, OFont *font = _defaultFont,
             unsigned int options = HORIZONTAL_FRAME,
             unsigned long back = _whitePixel);
   virtual ~OXTreeLBEntry();
diff -urN 980416/include/xclass/OXListView.h xclass/include/xclass/OXListView.h
--- 980416/include/xclass/OXListView.h	Sat May 10 01:31:44 1997
+++ xclass/include/xclass/OXListView.h	Thu Apr 30 15:28:01 1998
@@ -58,9 +58,9 @@
 protected:
   static unsigned int _selPixel;
   static GC _defaultGC;
-  static XFontStruct *_defaultFontStruct;
+  static OFont *_defaultFont;
   GC _normGC;
-  XFontStruct *_fontStruct;
+  OFont *_font;
 
 public:
   OXListItem(const OXWindow *p,
@@ -144,7 +144,7 @@
 class OXListView : public OXCanvas {
 protected:
   static GC _defaultGC;
-  static XFontStruct *_defaultFontStruct;
+  static OFont *_defaultFont;
 
 public:
   OXListView(const OXWindow *p, int w, int h,
diff -urN 980416/include/xclass/OXMenu.h xclass/include/xclass/OXMenu.h
--- 980416/include/xclass/OXMenu.h	Tue Apr 14 18:35:46 1998
+++ xclass/include/xclass/OXMenu.h	Thu Apr 30 15:28:01 1998
@@ -28,6 +28,7 @@
 #include <xclass/OString.h>
 #include <xclass/OTextBuffer.h>
 #include <xclass/OPicture.h>
+#include <xclass/OFont.h>
 
 
 //--- Menu entry status mask
@@ -72,8 +73,8 @@
 class OXPopupMenu : public OXFrame {
 protected:
   static GC _defaultGC, _defaultSelectedGC, _defaultSelectedBackgroundGC;
-  static XFontStruct *_defaultFontStruct;
-  static XFontStruct *_hilightFontStruct;
+  static OFont *_defaultFont;
+  static OFont *_hilightFont;
   static Cursor _defaultCursor;
 
 public:
@@ -118,26 +119,27 @@
 
   OMenuEntry *_elist, *_current;
   GC _normGC, _selGC, _selbackGC;
-  XFontStruct *_fontStruct;
-  XFontStruct *_hifontStruct;
+  OFont *_font;
+  OFont *_hifont;
   const OXWindow *_msgWindow;
   int _stick;
   int _hasgrab;
-  int _xl, _w, _h;
+  int _xl, _w, _h, _th;
   OTimer *_delay;
 };
 
 class OXMenuTitle : public OXFrame {
 protected:
   static GC _defaultGC, _defaultSelectedGC, _defaultSelectedBackgroundGC;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
   GC _normGC, _selGC, _selbackGC;
+  int _th;
 
 public:
   OXMenuTitle(const OXWindow *p, OHotString *s, OXPopupMenu *menu, 
 	      GC norm = _defaultGC,
-	      XFontStruct *font = _defaultFontStruct,
+	      OFont *font = _defaultFont,
 	      unsigned int options = 0);
 
   virtual void SetState(int state);
diff -urN 980416/include/xclass/OXTab.h xclass/include/xclass/OXTab.h
--- 980416/include/xclass/OXTab.h	Sat May 10 01:33:01 1997
+++ xclass/include/xclass/OXTab.h	Thu Apr 30 15:28:01 1998
@@ -31,7 +31,7 @@
 class OXTabElt : public OXFrame {
 public:
   OXTabElt(const OXWindow *p, OString *text, int w, int h,
-              GC norm, XFontStruct *font,
+              GC norm, OFont *font,
               unsigned int options = RAISED_FRAME,
               unsigned long back = _defaultFrameBackground);
   virtual ~OXTabElt();
@@ -43,7 +43,7 @@
 protected:
   OString *_text;
   GC _normGC;
-  XFontStruct *_fontStruct;
+  OFont *_font;
   int _tw, _th;
 };
 
@@ -60,14 +60,14 @@
 };
 
 class OXTab : public OXCompositeFrame {
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
   static GC _defaultGC;
   GC _normGC;
 
 public:
   OXTab(const OXWindow *p, int w, int h,
-        GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
+        GC norm = _defaultGC, OFont *fs = _defaultFont,
         unsigned int options = CHILD_FRAME,
         unsigned long back = _defaultFrameBackground);
   virtual ~OXTab();
diff -urN 980416/include/xclass/OXWidgets.h xclass/include/xclass/OXWidgets.h
--- 980416/include/xclass/OXWidgets.h	Tue Apr 14 18:03:22 1998
+++ xclass/include/xclass/OXWidgets.h	Thu Apr 30 15:28:01 1998
@@ -146,19 +146,19 @@
 class OXLabel : public OXFrame {
 protected:
   static GC _defaultGC;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
   GC _normGC;
 
 public:
   OXLabel(const OXWindow *p, OString *text,
           GC norm = _defaultGC,
-          XFontStruct *font = _defaultFontStruct,
+          OFont *font = _defaultFont,
           unsigned int options = CHILD_FRAME,
           unsigned long back = _defaultFrameBackground);
   OXLabel(const OXWindow *p, char *text,
           GC norm = _defaultGC,
-          XFontStruct *font = _defaultFontStruct,
+          OFont *font = _defaultFont,
           unsigned int options = CHILD_FRAME,
           unsigned long back = _defaultFrameBackground);
   virtual ~OXLabel();
@@ -186,13 +186,20 @@
   static GC _defaultGC;
   static GC _defaultSelectedGC, _defaultSelectedBackgroundGC;
   GC _normGC, _selGC, _selbackGC;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
+#ifdef	USE_XIM
+  XIC	_ic;
+#endif
 
 public:
-  OXTextEntry(const OXWindow *p, OTextBuffer *text, int ID = -1,
+  OXTextEntry(const OXWindow *p, OTextBuffer *text,
+#ifdef	USE_XIM
+			  int usexim = 0,
+#endif
+			  int ID = -1,
               GC norm = _defaultGC,
-	      XFontStruct *font = _defaultFontStruct,
+			  OFont *font = _defaultFont,
               unsigned int option = SUNKEN_FRAME | DOUBLE_BORDER,
               unsigned long back = _whitePixel);
   virtual ~OXTextEntry();
@@ -213,6 +220,13 @@
   virtual void _DoRedraw();
   int _GetCharacterIndex(int xcoord);
   void _PastePrimary(Window wid, Atom property, int Delete);
+  void	CurLeft(int n);
+  void	CurRight(int n);
+  void	CurHome();
+  void	CurEnd();
+  void	CharDelete(int n);
+  void	CharCut();
+  void	CharBackSpace(int n);
 
   OTextBuffer *_text;
   OTimer *_curblink;
@@ -220,6 +234,7 @@
   int _start_ix, _start_x, _end_ix, _end_x, _selection_on;
   // cursor
   int _cursor_x, _cursor_ix, _cursor_on;
+  int _th;
 };
 
 //-----------------------------------------------------------------
@@ -227,15 +242,15 @@
 class OXGroupFrame : public OXCompositeFrame {
 protected:
   static GC _defaultGC;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
   GC _normGC;
 
 public:
   OXGroupFrame(const OXWindow *p, OString *title,
                unsigned int options = VERTICAL_FRAME,
                GC norm = _defaultGC,
-               XFontStruct *font = _defaultFontStruct,
+               OFont *font = _defaultFont,
                unsigned long back = _defaultFrameBackground);
   virtual ~OXGroupFrame();
 
@@ -280,12 +295,12 @@
   static unsigned long _selPixel;
   static GC _defaultGC;
   GC _normGC;
-  static XFontStruct *_defaultFontStruct;
-  XFontStruct *_fontStruct;
+  static OFont *_defaultFont;
+  OFont *_font;
 
 public:
   OXTextLBEntry(const OXWindow *p, OString *s, int ID,
-                GC norm = _defaultGC, XFontStruct *font = _defaultFontStruct,
+                GC norm = _defaultGC, OFont *font = _defaultFont,
                 unsigned int options = HORIZONTAL_FRAME,
                 unsigned long back = _whitePixel);
   virtual ~OXTextLBEntry();
diff -urN 980416/include/xclass/utils.h xclass/include/xclass/utils.h
--- 980416/include/xclass/utils.h	Wed Apr 15 18:06:40 1998
+++ xclass/include/xclass/utils.h	Thu Apr 30 15:28:01 1998
@@ -19,6 +19,8 @@
 
 **************************************************************************/
 
+// #define	TRACE_MEM
+
 #ifndef __UTILS_H
 #define __UTILS_H
 
@@ -38,6 +40,12 @@
 
 void FatalError(const char *fmt, ...);
 void Debug(int level, const char *fmt, ...);
+#ifdef	TRACE_MEM
+void* operator new(size_t n);
+void* operator new[](size_t n);
+void operator delete(void *p);
+void operator delete[](void *p);
+#endif
 
 #if !defined(HAVE_STRERROR) || HAVE_STRERROR == 0
 char *strerror(int num);
diff -urN 980416/include/xclass/xim.h xclass/include/xclass/xim.h
--- 980416/include/xclass/xim.h	Thu Jan  1 09:00:00 1970
+++ xclass/include/xclass/xim.h	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,31 @@
+/**************************************************************************
+
+    This file is part of Xclass95, a Win95-looking GUI toolkit.
+    Copyright (C) 1996, 1997 David Barth, Hector Peraza.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+**************************************************************************/
+#ifndef	__XIM_H
+#define	__XIM_H
+#include	<X11/Xlib.h>
+extern	XIM			xim_im;
+extern	XIMStyle	xim_style;
+
+extern	XIMStyle	SelectInputStyle(XIM im);
+extern	void		BeginIM(Display *d);
+extern	XIC			CreateInputContext(XFontSet fs,Window p,int x,int y,int w, int h);
+extern	void		MoveInputPosition(XIC ic,int x,int y,int w,int h);
+#endif
diff -urN 980416/jp-doc/OLayoutHints.doc xclass/jp-doc/OLayoutHints.doc
--- 980416/jp-doc/OLayoutHints.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OLayoutHints.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,46 @@
+$B%/%i%9L>(B
+
+	OLayoutHints
+
+$B@bL@(B
+
+	$B%l%$%"%&%H%R%s%H>pJs(B
+
+
+$B%a%=%C%I(B
+
+	OLayoutHints - $B%l%$%"%&%H%R%s%H>pJs$r:n$k(B
+
+$B=q<0(B
+
+	#include <xclass/OLayout.h>  or
+	#include <xclass/OXFrame.h>  $BEy(B
+
+
+	OLayoutHints::OLayoutHints(
+		unsigned	long	hints = LHINTS_NORMAL,
+	    unsigned	int		padleft = 0,
+		unsigned	int		padright = 0, 
+	    unsigned	int		padtop = 0,
+		unsigned	int		padbottom = 0)
+
+$B@bL@(B
+
+	hints		$B%R%s%H;XDj(B
+		$B0J2<$NCM$NO@M}OB$GI=8=$5$l$k(B
+			LHINTS_NOHINTS			$B%R%s%H$J$7(B
+			LHINTS_LEFT				$B:84s$;(B
+			LHINTS_CENTER_X			$B#xJ}8~Cf1{(B
+			LHINTS_RIGHT			$B1&4s$;(B
+			LHINTS_TOP				$B>e4s$;(B
+			LHINTS_CENTER_Y			$B#yJ}8~Cf1{(B
+			LHINTS_BOTTOM			$B2<4s$;(B
+			LHINTS_EXPAND_X			$B#xJ}8~?-=L(B
+			LHINTS_EXPAND_Y			$B#yJ}8~?-=L(B
+		$B%G%U%)%k%H$O(B
+			LHINTS_NORMAL    		(LHINTS_LEFT | LHINTS_TOP)
+	padleft		$B:8$+$i(B
+	padright	$B1&$+$i(B
+	padtop		$B>e$+$i(B
+	padbottom	$B2<$+$i(B
+
diff -urN 980416/jp-doc/OXButton.doc xclass/jp-doc/OXButton.doc
--- 980416/jp-doc/OXButton.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OXButton.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,7 @@
+$B%/%i%9L>(B
+
+	OXButton
+
+$B@bL@(B
+
+	$B%\%?%s$rI=8=$9$kCj>]%/%i%9(B
diff -urN 980416/jp-doc/OXIcon.doc xclass/jp-doc/OXIcon.doc
--- 980416/jp-doc/OXIcon.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OXIcon.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,7 @@
+$B%/%i%9L>(B
+
+	OXIcon
+
+$B@bL@(B
+
+	pixmap$B$rJ];}$9$k%&%#%8%'%C%H(B
diff -urN 980416/jp-doc/OXLabel.doc xclass/jp-doc/OXLabel.doc
--- 980416/jp-doc/OXLabel.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OXLabel.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,7 @@
+$B%/%i%9L>(B
+
+	OXLabel
+
+$B@bL@(B
+
+	$B%i%Y%k(B($BJ8;zNs$rI=<($9$k$b$N(B)$B%&%#%8%'%C%H(B
diff -urN 980416/jp-doc/OXMainFrame.doc xclass/jp-doc/OXMainFrame.doc
--- 980416/jp-doc/OXMainFrame.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OXMainFrame.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,30 @@
+$B%/%i%9L>(B
+
+	OXMainFrame
+
+$B@bL@(B
+
+	$B%a%$%s$H$J$k%U%l!<%`(B
+
+$B%a%=%C%I(B
+
+	OXMainFrame - $B%a%$%s$H$J$k%U%l!<%`$r:n$k(B
+
+$B=q<0(B
+
+	#include <xclass/OXFrame.h>
+
+	OXMainFrame::OXMainFrame(
+		const	OXWindow	*p,
+		int		w,
+		int		h,
+		unsigned	long	options = MAIN_FRAME | VERTICAL_FRAME)
+
+$B@bL@(B
+
+	p			$B?F%&%#%s%I%&(B
+		$BDL>o$O(BclientX.GetRoot()
+	w			$BI}(B($B$I$&$b5/F0;~$NBg$-$5$i$7$$$,E,Ev$K3HBg$5$l$k(B)
+	h			$B9b$5(B($B$I$&$b5/F0;~$NBg$-$5$i$7$$$,E,Ev$K3HBg$5$l$k(B)
+	options
+
diff -urN 980416/jp-doc/OXTab.doc xclass/jp-doc/OXTab.doc
--- 980416/jp-doc/OXTab.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OXTab.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,58 @@
+$B%/%i%9L>(B
+
+	OXTab
+
+$B@bL@(B
+
+	$B%?%V%U%l!<%`(B($B8+=P$7IU$-%+!<%I$N$h$&$J$b$N(B)
+
+
+$B%a%=%C%I(B
+
+	OXTab - tab frame$B$r:n$k(B
+
+$B=q<0(B
+
+	#include <xclass/OXFrame.h>
+
+	OXTab::OXTab(
+		const OXWindow	*p,
+		int				w,	
+		int				h,
+		GC				norm,
+		XFontSet		fs,
+		unsigned int	options,
+		unsigned long	back)
+
+$B@bL@(B
+
+	p			$B?F%&%#%s%I%&(B
+	w			$BI}(B($B$I$&$bOH$NBg$-$5$i$7$$(B)
+	h			$B9b$5(B($B$I$&$bOH$NBg$-$5$i$7$$(B)
+	norm		$B2?$+$N(BGC($B;XDj$7$J$$$b$N$i$7$$(B)
+	fs			$B%?%V$NJ8;zNsMQ%U%)%s%H%;%C%H(B
+	options,	
+	back
+
+	$B%?%V$N9b$5$O!"(Bfs$B$NJ8;z9b(B+6 dot
+
+
+$B%a%=%C%I(B
+
+	AddTab - tab frame$B$N<B(Bframe$B$r:n$k(B
+
+$B=q<0(B
+
+	#include <xclass/OXFrame.h>
+
+	OXCompositeFrame *
+	OXTab::AddTab(
+		OString	*text)
+
+$B@bL@(B
+
+	text		$B%?%V$KI=<($9$kJ8;zNs(B
+
+$BI|5"CM(B
+
+	$B<B%U%l!<%`$rJV$9(B
diff -urN 980416/jp-doc/OXTextEntry.doc xclass/jp-doc/OXTextEntry.doc
--- 980416/jp-doc/OXTextEntry.doc	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/OXTextEntry.doc	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,7 @@
+$B%/%i%9L>(B
+
+	OXTextEntry
+
+$B@bL@(B
+
+	$BJ8;zNs$rF~NO$9$k$?$a$N%&%#%8%'%C%H(B
diff -urN 980416/jp-doc/hina xclass/jp-doc/hina
--- 980416/jp-doc/hina	Thu Jan  1 09:00:00 1970
+++ xclass/jp-doc/hina	Thu Apr 30 15:28:01 1998
@@ -0,0 +1,7 @@
+$B%/%i%9L>(B
+
+	OXIcon
+
+$B@bL@(B
+
+	pixmap$B$rJ];}$9$k%&%#%8%'%C%H(B
diff -urN 980416/lib/libxclass/Makefile.in xclass/lib/libxclass/Makefile.in
--- 980416/lib/libxclass/Makefile.in	Sat Apr 11 03:16:00 1998
+++ xclass/lib/libxclass/Makefile.in	Thu Apr 30 15:30:29 1998
@@ -8,12 +8,13 @@
 exec_prefix=@exec_prefix@
 lib_dir=@exec_prefix@/lib
 x_includes=@x_includes@
+icon_dir=@prefix@/xclass/icons
 
 lib_name=xclass
 
 CXX=@CXX@
 INCLUDES=-I${top_srcdir}/include ${x_includes}
-CXXFLAGS=${INCLUDES} -g -DOX_DEFAULT_POOL=\"/usr/local/xclass-icons\" @CXXFLAGS@
+CXXFLAGS=${INCLUDES} -g -DOX_DEFAULT_POOL=\"${icon_dir}\" -DUSE_XIM @CXXFLAGS@
 #CXXFLAGS=@CXXFLAGS@ -fPIC
 RANLIB=@RANLIB@
 AR=@AR@
@@ -33,6 +34,7 @@
 	ORowColumnLayout.cc \
 	OPicture.cc \
 	OString.cc \
+	OFont.cc \
 	OTextBuffer.cc \
 	OTimer.cc \
 	OXButton.cc \
@@ -56,7 +58,8 @@
 	OXTip.cc \
 	OXWidgets.cc \
 	OXWindow.cc \
-	utils.cc
+	utils.cc \
+	xim.cc
 
 OBJS=$(SRCS:.cc=.o)
 
diff -urN 980416/lib/libxclass/OFont.cc xclass/lib/libxclass/OFont.cc
--- 980416/lib/libxclass/OFont.cc	Thu Jan  1 09:00:00 1970
+++ xclass/lib/libxclass/OFont.cc	Fri May  1 18:33:45 1998
@@ -0,0 +1,102 @@
+/**************************************************************************
+
+    This file is part of Xclass95, a Win95-looking GUI toolkit.
+    Copyright (C) 1996, 1997 David Barth, Hector Peraza.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+**************************************************************************/
+
+#include <xclass/OFont.h>
+#include <xclass/utils.h>
+#include <xclass/Locale.h>
+
+//-----------------------------------------------------------------
+
+OFont::OFont(Display *d,const char *name) {
+  char **miss
+  ,		*def;
+  int	n_miss,i;
+
+  _font = XCreateFontSet(d,name,
+			&miss,&n_miss,&def);
+  if	(  n_miss  >  0  ) {
+	  for	( i = 0 ; i < n_miss ; i ++ ) {
+		  printf("miss %s\n",miss[i]);
+	  }
+  }
+  _dpy = d;
+}
+
+OFont::~OFont() {
+	XFreeFontSet(_dpy,_font);
+}
+
+int
+OFont::Width(const char *s, const size_t len) {
+	return	(XmbTextEscapement(_font,s,len));
+}
+
+int
+OFont::Width(const char *s) {
+	return	(Width(s,strlen(s)));
+}
+
+int
+OFont::Width(const wchar_t *s, const size_t len) {
+	return	(XwcTextEscapement(_font,s,len));
+}
+
+int
+OFont::Height(const char *s, const size_t len) {
+	XRectangle ink, log;
+
+	XmbTextExtents(_font, s, len, &ink, &log);
+	return	(log.height);
+}
+
+
+int
+OFont::Height(const char *s) {
+	return	(Height(s,strlen(s)));
+}
+
+int
+OFont::Height(void) {
+	return	(Height("{",1));
+}
+
+int
+OFont::Height(const wchar_t *s, const size_t len) {
+	XRectangle ink, log;
+
+	XwcTextExtents(_font, s, len, &ink, &log);
+	return	(log.height);
+}
+
+OFont::Extents(const char *s, const size_t len, XRectangle *rect) {
+    XRectangle ink;
+
+    XmbTextExtents(_font, s, len, &ink, rect);
+}
+
+OFont::Extents(const char *s, const size_t len, int *x, int *y) {
+    XRectangle ink, log;
+
+    XmbTextExtents(_font, s, len, &ink, &log);
+    *y = log.height;
+    *x = log.width;
+}
+
diff -urN 980416/lib/libxclass/OGC.cc xclass/lib/libxclass/OGC.cc
--- 980416/lib/libxclass/OGC.cc	Sat Apr 11 22:41:23 1998
+++ xclass/lib/libxclass/OGC.cc	Thu Apr 30 17:04:51 1998
@@ -191,9 +191,9 @@
       case GCTileStipYOrigin:
         match = (values->ts_y_origin == gcv->ts_y_origin);
         break;
-      case GCFont:
-        match = (values->font == gcv->font);
-        break;
+//      case GCFont:
+//        match = (values->font == gcv->font);
+//        break;
       case GCSubwindowMode:
         match = (values->subwindow_mode == gcv->subwindow_mode);
         break;
@@ -281,9 +281,9 @@
       case GCTileStipYOrigin:
         gcv->ts_y_origin = values->ts_y_origin;
         break;
-      case GCFont:
-        gcv->font = values->font;
-        break;
+//      case GCFont:
+//        gcv->font = values->font;
+//        break;
       case GCSubwindowMode:
         gcv->subwindow_mode = values->subwindow_mode;
         break;
diff -urN 980416/lib/libxclass/OPicture.cc xclass/lib/libxclass/OPicture.cc
--- 980416/lib/libxclass/OPicture.cc	Sat Apr 11 22:59:22 1998
+++ xclass/lib/libxclass/OPicture.cc	Fri May  1 18:35:52 1998
@@ -136,7 +136,7 @@
 const OPicture *OPicturePool::GetPicture(const char *name) {
   char tmp[MAXPATHLEN];
   SListPixmapElt *ptr, *nw;
-  
+
   for (ptr = _plist; ptr != NULL; ptr = ptr->next)
     if ((strcmp(name, (ptr->picture)->_name) == 0) && 
          !ptr->picture->_scaled) {
diff -urN 980416/lib/libxclass/OString.cc xclass/lib/libxclass/OString.cc
--- 980416/lib/libxclass/OString.cc	Wed Apr 15 18:14:48 1998
+++ xclass/lib/libxclass/OString.cc	Fri May  1 18:36:22 1998
@@ -25,36 +25,38 @@
 
 //-----------------------------------------------------------------
        
-void OString::Draw(Display *dpy, XID id, GC gc, int x, int y) {
-  XDrawString(dpy, id, gc, x, y, _string, _len);
+void OString::Draw(Display *dpy, XID id, OFont *font, GC gc, int x, int y) {
+  XmbDrawString(dpy, id, font->FontSet(), gc, x, y, _string, _len);
 }
 
 void OString::DrawWrapped(Display *dpy, XID id, GC gc,
-                          int x, int y, int w, XFontStruct *font) {
+                          int x, int y, int w, OFont *font) {
   char *p = _string, *prev = _string, *chunk = _string;
+  XRectangle ink, log;
   int tw, th;
 
-  tw = XTextWidth(font, _string, _len);
+  tw = font->Width(_string);
   if (tw <= w) {
-    XDrawString(dpy, id, gc, x, y, _string, _len);
+    XmbDrawString(dpy, id, font->FontSet(), gc, x, y, _string, _len);
     return;
   }
 
-  th = font->max_bounds.ascent + font->max_bounds.descent + 1;
+
+  th = font->Height(_string);
 
   while(1) {
     p = strchr(p, ' ');
     if (p == NULL) {
-      if (chunk) XDrawString(dpy, id, gc, x, y, chunk, strlen(chunk));
+      if (chunk) XmbDrawString(dpy, id, font->FontSet(), gc, x, y, chunk, strlen(chunk));
       break;
     }
-    tw = XTextWidth(font, chunk, p-chunk);
+    tw = font->Width(chunk, p-chunk);
     if (tw > w) {
       if (prev == chunk)
         prev = ++p;
       else
         p = prev;
-      XDrawString(dpy, id, gc, x, y, chunk, prev-chunk-1);
+      XmbDrawString(dpy, id, font->FontSet(), gc, x, y, chunk, prev-chunk-1);
       chunk = prev;
       y += th;
     } else {
@@ -63,19 +65,19 @@
   }
 }
 
-int OString::GetLines(XFontStruct *font, int w) {
+int OString::GetLines(OFont *font, int w) {
   char *p = _string, *prev = _string, *chunk = _string;
   int tw, nlines;
 
   nlines = 1;
 
-  tw = XTextWidth(font, _string, _len);
+  tw = font->Width(_string, _len);
   if (tw <= w) return nlines;
 
   while(1) {
     p = strchr(p, ' ');
     if (p == NULL) break;
-    tw = XTextWidth(font, chunk, p-chunk);
+    tw = font->Width(chunk, p-chunk);
     if (tw > w) {
       if (prev == chunk)
         chunk = prev = ++p;
@@ -117,23 +119,14 @@
   _len = strlen(_string);  // recompute length
 }
      
-void OHotString::Draw(Display *dpy, XID id, GC gc, int x, int y) {
-  
-  XDrawString(dpy, id, gc, x, y, _string, _len);
+void OHotString::Draw(Display *dpy, XID id, OFont *font, GC gc, int x, int y) {
+
+  XmbDrawString(dpy, id, font->FontSet(), gc, x, y, _string, _len);
   
   if (_hotpos > 0) {
-    if (_lastGC != gc) {
-      XGCValues gcval;
-      XFontStruct *font;
-
-      XGetGCValues(dpy, gc, GCFont, &gcval);
-      font = XQueryFont(dpy, gcval.font);   
-    
-      _off1 = XTextWidth(font, _string, _hotpos-1); //+1;
-      _off2 = XTextWidth(font, _string, _hotpos) -1;
+	  _off1 = font->Width(_string, _hotpos-1); //+1;
+	  _off2 = font->Width( _string, _hotpos) -1;
       _lastGC = gc;
-      XFreeFontInfo(NULL, font, 1);
-    }
-    XDrawLine(dpy, id, gc, x+_off1, y+1, x+_off2, y+1);
+	  XDrawLine(dpy, id, gc, x+_off1, y+1, x+_off2, y+1);
   }
 }  
diff -urN 980416/lib/libxclass/OTextBuffer.cc xclass/lib/libxclass/OTextBuffer.cc
--- 980416/lib/libxclass/OTextBuffer.cc	Wed Apr 15 18:14:53 1998
+++ xclass/lib/libxclass/OTextBuffer.cc	Thu Apr 30 18:09:25 1998
@@ -20,20 +20,59 @@
 **************************************************************************/
 
 #include <xclass/utils.h>
+#include <xclass/Locale.h>
 #include <xclass/OTextBuffer.h>
 
 
 //-----------------------------------------------------------------
 
-void OTextBuffer::AddText(int pos, const char *text) {
+extern	size_t
+strlen(
+	const	wchar_t	*s)
+{	size_t	len;
+
+	for	( len = 0 ; *s != 0 ; s ++, len ++ );
+	return	(len);
+}
+
+//-----------------------------------------------------------------
+
+OTextBuffer::OTextBuffer(unsigned length)	{
+	_bfrlen = length;
+	_wbuffer = new wchar_t[_bfrlen];
+	*_wbuffer = (wchar_t)'\0';
+	_cbuffer = new char[_bfrlen*MB_CUR_MAX];
+}
+
+void OTextBuffer::AddText(int pos, const wchar_t *text) {
   AddText(pos, text, strlen(text));
 }
 
-void OTextBuffer::AddText(int pos, const char *text, int length) {
+const char *OTextBuffer::GetString() {
+  wcstombs(_cbuffer,_wbuffer,_bfrlen);
+  return(_cbuffer);
+}
+
+const wchar_t *OTextBuffer::GetWString() {
+  return(_wbuffer);
+}
+
+void OTextBuffer::AddText(int pos, const char *text) {
+  wchar_t *buf;
+  size_t  len;
+
+  len = strlen(text);
+  buf = new wchar_t[len+1];
+  mbstowcs(buf,text,len+1);
+  AddText(pos, buf, len);
+  delete buf;
+}
+
+void OTextBuffer::AddText(int pos, const wchar_t *text, int length) {
   int  n, slen, tlen;
-  char *p1, *p2;
+  wchar_t *p1, *p2;
 
-  slen = strlen(_buffer);
+  slen = strlen(_wbuffer);
 
   if (pos < 0) pos = 0;
   if (pos > slen) pos = slen;
@@ -42,7 +81,7 @@
   //n = slen - pos + 2;  // amount of chars to move, including trailing zero
   n = slen - pos + 1;  // amount of chars to move, including trailing zero
 
-  p1 = _buffer + slen;
+  p1 = _wbuffer + slen;
   p2 = p1 + tlen;
 
   if (slen + tlen >= _bfrlen) {
@@ -57,29 +96,29 @@
   // make space for new text
   while (n-- > 0) *p2-- = *p1--;
 
-  p1 = _buffer + pos;
+  p1 = _wbuffer + pos;
   if (pos + tlen >= _bfrlen) tlen = _bfrlen - pos - 1;
 
   while (tlen-- > 0) *p1++ = *text++;
 
-  _buffer[_bfrlen-1] = 0;
+  _wbuffer[_bfrlen-1] = 0;
 }
 
 void OTextBuffer::RemoveText(int pos, int length) {
   int  slen;
-  char *p1, *p2;
+  wchar_t *p1, *p2;
 
-  slen = strlen(_buffer);
+  slen = strlen(_wbuffer);
 
   if (length <= 0) return;
   if ((pos >= _bfrlen) || (pos >= slen)) return;
 
   if (pos + length >= _bfrlen) {
-    _buffer[pos] = 0;
+    _wbuffer[pos] = 0;
     return;
   }
 
-  p1 = _buffer + pos;
+  p1 = _wbuffer + pos;
   p2 = p1 + length;
 
   do { *p1++ = *p2; } while (*p2++); // include trailing zero!
diff -urN 980416/lib/libxclass/OXButton.cc xclass/lib/libxclass/OXButton.cc
--- 980416/lib/libxclass/OXButton.cc	Wed Apr 15 18:15:06 1998
+++ xclass/lib/libxclass/OXButton.cc	Thu Apr 30 16:38:36 1998
@@ -23,6 +23,7 @@
 #include <xclass/OXWidgets.h>
 #include <xclass/OXClient.h>
 #include <xclass/OString.h>
+#include <xclass/OFont.h>
 
 #include <X11/cursorfont.h>
 #include <X11/keysym.h>
@@ -168,19 +169,18 @@
 //-----------------------------------------------------------------
 
 OXTextButton::OXTextButton(const OXWindow *p, OHotString *s, int ID,
-                   GC norm, XFontStruct *font, unsigned int options)
+                   GC norm, OFont *font, unsigned int options)
   : OXButton(p, ID, norm, options) {
     int hotchar;
 
     _widgetType = "OXTextButton";
 
     _label = s;
-    _fontStruct = font;
+    _font = font;
     _tmode = TEXT_CENTER_X | TEXT_CENTER_Y;
     _hkeycode = 0;
 
-    _tw = XTextWidth(_fontStruct, _label->GetString(), _label->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+    _font->Extents(_label->GetString(), _label->GetLength(), &_tw, &_th);
 
     Resize(_tw + 8, _th + 7);
 
@@ -206,8 +206,7 @@
   if (_label) delete _label;
   _label = new_label;
 
-  _tw = XTextWidth(_fontStruct, _label->GetString(), _label->GetLength());
-  _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+  _font->Extents( _label->GetString(), _label->GetLength(), &_tw, &_th);
 
 //  Resize(_tw + 8, _th + 7);
 
@@ -216,6 +215,7 @@
 
 void OXTextButton::_DoRedraw() {
   int x, y;
+  int off;
   
   OXFrame::_DoRedraw();
 
@@ -238,11 +238,12 @@
     XFillRectangle (GetDisplay(), _id, _hibckgndGC, 2, 2, _w-4, _h-4);
     XDrawLine (GetDisplay(), _id, _hilightGC, 2, 2, _w-3, 2);
   }
+  off = _th-2;
   if (_state == BUTTON_DISABLED) {
-    _label->Draw(GetDisplay(), _id, _hilightGC, x+1, y+1 + _fontStruct->max_bounds.ascent);
-    _label->Draw(GetDisplay(), _id, _shadowGC, x, y + _fontStruct->max_bounds.ascent);
+    _label->Draw(GetDisplay(), _id, _font, _hilightGC, x+1, y+1 + off);
+    _label->Draw(GetDisplay(), _id, _font, _shadowGC, x, y + off);
   } else {
-    _label->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _label->Draw(GetDisplay(), _id, _font, _normGC, x, y + off);
   }
 }
 
@@ -306,16 +307,15 @@
 //-----------------------------------------------------------------
 
 OXCheckButton::OXCheckButton(const OXWindow *p, OHotString *s, int ID,
-                             GC norm, XFontStruct *font, unsigned int option)
+                             GC norm, OFont *font, unsigned int option)
   : OXButton(p, ID, norm, option) {
 
     _widgetType = "OXCheckButton";
 
     _label = s;
-    _fontStruct = font;
+    _font = font;
 
-    _tw = XTextWidth(_fontStruct, _label->GetString(), _label->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+    _font->Extents(_label->GetString(), _label->GetLength(), &_tw, &_th);
 
     Resize(_tw + 22, _th + 2);
 
@@ -409,28 +409,26 @@
   y = 1;
 
   if (_state == BUTTON_DISABLED) {
-    _label->Draw(GetDisplay(), _id, _hilightGC, x+1, y+1 + _fontStruct->max_bounds.ascent);
-    _label->Draw(GetDisplay(), _id, _shadowGC, x, y + _fontStruct->max_bounds.ascent);
+    _label->Draw(GetDisplay(), _id, _defaultFont, _shadowGC, x, y + _th -2 );
   } else {
-    _label->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _label->Draw(GetDisplay(), _id, _defaultFont, _normGC, x, y + _th - 2);
   }
 }
 
 //-----------------------------------------------------------------
 
 OXRadioButton::OXRadioButton(const OXWindow *p, OHotString *s, int ID,
-                             GC norm, XFontStruct *font, unsigned int option)
+                             GC norm, OFont *font, unsigned int option)
   : OXButton(p, ID, norm, option) {
 
     _widgetType = "OXRadioButton";
 
     _label = s;
-    _fontStruct = font;
+    _font = font;
 
     if (!_on || !_off) FatalError("OXRadioButton: missing required pixmaps");
 
-    _tw = XTextWidth(_fontStruct, _label->GetString(), _label->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+    _font->Extents(_label->GetString(), _label->GetLength(), &_tw, &_th);
 
     Resize(_tw + 22, _th + 2);
 
@@ -492,7 +490,7 @@
   OXFrame::_DoRedraw();
 
   tx = 20;
-  nlines = _label->GetLines(_fontStruct, _w-tx-1);
+  nlines = _label->GetLines(_font, _w-tx-1);
   ty = (_h - _th*nlines) >> 1;
 
   pw = 12;
@@ -505,13 +503,11 @@
 
 //  ty = _fontStruct->max_bounds.ascent + 1;
 
-  ty += _fontStruct->max_bounds.ascent;
-
 //  _label->Draw(GetDisplay(), _id, _normGC, tx, ty);
   if (_state == BUTTON_DISABLED) {
-    _label->DrawWrapped(GetDisplay(), _id, _hilightGC, tx+1, ty+1, _w-tx-1, _fontStruct);
-    _label->DrawWrapped(GetDisplay(), _id, _shadowGC, tx, ty, _w-tx-1, _fontStruct);
+//    _label->DrawWrapped(GetDisplay(), _id, _hilightGC, tx+1, ty+1, _w-tx-1, _fontStruct);
+    _label->DrawWrapped(GetDisplay(), _id, _shadowGC, tx, ty + _th -2, _w-tx-1, _font);
   } else {
-    _label->DrawWrapped(GetDisplay(), _id, _normGC, tx, ty, _w-tx-1, _fontStruct);
+    _label->DrawWrapped(GetDisplay(), _id, _normGC, tx, ty + _th - 2, _w-tx-1, _font);
   }
 }
diff -urN 980416/lib/libxclass/OXClient.cc xclass/lib/libxclass/OXClient.cc
--- 980416/lib/libxclass/OXClient.cc	Wed Apr 15 18:28:48 1998
+++ xclass/lib/libxclass/OXClient.cc	Fri May  1 18:33:29 1998
@@ -30,6 +30,7 @@
 #include <X11/cursorfont.h>
 
 #include <xclass/utils.h>
+#include <xclass/Locale.h>
 #include <xclass/OXClient.h>
 #include <xclass/OXFrame.h>
 #include <xclass/OXWidgets.h>
@@ -41,6 +42,9 @@
 #include <xclass/OTimer.h>
 #include <xclass/OFileHandler.h>
 #include <xclass/OIniFile.h>
+#ifdef	USE_XIM
+#include <xclass/xim.h>
+#endif
 
 #include "icons/rbutton.on.xpm"
 #include "icons/rbutton.off.xpm"
@@ -85,13 +89,13 @@
 
 GC OXButton::_defaultGC;
 GC OXButton::_hibckgndGC;
-XFontStruct *OXTextButton::_defaultFontStruct;
+OFont *OXTextButton::_defaultFont;
 
 GC OXCheckButton::_defaultGC;
-XFontStruct *OXCheckButton::_defaultFontStruct;
+OFont *OXCheckButton::_defaultFont;
 
 GC OXRadioButton::_defaultGC;
-XFontStruct *OXRadioButton::_defaultFontStruct;
+OFont *OXRadioButton::_defaultFont;
 const OPicture *OXRadioButton::_on;
 const OPicture *OXRadioButton::_off;
 
@@ -107,18 +111,18 @@
 GC OXFrame::_bckgndGC;
 
 GC OXLabel::_defaultGC;
-XFontStruct *OXLabel::_defaultFontStruct;
+OFont *OXLabel::_defaultFont;
 
 GC OXMenuTitle::_defaultGC;
 GC OXMenuTitle::_defaultSelectedGC;
 GC OXMenuTitle::_defaultSelectedBackgroundGC;
-XFontStruct *OXMenuTitle::_defaultFontStruct;
+OFont *OXMenuTitle::_defaultFont;
 
 GC OXPopupMenu::_defaultGC;
 GC OXPopupMenu::_defaultSelectedGC;
 GC OXPopupMenu::_defaultSelectedBackgroundGC;
-XFontStruct *OXPopupMenu::_defaultFontStruct;
-XFontStruct *OXPopupMenu::_hilightFontStruct;
+OFont *OXPopupMenu::_defaultFont;
+OFont *OXPopupMenu::_hilightFont;
 Cursor OXPopupMenu::_defaultCursor;
 Cursor OXMenuBar::_defaultCursor;
 
@@ -130,20 +134,20 @@
 int OXScrollBar::_sb_width;
 
 GC OXTab::_defaultGC;
-XFontStruct *OXTab::_defaultFontStruct;
+OFont *OXTab::_defaultFont;
 
 GC OXTextEntry::_defaultGC;
 GC OXTextEntry::_defaultSelectedGC;
 GC OXTextEntry::_defaultSelectedBackgroundGC;
-XFontStruct *OXTextEntry::_defaultFontStruct;
+OFont *OXTextEntry::_defaultFont;
 Cursor OXTextEntry::_defaultCursor;
 
 GC OXGroupFrame::_defaultGC;
-XFontStruct *OXGroupFrame::_defaultFontStruct;
+OFont *OXGroupFrame::_defaultFont;
 
 unsigned long OXTextLBEntry::_selPixel;
 GC OXTextLBEntry::_defaultGC;            // this is not shared.
-XFontStruct *OXTextLBEntry::_defaultFontStruct;
+OFont *OXTextLBEntry::_defaultFont;
 
 Cursor OXDDPopup::_defaultCursor;
 
@@ -152,19 +156,17 @@
 GC OSelectedPicture::_selectedGC;
 GC OXListViewContainer::_lineGC;
 GC OXListView::_defaultGC;  
-XFontStruct *OXListView::_defaultFontStruct;
+OFont *OXListView::_defaultFont;
 
 unsigned int OXListItem::_selPixel;
 GC OXListItem::_defaultGC;
-XFontStruct *OXListItem::_defaultFontStruct;
+OFont *OXListItem::_defaultFont;
 
 unsigned long OXTreeLBEntry::_selPixel;
 GC OXTreeLBEntry::_defaultGC;            // this is not shared.
-XFontStruct *OXTreeLBEntry::_defaultFontStruct;
-
+OFont *OXTreeLBEntry::_defaultFont;
 
 //----------------------------------------------------------------
-
 OXClient::OXClient(const char *DpyName) {
   XGCValues gval;
   unsigned long gmask;
@@ -193,10 +195,16 @@
 
   OIniFile xcini(inirc, INI_READ);
 
-  strcpy(norm_font, "-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
-  strcpy(bold_font, "-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
-  strcpy(small_font, "-adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-1");
-  strcpy(prop_font, "-adobe-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
+  strcpy(norm_font, "-*-*-medium-r-normal--14-*");
+#if	1
+  strcpy(bold_font, "-*-*-medium-r-normal--14-*");
+  strcpy(small_font, "-*-*-medium-r-normal--14-*");
+  strcpy(prop_font, "-*-*-medium-r-normal--14-*");
+#else
+  strcpy(bold_font, "-*-*-bold-r-normal--14-*");
+  strcpy(small_font, "-*-*-medium-r-normal--12-*");
+  strcpy(prop_font, "-*-*-medium-r-*-*-10-*");
+#endif
   strcpy(backcolor, "#c0c0c0");
   strcpy(forecolor, "black");
   strcpy(selforecolor, "white");
@@ -223,12 +231,18 @@
 
   //--- Open the connection to the display
 
+  setlocale(LC_ALL,"");
+
   if (!(_dpy = XOpenDisplay(DpyName)))
     FatalError("Can't open display \"%s\"\n", XDisplayName(DpyName));
 
   _screen = DefaultScreen(_dpy);
   _depth = DefaultDepth(_dpy, _screen);
 
+#ifdef	USE_XIM
+  BeginIM(_dpy);
+#endif
+
   _x_fd = ConnectionNumber(_dpy);
 
   //--- Initialize internal lists
@@ -274,22 +288,20 @@
   //                          Currently applications would coredump if
   //                          any of these cannot be found.
 
-  OXLabel::_defaultFontStruct =
-  OXTab::_defaultFontStruct =
-  OXTextLBEntry::_defaultFontStruct =
-  OXTreeLBEntry::_defaultFontStruct =
-  OXGroupFrame::_defaultFontStruct =
-  OXTextEntry::_defaultFontStruct =
-  OXRadioButton::_defaultFontStruct =
-  OXCheckButton::_defaultFontStruct =
-  OXTextButton::_defaultFontStruct =
-  OXMenuTitle::_defaultFontStruct =
-  OXPopupMenu::_defaultFontStruct = XLoadQueryFont(_dpy, norm_font);
-  OXPopupMenu::_hilightFontStruct = XLoadQueryFont(_dpy, bold_font);
-
-  OXListView::_defaultFontStruct =
-  OXListItem::_defaultFontStruct = XLoadQueryFont(_dpy, small_font);
-
+  OXLabel::_defaultFont =
+  OXTab::_defaultFont =
+  OXTextLBEntry::_defaultFont =
+  OXTreeLBEntry::_defaultFont =
+  OXGroupFrame::_defaultFont =
+  OXTextEntry::_defaultFont =
+  OXRadioButton::_defaultFont =
+  OXCheckButton::_defaultFont =
+  OXTextButton::_defaultFont =
+  OXMenuTitle::_defaultFont =
+  OXPopupMenu::_defaultFont = new OFont(_dpy, norm_font);
+  OXPopupMenu::_hilightFont = new OFont(_dpy, bold_font);
+  OXListView::_defaultFont =
+  OXListItem::_defaultFont = new OFont(_dpy, small_font);
   _white = GetColorByName("white");
   _black = GetColorByName("black");
 
@@ -332,11 +344,16 @@
 
   //--- Default GCs and misc...
 
+#if	0
   gmask = GCForeground | GCBackground | GCFont |
           GCFillStyle | GCGraphicsExposures;
+#else
+  gmask = GCForeground | GCBackground |
+          GCFillStyle | GCGraphicsExposures;
+#endif
   gval.fill_style = FillSolid;
   gval.graphics_exposures = False;
-  gval.font = OXTextButton::_defaultFontStruct->fid;
+//  gval.font = OXTextButton::_defaultFontSet->fid;		ogochan
   gval.background = _backcolor;
 
   OXFrame::_blackPixel = gval.foreground = _black;
@@ -387,7 +404,7 @@
   OXPopupMenu::_defaultSelectedGC =
        XCreateGC(_dpy, _Root->GetId(), gmask, &gval);
 
-  gval.font = OXListItem::_defaultFontStruct->fid;
+//  gval.font = OXListItem::_defaultFontSet->fid;	ogochan
   gval.foreground = _forecolor;
   OXListItem::_defaultGC = XCreateGC(_dpy, _Root->GetId(), gmask, &gval);
   OXListView::_defaultGC = XCreateGC(_dpy, _Root->GetId(), gmask, &gval);
@@ -468,8 +485,8 @@
   delete _picturePool;
   delete _gcPool;
 
-  XFreeFont(_dpy, OXPopupMenu::_defaultFontStruct);
-  XFreeFont(_dpy, OXPopupMenu::_hilightFontStruct);
+  delete OXPopupMenu::_defaultFont;
+  delete OXPopupMenu::_hilightFont;
 
   XFreeGC(_dpy, OXPopupMenu::_defaultGC);
   XFreeGC(_dpy, OXButton::_defaultGC);
@@ -677,6 +694,9 @@
 
   if (XPending(_dpy)) {
     XNextEvent(_dpy, &Event);
+#ifdef	USE_XIM
+   if ( XFilterEvent(&Event,None) ) return True;
+#endif
     if (wid == None) {
       HandleEvent(&Event);
       return True;
@@ -743,6 +763,9 @@
     if ((nf > 0) || ((nf == -1) && (errno == EINTR))) {
       if (FD_ISSET(_x_fd, &readset)) {
         XNextEvent(_dpy, &Event);
+#ifdef	USE_XIM
+   if ( XFilterEvent(&Event,None) ) continue;
+#endif
         if (wid == None) {
           HandleEvent(&Event);
           return True;
diff -urN 980416/lib/libxclass/OXFSDDListBox.cc xclass/lib/libxclass/OXFSDDListBox.cc
--- 980416/lib/libxclass/OXFSDDListBox.cc	Wed Apr 15 18:15:27 1998
+++ xclass/lib/libxclass/OXFSDDListBox.cc	Thu Apr 30 15:28:01 1998
@@ -44,7 +44,7 @@
 
 OXTreeLBEntry::OXTreeLBEntry(const OXWindow *p,
       OString *text, const OPicture *pic, int ID, OString *path,
-      GC norm, XFontStruct *font, unsigned int options, unsigned long back) :
+      GC norm, OFont *font, unsigned int options, unsigned long back) :
   OXLBEntry(p, ID, options, back) {
 
   _pic = pic;
@@ -53,13 +53,11 @@
   _path = path;
 
   _normGC = norm;
-  _fontStruct = font;
+  _font = font;
 
   _active = False;
 
-  _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
-  _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
-
+  font->Extents(_text->GetString(), _text->GetLength(), &_tw, &_th);
 }
 
 OXTreeLBEntry::~OXTreeLBEntry() {
@@ -101,8 +99,8 @@
     XSetForeground(GetDisplay(), _normGC, _blackPixel);
   }
 
-  _text->Draw(GetDisplay(), _id, _normGC,
-              lx, ly + _fontStruct->max_bounds.ascent);
+  _text->Draw(GetDisplay(), _id, _font, _normGC,
+              lx, ly + _th);
 
 }
 
@@ -115,10 +113,11 @@
 
 void OXTreeLBEntry::UpdateEntry(OXLBEntry *e) {
   OXTreeLBEntry *te = (OXTreeLBEntry *) e;
+  XRectangle ink, log;
 
   _text = new OString(te->GetText());
   _pic = te->GetPicture();
-  _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
+  _tw = _font->Width(_text->GetString(), _text->GetLength());
   XClearWindow(GetDisplay(), _id);
   _client->NeedRedraw(this);
 }
diff -urN 980416/lib/libxclass/OXFileContainer.cc xclass/lib/libxclass/OXFileContainer.cc
--- 980416/lib/libxclass/OXFileContainer.cc	Wed Apr 15 18:15:35 1998
+++ xclass/lib/libxclass/OXFileContainer.cc	Thu Apr 30 15:28:01 1998
@@ -150,7 +150,7 @@
     for (i=0; _subnames[i] != NULL; ++i);
     _ctw = new int[i];
     for (i=0; _subnames[i] != NULL; ++i)
-      _ctw[i] = XTextWidth(_fontStruct, _subnames[i]->GetString(),
+      _ctw[i] = _font->Width(_subnames[i]->GetString(),
                                         _subnames[i]->GetLength());
 
 }
diff -urN 980416/lib/libxclass/OXFileDialog.cc xclass/lib/libxclass/OXFileDialog.cc
--- 980416/lib/libxclass/OXFileDialog.cc	Thu Apr 16 00:34:40 1998
+++ xclass/lib/libxclass/OXFileDialog.cc	Thu Apr 30 16:36:47 1998
@@ -26,6 +26,7 @@
 #include <sys/stat.h>
 
 #include <xclass/utils.h>
+#include <xclass/Locale.h>
 #include <xclass/OXMsgBox.h>
 #include <xclass/OXFileDialog.h>
 
diff -urN 980416/lib/libxclass/OXLabel.cc xclass/lib/libxclass/OXLabel.cc
--- 980416/lib/libxclass/OXLabel.cc	Wed Apr 15 18:15:59 1998
+++ xclass/lib/libxclass/OXLabel.cc	Thu Apr 30 16:31:53 1998
@@ -30,17 +30,17 @@
 
 //-----------------------------------------------------------------
 
-OXLabel::OXLabel(const OXWindow *p, OString *text, GC norm, XFontStruct *font,
-                 unsigned int options, unsigned long back) :
+OXLabel::OXLabel(const OXWindow *p, OString *text, GC norm, OFont *font,
+                   unsigned int options, unsigned long back) :
     OXFrame(p, 1, 1, options, back) {
 
     _text = text;
     _tmode = TEXT_CENTER_X | TEXT_CENTER_Y;
-    _fontStruct = font;
+    _font = font;
     _normGC = norm;
 
-    _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+    _tw = _font->Width(_text->GetString(), _text->GetLength());
+    _th = _font->Height();
     Resize(_tw, _th + 1);
 }
 
@@ -49,12 +49,12 @@
 }
 
 void OXLabel::SetText(OString *new_text) {
+  XRectangle ink, log;
 
   if (_text) delete _text;
   _text = new_text;
 
-  _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
-  _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+  _font->Extents(_text->GetString(), _text->GetLength(), &_tw, &_th);
 
 //  Resize(_tw, _th + 1);
 
@@ -63,6 +63,7 @@
 
 void OXLabel::_DoRedraw() {
   int x, y;
+  int off;
 
   OXFrame::_DoRedraw();
     
@@ -80,5 +81,6 @@
   else
     y = (_h - _th) >> 1;
 
-  _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+  off = _th-2;
+  _text->Draw(GetDisplay(), _id, _font, _normGC, x, y + off);
 }
diff -urN 980416/lib/libxclass/OXListBox.cc xclass/lib/libxclass/OXListBox.cc
--- 980416/lib/libxclass/OXListBox.cc	Wed Apr 15 18:16:06 1998
+++ xclass/lib/libxclass/OXListBox.cc	Thu Apr 30 16:35:41 1998
@@ -37,15 +37,14 @@
 //-----------------------------------------------------------------
 
 OXTextLBEntry::OXTextLBEntry(const OXWindow *p, OString *s, int ID,
-      GC norm, XFontStruct *font, unsigned int options, unsigned long back) :
+      GC norm, OFont *font, unsigned int options, unsigned long back) :
   OXLBEntry(p, ID, options, back) {
 
     _text = s;
-    _fontStruct = font;
+    _font = font;
     _normGC = norm;
 
-    _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+	_font->Extents(_text->GetString(), _text->GetLength(), &_tw, &_th);
     Resize(_tw, _th + 1);
 }
 
@@ -65,22 +64,22 @@
     SetBackgroundColor(_defaultSelectedBackground);
     XClearWindow(GetDisplay(), _id);
     XSetForeground(GetDisplay(), _normGC, _selPixel);
-    _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _text->Draw(GetDisplay(), _id, _font, _normGC, x, y + _th);
   } else {
     SetBackgroundColor(_bkcolor);
     XClearWindow(GetDisplay(), _id);
     XSetForeground(GetDisplay(), _normGC, _blackPixel);
-    _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _text->Draw(GetDisplay(), _id, _font, _normGC, x, y + _th);
   }
 }
 
 void OXTextLBEntry::SetText(OString *new_text) {
+  XRectangle ink, log;
 
   if (_text) delete _text;
   _text = new_text;
 
-  _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
-  _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+  _font->Extents(_text->GetString(), _text->GetLength(), &_tw, &_th);
 
   Resize(_tw, _th + 1);  //////
 
diff -urN 980416/lib/libxclass/OXListView.cc xclass/lib/libxclass/OXListView.cc
--- 980416/lib/libxclass/OXListView.cc	Wed Apr 15 18:16:13 1998
+++ xclass/lib/libxclass/OXListView.cc	Thu Apr 30 15:28:01 1998
@@ -88,6 +88,7 @@
                    OString *name, OString **subnames, int ViewMode,
                    unsigned int options, unsigned long back) :
   OXFrame(p, 10, 10, options, back) {
+	XRectangle ink, log;
     int i;
 
     _selpic = NULL;
@@ -105,16 +106,15 @@
     _active = False;
 
     _normGC = _defaultGC;
-    _fontStruct = _defaultFontStruct;
+    _font = _defaultFont;
 
-    _tw = XTextWidth(_fontStruct, _name->GetString(), _name->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
+	_font->Extents(_name->GetString(), _name->GetLength(), &_tw, &_th);
 
     if (_subnames) {
       for (i=0; _subnames[i] != NULL; ++i);
       _ctw = new int[i];
       for (i=0; _subnames[i] != NULL; ++i)
-       _ctw[i] = XTextWidth(_fontStruct, _subnames[i]->GetString(),
+       _ctw[i] = _font->Width(_subnames[i]->GetString(),
                                          _subnames[i]->GetLength());
     } else {
       _ctw = NULL;
@@ -194,8 +194,8 @@
     XSetForeground(GetDisplay(), _normGC, _blackPixel);
   }
 
-  _name->Draw(GetDisplay(), _id, _normGC,
-              lx, ly + _fontStruct->max_bounds.ascent);
+  _name->Draw(GetDisplay(), _id, _font, _normGC,
+              lx, ly + _th);
 
   XSetForeground(GetDisplay(), _normGC, _blackPixel);
 
@@ -210,8 +210,8 @@
           lx = (_cpos[i] + _cpos[i+1] - _ctw[i]) >> 1;
         else // default to TEXT_LEFT
           lx = _cpos[i] +2;
-        _subnames[i]->Draw(GetDisplay(), _id, _normGC,
-                           lx, ly + _fontStruct->max_bounds.ascent);
+        _subnames[i]->Draw(GetDisplay(), _id, _font, _normGC,
+                           lx, ly + _th);
       }
     }
   }
@@ -563,19 +563,19 @@
 
     // for test only...
     _col_header[0] = new OXTextButton(this, new OHotString("Name"),
-                     1, _defaultGC, _defaultFontStruct);
+                     1, _defaultGC, _defaultFont);
     _col_header[1] = new OXTextButton(this, new OHotString("Attributes"),
-                     3, _defaultGC, _defaultFontStruct);
+                     3, _defaultGC, _defaultFont);
     _col_header[2] = new OXTextButton(this, new OHotString("Size"),
-                     2, _defaultGC, _defaultFontStruct);
+                     2, _defaultGC, _defaultFont);
     _col_header[3] = new OXTextButton(this, new OHotString("Owner"),
-                     3, _defaultGC, _defaultFontStruct);
+                     3, _defaultGC, _defaultFont);
     _col_header[4] = new OXTextButton(this, new OHotString("Group"),
-                     3, _defaultGC, _defaultFontStruct);
+                     3, _defaultGC, _defaultFont);
     _col_header[5] = new OXTextButton(this, new OHotString("Modified"),
-                     3, _defaultGC, _defaultFontStruct);
+                     3, _defaultGC, _defaultFont);
     _col_header[6] = new OXTextButton(this, new OHotString(""),
-                     4, _defaultGC, _defaultFontStruct);
+                     4, _defaultGC, _defaultFont);
 
     _col_header[0]->SetTextJustify(TEXT_LEFT | TEXT_CENTER_Y);
     _col_header[1]->SetTextJustify(TEXT_CENTER_X | TEXT_CENTER_Y);
diff -urN 980416/lib/libxclass/OXMenu.cc xclass/lib/libxclass/OXMenu.cc
--- 980416/lib/libxclass/OXMenu.cc	Wed Apr 15 18:16:19 1998
+++ xclass/lib/libxclass/OXMenu.cc	Fri May  1 18:34:07 1998
@@ -225,8 +225,8 @@
     _normGC       = _defaultGC;
     _selGC        = _defaultSelectedGC;
     _selbackGC    = _defaultSelectedBackgroundGC;
-    _fontStruct   = _defaultFontStruct;
-    _hifontStruct = _hilightFontStruct;
+    _font   = _defaultFont;
+    _hifont = _hilightFont;
 
     _delay = NULL;
 
@@ -278,16 +278,14 @@
     _elist = nw;
   }
 
-  tw = XTextWidth(_hifontStruct, s->GetString(), s->GetLength());
+  _hifont->Extents(s->GetString(), s->GetLength(), &tw, &_th);
   if (p) {
     pw = p->GetWidth();
     if (pw+12 > _xl) { _w += pw+12-_xl; _xl = pw+12; }
   }
 
   _w = max(_w, tw + pw /*+8*/+18+12);
-  _h += _hifontStruct->max_bounds.ascent +
-        _hifontStruct->max_bounds.descent + 3;
-
+  _h += _th + 3;
   Resize(_w, _h);
 }
 
@@ -341,11 +339,9 @@
     _elist = nw;
   }
 
-  tw = XTextWidth(_hifontStruct, s->GetString(), s->GetLength());
-
+  _hifont->Extents(s->GetString(), s->GetLength(), &tw, &_th);
   _w = max(_w, tw +8+18+12);
-  _h += _hifontStruct->max_bounds.ascent +
-        _hifontStruct->max_bounds.descent + 3;
+  _h += _th + 3;
 
   Resize(_w, _h);
 }
@@ -401,23 +397,19 @@
     ptr->_ey = _h-2;
     switch (ptr->_type) {
       case MENU_ENTRY:
-        tw = XTextWidth(_hifontStruct, ptr->_label->GetString(),
-                                       ptr->_label->GetLength());
+        tw = _font->Width(ptr->_label->GetString(),ptr->_label->GetLength());
         if (ptr->_pic) {
           pw = ptr->_pic->GetWidth();
           if (pw+12 > _xl) { _w += pw+12-_xl; _xl = pw+12; }
         }
         _w = max(_w, tw + pw /*+8*/+18+12);
-        _h += _hifontStruct->max_bounds.ascent +
-              _hifontStruct->max_bounds.descent + 3;
+        _h += _font->Height() + 3;
         break;
 
       case MENU_POPUP:
-        tw = XTextWidth(_hifontStruct, ptr->_label->GetString(),
-                                       ptr->_label->GetLength());
+        tw = _font->Width(ptr->_label->GetString(),ptr->_label->GetLength());
         _w = max(_w, tw +8+18+12);
-        _h += _hifontStruct->max_bounds.ascent +
-              _hifontStruct->max_bounds.descent + 3;
+        _h += _font->Height() + 3;
         break;
 
       case MENU_SEPARATOR:
@@ -519,13 +511,13 @@
   if (event->type == EnterNotify) {
     OMenuEntry *ptr;
     int h;
+	XRectangle ink, log;
 
     for (ptr = _elist; ptr != NULL; ptr=ptr->next) {
       if (ptr->_type == MENU_SEPARATOR) {
         h = 4;
       } else {
-        h = _fontStruct->max_bounds.ascent +
-            _fontStruct->max_bounds.descent + 3;
+        h = _th + 3;
       }
       if ((event->x >= ptr->_ex) && (event->x <= ptr->_ex+_w-10) &&
           (event->y >= ptr->_ey) && (event->y <= ptr->_ey+h)) break;
@@ -548,8 +540,7 @@
     if (ptr->_type == MENU_SEPARATOR) {
       h = 4;
     } else {
-      h = _fontStruct->max_bounds.ascent +
-          _fontStruct->max_bounds.descent + 3;
+      h = _th + 3;
     }
     if ((event->x >= ptr->_ex) && (event->x <= ptr->_ex+_w-4) &&  //_w-10??
         (event->y >= ptr->_ey) && (event->y <= ptr->_ey+h)) break;
@@ -631,28 +622,29 @@
 }
 
 void OXPopupMenu::DrawEntry(OMenuEntry *entry) {
-  XFontStruct *font;
+  OFont *font;
   XGCValues gcval;
 
   if (entry->_status & MENU_DEFAULT_MASK) {
-    font = _hifontStruct;
+    font = _hifont;
+#if	0
     gcval.font = font->fid;
     XChangeGC(GetDisplay(), _normGC, GCFont, &gcval);
     XChangeGC(GetDisplay(), _selGC, GCFont, &gcval);
+#endif
   } else {
-    font = _fontStruct;
+    font = _font;
   }
 
   int tx = entry->_ex + _xl;
-  int ty = entry->_ey + font->max_bounds.ascent;
+  int ty = entry->_ey + _th;
 
   switch(entry->_type) {
   case MENU_POPUP:
   case MENU_ENTRY:
       if (entry->_status & MENU_ACTIVE_MASK) {
         XFillRectangle(GetDisplay(), _id, _selbackGC, entry->_ex+1, entry->_ey-1,
-                       _w-6, font->max_bounds.ascent +
-                             font->max_bounds.descent + 3);
+                       _w-6, _th + 3);
         if (entry->_type == MENU_POPUP)
           DrawTrianglePattern(_selGC, _w-10, entry->_ey+3, _w-6, entry->_ey+11);
         if (entry->_status & MENU_CHECKED_MASK)
@@ -661,13 +653,12 @@
           DrawRCheckMark(_selGC, 6, entry->_ey+3, 14, entry->_ey+11);
         if (entry->_pic != NULL)
           entry->_pic->Draw(GetDisplay(), _id, _selGC, 8, entry->_ey+1);
-        entry->_label->Draw(GetDisplay(), _id,
+        entry->_label->Draw(GetDisplay(), _id, _font,
                            (entry->_status & MENU_ENABLE_MASK) ? _selGC : _shadowGC,
                             tx, ty);
       } else {
         XFillRectangle(GetDisplay(), _id, _bckgndGC, entry->_ex+1, entry->_ey-1,
-                       _w-6, font->max_bounds.ascent +
-                             font->max_bounds.descent + 3);
+                       _w-6, _th + 3);
         if (entry->_type == MENU_POPUP)
           DrawTrianglePattern(_normGC, _w-10, entry->_ey+3, _w-6, entry->_ey+11);
         if (entry->_status & MENU_CHECKED_MASK)
@@ -677,10 +668,10 @@
         if (entry->_pic != NULL)
           entry->_pic->Draw(GetDisplay(), _id, _normGC, 8, entry->_ey+1);
         if (entry->_status & MENU_ENABLE_MASK) {
-          entry->_label->Draw(GetDisplay(), _id, _normGC, tx, ty);
+          entry->_label->Draw(GetDisplay(), _id, _font, _normGC, tx, ty);
         } else {
-          entry->_label->Draw(GetDisplay(), _id, _hilightGC, tx+1, ty+1);
-          entry->_label->Draw(GetDisplay(), _id, _shadowGC, tx, ty);
+          entry->_label->Draw(GetDisplay(), _id, _font, _hilightGC, tx+1, ty+1);
+          entry->_label->Draw(GetDisplay(), _id, _font, _shadowGC, tx, ty);
         }
       }
       break;
@@ -693,9 +684,11 @@
 
   // restore font
   if (entry->_status & MENU_DEFAULT_MASK) {
+#if	0
     gcval.font = _fontStruct->fid;
     XChangeGC(GetDisplay(), _normGC, GCFont, &gcval);
     XChangeGC(GetDisplay(), _selGC, GCFont, &gcval);
+#endif
   }
 }
 
@@ -849,13 +842,13 @@
 //-----------------------------------------------------------------
 
 OXMenuTitle::OXMenuTitle(const OXWindow *p, OHotString *s, OXPopupMenu *menu, 
-	      GC norm, XFontStruct *font, unsigned int options)
+	      GC norm, OFont *font, unsigned int options)
   : OXFrame(p, 1, 1, options) {
     int tw, hotchar;
  
     _label = s;
     _menu = menu;
-    _fontStruct = font;
+    _font = font;
     _selGC = _defaultSelectedGC;
     _selbackGC = _defaultSelectedBackgroundGC;
     _normGC = norm;
@@ -867,10 +860,9 @@
     else
       _hkeycode = 0;
 
-    tw = XTextWidth(_fontStruct, _label->GetString(), _label->GetLength());
-  
-    Resize(tw + 8, _fontStruct->max_bounds.ascent +
-                   _fontStruct->max_bounds.descent + 7);
+	_font->Extents( _label->GetString(), _label->GetLength(), &tw, &_th);
+
+    Resize(tw + 8, _th + 7);
 } 
 
 void OXMenuTitle::SetState(int state) {
@@ -902,10 +894,10 @@
   x = 4; y = 4;
   if (_state) {
     XFillRectangle(GetDisplay(), _id, _selbackGC, 0, 0, _w, _h);
-    _label->Draw(GetDisplay(), _id, _selGC, x, y + _fontStruct->max_bounds.ascent);
+	_label->Draw(GetDisplay(), _id, _font, _selGC, x, y + _th);
   } else {
     XClearWindow(GetDisplay(), _id);
-    _label->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+    _label->Draw(GetDisplay(), _id, _font, _normGC, x, y + _th);
   }
 }
 
diff -urN 980416/lib/libxclass/OXTab.cc xclass/lib/libxclass/OXTab.cc
--- 980416/lib/libxclass/OXTab.cc	Wed Apr 15 18:18:20 1998
+++ xclass/lib/libxclass/OXTab.cc	Thu Apr 30 15:28:01 1998
@@ -31,17 +31,18 @@
 //-----------------------------------------------------------------
 
 OXTabElt::OXTabElt(const OXWindow *p, OString *text, int w, int h,
-                   GC norm, XFontStruct *font,
+                   GC norm, OFont *font,
                    unsigned int options, unsigned long back) :
   OXFrame(p, w, h, options, back) {
+	XRectangle ink, log;
 
     _text = text;
     _bw = 0;
     _normGC = norm;
-    _fontStruct = font;
+    _font = font;
+
+	_font->Extents(_text->GetString(), _text->GetLength(), &_tw, &_th);
 
-    _tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
-    _th = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent;
     Resize(max(_tw+12, 45), _th+6);
 }
 
@@ -58,7 +59,7 @@
   XDrawLine (GetDisplay(), _id, _blackGC, _w-1, 2, _w-1, _h-2);
 
   if (_text)
-    _text->Draw(GetDisplay(), _id, _normGC, 6, _fontStruct->max_bounds.ascent+3);
+    _text->Draw(GetDisplay(), _id, _font, _normGC, 6, _th);
 }
 
 ODimension OXTabElt::GetDefaultSize() const {
@@ -124,7 +125,7 @@
 //-----------------------------------------------------------------
 
 OXTab::OXTab(const OXWindow *p, int w, int h,
-             GC norm, XFontStruct *font,
+             GC norm, OFont *font,
              unsigned int options, unsigned long back) :
   OXCompositeFrame(p, w, h, options, back) {
 
@@ -132,9 +133,10 @@
     _current = 0;
 
     _normGC = norm;
-    _fontStruct = font;
+    _font = font;
+
 
-    _tabh = _fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent + 6;
+    _tabh = _font->Height() + 6;
 
     SetLayoutManager(new OTabLayout(this));
     // we need this in order to avoid border blinking when switching tabs...
@@ -164,7 +166,7 @@
 OXCompositeFrame *OXTab::AddTab(OString *text) {
   OXCompositeFrame *cf;
 
-  OXCompositeFrame::AddFrame(new OXTabElt(this, text, 50, 20, _normGC, _fontStruct), NULL);
+  OXCompositeFrame::AddFrame(new OXTabElt(this, text, 50, 20, _normGC, _font), NULL);
   cf = new OXCompositeFrame(this, _w, _h-21);
   OXCompositeFrame::AddFrame(cf, NULL);
 
diff -urN 980416/lib/libxclass/OXTextEntry.cc xclass/lib/libxclass/OXTextEntry.cc
--- 980416/lib/libxclass/OXTextEntry.cc	Wed Apr 15 18:18:48 1998
+++ xclass/lib/libxclass/OXTextEntry.cc	Thu Apr 30 16:41:40 1998
@@ -20,9 +20,13 @@
 **************************************************************************/
 
 #include <xclass/utils.h>
+#include <xclass/Locale.h>
 #include <xclass/OXWidgets.h>
 #include <xclass/OXClient.h>
 #include <xclass/OString.h>
+#ifdef	USE_XIM
+#include <xclass/xim.h>
+#endif
 
 #include <X11/cursorfont.h>
 #include <X11/keysym.h>
@@ -31,8 +35,12 @@
 
 //-----------------------------------------------------------------
 
-OXTextEntry::OXTextEntry(const OXWindow *p, OTextBuffer *text, int ID,
-                         GC norm, XFontStruct *font, unsigned int options,
+OXTextEntry::OXTextEntry(const OXWindow *p, OTextBuffer *text,
+#ifdef	USE_XIM
+						 int usexim,
+#endif
+						 int ID,
+                         GC norm, OFont *font, unsigned int options,
                          unsigned long back)
   : OXFrame(p, 1, 1, options | OWN_BKGND, back) {
     int tw;
@@ -45,14 +53,15 @@
     _normGC = norm;
     _selGC  = _defaultSelectedGC;
     _selbackGC = _defaultSelectedBackgroundGC;
-    _fontStruct = font;
+    _font = font;
     _text = text;
     _state = ENABLED;
     
-    tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetTextLength());
+	tw = _font->Width( _text->GetWString(), _text->GetTextLength());
 
-    Resize(tw + 8, _fontStruct->max_bounds.ascent +
-	           _fontStruct->max_bounds.descent + 7);
+	_th = _font->Height();
+
+    Resize(tw + 8, _th + 7);
 
     _cursor_x  = 4;
     _cursor_ix = _start_ix = _end_ix = 0;
@@ -65,12 +74,24 @@
 		ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
 		GrabModeAsync, GrabModeAsync, None, None);
 
+#ifdef	USE_XIM
+	if		(  usexim  ) {
+		_ic = CreateInputContext(_font->FontSet(),_id,_cursor_x, _th, _w, _h);
+	} else {
+		_ic = NULL;
+	}
+#endif    
     XSelectInput(GetDisplay(), _id, KeyPressMask | ExposureMask | FocusChangeMask);
 }
 
 OXTextEntry::~OXTextEntry() {
   delete _text;
   if (_curblink) delete _curblink;
+#ifdef	USE_XIM
+  if ( _ic != NULL ) {
+	XDestroyIC(_ic);
+  }
+#endif
 }
 
 
@@ -95,13 +116,13 @@
   x = 4; // do not center text
   y = 4;
 //  _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
-  XDrawString(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent, 
-              _text->GetString(), _text->GetTextLength());
+	XwcDrawString(GetDisplay(), _id, _font->FontSet(), _normGC, x, y + _th - 3 ,
+				  _text->GetWString(), _text->GetTextLength());
+
 
   if (_cursor_on) {
     XDrawLine(GetDisplay(), _id, _blackGC, _cursor_x, 3,
-                  _cursor_x, _fontStruct->max_bounds.ascent +
-                             _fontStruct->max_bounds.descent + 3);
+                  _cursor_x, _th + 3);
 //  } else {
 //    XDrawLine(GetDisplay(), _id, _whiteGC, _cursor_x, 4,
 //                  _cursor_x, _fontStruct->max_bounds.ascent +
@@ -116,14 +137,13 @@
     ixs = min(_start_ix, _end_ix);
     iws = abs(_end_ix - _start_ix);
 
-    XFillRectangle(GetDisplay(), _id, _selbackGC, x+xs, y-1,
-                   ws, _fontStruct->max_bounds.ascent +
-                       _fontStruct->max_bounds.descent +1);
+	XFillRectangle(GetDisplay(), _id, _selbackGC, x+xs, y+3,
+				   ws, _th +3 );
 
   //  _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
 
-    XDrawString(GetDisplay(), _id, _selGC, x+xs, y + _fontStruct->max_bounds.ascent, 
-                (_text->GetString())+ixs, iws);
+	XwcDrawString(GetDisplay(), _id, _font->FontSet(), _selGC, x+xs, y + _th - 3 ,
+				  (_text->GetWString())+ixs, iws);
   }
 
   // hmmm...
@@ -157,7 +177,7 @@
 
   // check for out of boundaries first...
   len = _text->GetTextLength();
-  tw = XTextWidth(_fontStruct, _text->GetString(), len);
+  tw = _font->Width(_text->GetString(), len);
   if (xcoord < 0) return 0;
   if (xcoord > tw) return len; // len-1
 
@@ -166,7 +186,7 @@
   down = 0;
   while (up-down > 1) {
     ix = (up+down) >> 1;
-    tw = XTextWidth(_fontStruct, _text->GetString(), ix);
+	tw = _font->Width(_text->GetWString(), ix);
     if (tw > xcoord)
       up = ix;
     else
@@ -194,7 +214,7 @@
 
       x = 4;
       _start_ix = _GetCharacterIndex(event->x - x);
-      _start_x  = XTextWidth(_fontStruct, _text->GetString(), _start_ix);
+	  _start_x  = _font->Width(_text->GetWString(), _start_ix);
       _cursor_ix = _start_ix;
       _cursor_x = _start_x + x;
       _selection_on = False;
@@ -228,9 +248,9 @@
 
   x = 4;
   _start_ix = 0;
-  _start_x  = XTextWidth(_fontStruct, _text->GetString(), _start_ix);
+  _start_x  = _font->Width( _text->GetWString(), _start_ix);
   _end_ix = _text->GetTextLength();
-  _end_x  = XTextWidth(_fontStruct, _text->GetString(), _end_ix);
+  _end_x  = _font->Width( _text->GetWString(), _end_ix);
   _cursor_ix = _end_ix;
   _cursor_x = _end_x + x;
   _selection_on = True;
@@ -249,7 +269,7 @@
   y = 4;
 
   _end_ix = _GetCharacterIndex(event->x - x); // + 1;
-  _end_x  = XTextWidth(_fontStruct, _text->GetString(), _end_ix);
+  _end_x  = _font->Width(_text->GetWString(), _end_ix);
   _cursor_ix = _end_ix;
   _cursor_x = _end_x + x;
   _selection_on = True;
@@ -258,102 +278,159 @@
   return True;
 }
 
+void	OXTextEntry::CurLeft(int n) {
+	for	( ; n > 0 ; n -- ) {
+		if (_selection_on) _selection_on = False;
+		if (_cursor_ix > 0) --_cursor_ix;
+	}
+}
+  
+void	OXTextEntry::CurRight(int n) {
+	for	( ; n > 0 ; n -- ) {
+		if (_selection_on) _selection_on = False;
+		if (_cursor_ix < _text->GetTextLength()) ++_cursor_ix;
+	}
+}
+  
+void	OXTextEntry::CurHome() {
+	if (_selection_on) _selection_on = False;
+	_cursor_ix = 0;
+}
+  
+void	OXTextEntry::CurEnd() {
+	if (_selection_on) _selection_on = False;
+	_cursor_ix = _text->GetTextLength();
+}
+  
+void	OXTextEntry::CharCut() {
+	int start, ns;
+	start = min(_start_ix, _end_ix);
+	ns = abs(_end_ix - _start_ix);
+	_text->RemoveText(start, ns);
+	_selection_on = False;
+	_cursor_ix = start;
+}
+  
+void	OXTextEntry::CharDelete(int n) {
+	if (_selection_on) {
+		CharCut();
+	} else {
+        _text->RemoveText(_cursor_ix, n);
+	}
+}
+  
+void	OXTextEntry::CharBackSpace(int n) {
+	if (_selection_on) {
+		CharCut();
+	} else {
+		for	( ; n > 0 ; n -- ) {
+			if (_cursor_ix > 0) {
+				--_cursor_ix;
+				_text->RemoveText(_cursor_ix, 1);
+			}
+		}
+	}
+}
+  
+#define	CTRL(c)		((c)-'@')
+
 int OXTextEntry::HandleKey(XKeyEvent *event) {
   int  modifier, n, len, text_changed = False;
-  char tmp[10];
+  wchar_t	tmp[10];
+  char		ctmp[10];
+  Status	status;
   KeySym keysym;
   XComposeStatus compose = { NULL, 0 };
   if (_state == DISABLED) return True;
-
-  len = _text->GetTextLength();
-  n = XLookupString(event, tmp, sizeof(tmp)-1, &keysym, &compose);
+#ifdef	USE_XIM
+	if		(  _ic  !=  NULL  ) {
+		n = XwcLookupString(_ic,event,tmp,sizeof(tmp)-1,&keysym, &status);
+	} else {
+		n = XLookupString(event, ctmp, sizeof(ctmp)-1, &keysym, &compose);
+		mbstowcs(tmp,ctmp,n);
+	}
+#else
+	n = XLookupString(event, ctmp, sizeof(ctmp)-1, &keysym, &compose);
+	mbstowcs(tmp,ctmp,n);
+#endif
   tmp[n] = 0;
 
-  switch (keysym) {
-    case XK_Right:
-      if (_selection_on) _selection_on = False;
-      if (_cursor_ix < len) ++_cursor_ix;
-      break;
-
-    case XK_Left:
-      if (_selection_on) _selection_on = False;
-      if (_cursor_ix > 0) --_cursor_ix;
-      break;
-
-    case XK_Home:
-      if (_selection_on) _selection_on = False;
-      _cursor_ix = 0;
-      break;
-
-    case XK_End:
-      if (_selection_on) _selection_on = False;
-      _cursor_ix = len;
-      break;
-
-    case XK_Delete:
-      if (_selection_on) {
-        int start, ns;
-
-        start = min(_start_ix, _end_ix);
-        ns = abs(_end_ix - _start_ix);
-        _text->RemoveText(start, ns);
-        _selection_on = False;
-        _cursor_ix = start;
-      } else {
-        _text->RemoveText(_cursor_ix, 1);
-      }
-      text_changed = True;
-      break;
-
-    case XK_BackSpace:
-      if (_selection_on) {
-        int start, ns;
-
-        start = min(_start_ix, _end_ix);
-        ns = abs(_end_ix - _start_ix);
-        _text->RemoveText(start, ns);
-        _selection_on = False;
-        _cursor_ix = start;
-      } else {
-        if (_cursor_ix > 0) {
-          --_cursor_ix;
-          _text->RemoveText(_cursor_ix, 1);
-        }
-      }
-      text_changed = True;
-      break;
-
-    case XK_Up:
-    case XK_Down:
-    case XK_Escape:
-    case XK_Execute:
-    case XK_Return:
-      break;    
-
-    default:
-      if (_selection_on) {
-        int start, ns;
-
-        start = min(_start_ix, _end_ix);
-        ns = abs(_end_ix - _start_ix);
-        _text->RemoveText(start, ns);
-        _selection_on = False;
-        _cursor_ix = start;
-      }
-      _text->AddText(_cursor_ix, tmp);
-      len = _text->GetTextLength();
-      _cursor_ix += n;
-      if (_cursor_ix > len) _cursor_ix = len;
-      text_changed = True;
-      break;
+	switch (keysym) {
+	  case XK_Right:
+		CurRight(1);
+		break;
+	  case XK_Left:
+		CurLeft(1);
+		break;
+	  case XK_Home:
+		CurHome();
+		break;
+	  case XK_End:
+		CurEnd();
+		break;
+      case XK_Delete:
+		CharDelete(1);
+		text_changed = True;
+		break;
+      case XK_BackSpace:
+		CharBackSpace(1);
+		text_changed = True;
+		break;
+      case XK_Return:
+		text_changed = True;
+		break;
+      case XK_Execute:
+      case XK_Up:
+      case XK_Down:
+      case XK_Escape:
+		break;    
+      default:
+		if		(  tmp[0]  <=  CTRL('Z')  ) {
+			switch	(tmp[0]) {
+			  case	CTRL('A'):
+				CurHome();
+				break;
+			  case	CTRL('B'):
+				CurLeft(1);
+				break;
+			  case	CTRL('E'):
+				CurEnd();
+				break;
+			  case	CTRL('F'):
+				CurRight(1);
+				break;
+			  case	CTRL('H'):
+				CharBackSpace(1);
+				text_changed = True;
+				break;
+			  case	CTRL('D'):
+				CharDelete(1);
+				break;
+			  default:
+				break;
+			}
+		} else {
+			if (_selection_on) {
+				CharCut();
+			}
+			_text->AddText(_cursor_ix, tmp);
+			len = _text->GetTextLength();
+			_cursor_ix += n;
+			if (_cursor_ix > len) _cursor_ix = len;
+			text_changed = True;
+		}
+		break;
   }
   if (text_changed)
     SendMessage(_msgWindow, MK_MSG(XC_TEXTENTRY, TE_TEXTCHANGED),
-                _widgetID, 0L);
+                _widgetID, keysym);
 
-  _cursor_x = 4 + XTextWidth(_fontStruct, _text->GetString(), _cursor_ix);
-  _client->NeedRedraw(this);
-  return True;
+  _cursor_x = 4 + _font->Width(_text->GetWString(), _cursor_ix);
+#ifdef	USE_XIM
+	MoveInputPosition(_ic,_cursor_x,_th,_w,_h);
+#endif
+	_client->NeedRedraw(this);
+	return True;
 }
 
 int OXTextEntry::HandleFocusChange(XFocusChangeEvent *event) {
@@ -364,8 +441,19 @@
       (event->detail != NotifyPointer)) {
     if (event->type == FocusIn) {
       _cursor_on = True;
+#ifdef	USE_XIM
+	  if ( _ic != NULL ) {
+		  XSetICValues(_ic,XNFocusWindow, _id, NULL);
+		  XSetICFocus (_ic);
+	  }
+#endif
       if (!_curblink) _curblink = new OTimer(this, 500);
     } else {
+#ifdef	USE_XIM
+	  if ( _ic != NULL ) {
+		  XUnsetICFocus (_ic);
+	  }
+#endif
       _cursor_on = False;
       _selection_on = False;
       if (_curblink) { delete _curblink; _curblink = NULL; }
@@ -417,7 +505,7 @@
       _cursor_ix = start;
     }
 
-    _text->AddText(_cursor_ix, (char *) data2, (int) nitems);
+    _text->AddText(_cursor_ix, (wchar_t *) data2, (int) nitems);
     len = _text->GetTextLength();
     _cursor_ix += nitems;
     if (_cursor_ix > len) _cursor_ix = len;
@@ -429,7 +517,7 @@
 
   SendMessage(_msgWindow, MK_MSG(XC_TEXTENTRY, TE_TEXTCHANGED),
               _widgetID, 0L);
-  _cursor_x = 4 + XTextWidth(_fontStruct, _text->GetString(), _cursor_ix);
+  _cursor_x = 4 + _font->Width(_text->GetWString(), _cursor_ix);
   _client->NeedRedraw(this);
   return;
 }
diff -urN 980416/lib/libxclass/OXWidgets.cc xclass/lib/libxclass/OXWidgets.cc
--- 980416/lib/libxclass/OXWidgets.cc	Wed Apr 15 18:18:56 1998
+++ xclass/lib/libxclass/OXWidgets.cc	Thu Apr 30 15:28:02 1998
@@ -33,15 +33,15 @@
 
 OXGroupFrame::OXGroupFrame(const OXWindow *p, OString *title,
                            unsigned int options,
-                           GC norm, XFontStruct *font, unsigned long back) :
+                           GC norm, OFont *font, unsigned long back) :
   OXCompositeFrame(p, 1, 1, options, back) {
+	XRectangle ink, log;
 
     _text = title;  
-    _fontStruct = font;
+    _font = font;
     _normGC = norm;
 
-    _bw = _fontStruct->max_bounds.ascent +
-          _fontStruct->max_bounds.descent + 1;
+	_bw = _font->Height(_text->GetString(), _text->GetLength()) + 1;
 }
 
 OXGroupFrame::~OXGroupFrame() {
@@ -49,12 +49,12 @@
 }
 
 void OXGroupFrame::DrawBorder() {
-  int x, y, tw, l, t, r, b, gl, gr, sep;
+  int x, y, tw, th, l, t, r, b, gl, gr, sep;
 
-  tw = XTextWidth(_fontStruct, _text->GetString(), _text->GetLength());
+  _font->Extents( _text->GetString(), _text->GetLength(), &tw, &th);
 
   l = 0;
-  t = (_fontStruct->max_bounds.ascent + _fontStruct->max_bounds.descent + 2) >> 1;
+  t = (th + 2) >> 1;
   r = _w-1;
   b = _h-1;
 
@@ -79,7 +79,7 @@
   x = gl + sep;
   y = 1;
 
-  _text->Draw(GetDisplay(), _id, _normGC, x, y + _fontStruct->max_bounds.ascent);
+  _text->Draw(GetDisplay(), _id, _font, _normGC, x, y + th);
 }
 
 
diff -urN 980416/lib/libxclass/xim.cc xclass/lib/libxclass/xim.cc
--- 980416/lib/libxclass/xim.cc	Thu Jan  1 09:00:00 1970
+++ xclass/lib/libxclass/xim.cc	Thu Apr 30 15:28:02 1998
@@ -0,0 +1,134 @@
+#include	<stdio.h>
+#include	<stdlib.h>
+#include	<X11/Xlib.h>
+#include	<X11/keysym.h>
+#include	<X11/Xresource.h>
+
+#include	<xclass/Locale.h>
+#include	<xclass/xim.h>
+
+XIM			xim_im = NULL;
+XIMStyle	xim_style;
+
+extern	XIMStyle
+SelectInputStyle(
+	XIM	im)
+{	static	XIMStyle	preedit[] = {
+		XIMPreeditPosition, XIMPreeditArea,
+		XIMPreeditNothing, 0};
+	static	XIMStyle	status[] = {
+		XIMStatusArea, XIMStatusNothing, 0};
+	XIMStyles	*im_styles;
+	int		i
+	,		j
+	,		k;
+
+	if		(  im  !=  NULL  ) {
+		XGetIMValues(im,XNQueryInputStyle,&im_styles, NULL);
+		for	( i = 0 ; preedit[i] != 0 ; i ++ ) {
+			for	( j = 0 ; status[j] != 0 ; j ++ ) {
+				for	( k = 0 ; k < im_styles->count_styles; k ++ ) {
+					if		(	(  preedit[i] & im_styles->supported_styles[k] )
+								&&	(  status[j] & im_styles->supported_styles[k]  ) )
+						return	( im_styles->supported_styles[k] );
+				}
+			}
+		}
+		fprintf(stderr,"Input style don\'t match.\n");
+	}
+	return	(0);
+}
+extern	void
+BeginIM(
+	Display *d)
+{
+  if	(  XSupportsLocale()  ==  False  )	{
+	  fprintf(stderr,"Not supports locale.\n");
+  }
+  if	(  XSetLocaleModifiers("")  ==  NULL  ) {
+	  fprintf(stderr,"Can\'t set locale modifiers.\n");
+  }
+  if  (  ( xim_im = XOpenIM(d,NULL,NULL,NULL) ) == NULL ) {
+    fprintf(stderr,"Can\'t open IM.\n");
+  }
+  xim_style = SelectInputStyle(xim_im);
+}
+
+extern	XIC
+CreateInputContext(
+	XFontSet	fs,
+	Window		p,
+	int			x,
+	int			y,
+	int			w,
+	int			h)
+{
+	XIC		ic;
+	XVaNestedList	list;
+	XPoint		spot;
+	XRectangle	rect;
+
+	if		(  xim_im  !=  NULL  ) {
+		if		(  ( xim_style & XIMPreeditPosition )  ==  XIMPreeditPosition  ) {
+			spot.x = x;
+			spot.y = y;
+			rect.x = 0;
+			rect.y = 0;
+			rect.width = w;
+			rect.height = h;
+			list = XVaCreateNestedList(0,
+									   XNFontSet, fs,
+									   XNSpotLocation, &spot,
+									   XNArea, &rect,
+									   NULL);
+			ic = XCreateIC(xim_im,
+						   XNInputStyle, xim_style,
+						   XNClientWindow, p,
+						   XNFocusWindow,  p,
+						   XNPreeditAttributes, list,
+						   XNStatusAttributes, list,
+						   NULL);
+		} else {
+			ic = XCreateIC(xim_im,
+						   XNInputStyle, xim_style,
+						   XNClientWindow, p,
+						   XNFocusWindow,  p,
+						   NULL);
+		}
+		if		(  ic  ==  NULL  ) {
+			fprintf(stderr,"Cannot create IC\n");
+		}
+//		XFree(list);
+	} else {
+		ic = NULL;
+	}
+	return	(ic);
+}
+
+extern	void
+MoveInputPosition(
+	XIC		ic,
+	int		x,
+	int		y,
+	int		w,
+	int		h)
+{
+	XPoint		spot;
+	XRectangle	rect;
+	XVaNestedList	list;
+
+	if		(  ic  !=  NULL  ) {
+		spot.x = x;
+		spot.y = y;
+		rect.x = x;
+		rect.y = y;
+		rect.width = w - x;
+		rect.height = h - y;
+		list = XVaCreateNestedList(0,
+								   XNSpotLocation,&spot,
+								   XNArea, &rect,
+								   NULL);
+		XSetICValues(ic,XNPreeditAttributes,list,NULL);
+		XFree(list);
+	}
+}
