diff -rc libXaw3d-master/configure.ac libXaw3dXft-1.6.2/configure.ac
*** libXaw3d-master/configure.ac	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/configure.ac	2012-02-25 14:11:37.000000000 +0100
***************
*** 1,7 ****
  
  # Initialize Autoconf
  AC_PREREQ([2.60])
! AC_INIT([libXaw3d], [1.6.1],
          [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXaw3d])
  AC_CONFIG_SRCDIR([Makefile.am])
  AC_CONFIG_HEADERS([config.h])
--- 1,7 ----
  
  # Initialize Autoconf
  AC_PREREQ([2.60])
! AC_INIT([libXaw3d], [1.6.2],
          [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXaw3d])
  AC_CONFIG_SRCDIR([Makefile.am])
  AC_CONFIG_HEADERS([config.h])
***************
*** 30,36 ****
  AC_PROG_LEX
  
  # Checks for header files.
! PKG_CHECK_MODULES(X11, [x11 xt xmu xext])
  AC_CHECK_HEADERS([wctype.h wchar.h widec.h])
  AC_CHECK_FUNCS([iswspace])
  AC_TYPE_INTPTR_T
--- 30,36 ----
  AC_PROG_LEX
  
  # Checks for header files.
! PKG_CHECK_MODULES(X11, [x11 xt xmu xext xft])
  AC_CHECK_HEADERS([wctype.h wchar.h widec.h])
  AC_CHECK_FUNCS([iswspace])
  AC_TYPE_INTPTR_T
diff -rc libXaw3d-master/include/Makefile.am libXaw3dXft-1.6.2/include/Makefile.am
*** libXaw3d-master/include/Makefile.am	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/Makefile.am	2012-02-25 21:59:53.000000000 +0100
***************
*** 79,84 ****
--- 79,85 ----
  	X11/Xaw3d/Viewport.h \
  	X11/Xaw3d/ViewportP.h \
  	X11/Xaw3d/Xaw3dP.h \
+ 	X11/Xaw3d/Xaw3dXft.h \
  	X11/Xaw3d/XawInit.h \
  	$(I18N_HDRS)
  
diff -rc libXaw3d-master/include/X11/Xaw3d/AsciiSink.h libXaw3dXft-1.6.2/include/X11/Xaw3d/AsciiSink.h
*** libXaw3d-master/include/X11/Xaw3d/AsciiSink.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/AsciiSink.h	2012-02-25 14:32:02.000000000 +0100
***************
*** 67,75 ****
--- 67,77 ----
  */
  
  #define XtCOutput "Output"
+ #define XtCXftFont "XftFont"
  
  #define XtNdisplayNonprinting "displayNonprinting"
  #define XtNecho "echo"
+ #define XtNxftFont "xftFont"
  
  /* Class record constants */
  
diff -rc libXaw3d-master/include/X11/Xaw3d/AsciiSinkP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/AsciiSinkP.h
*** libXaw3d-master/include/X11/Xaw3d/AsciiSinkP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/AsciiSinkP.h	2012-02-25 14:54:43.000000000 +0100
***************
*** 60,65 ****
--- 60,66 ----
   *
   ***********************************************************************/
  
+ #include <X11/Xft/Xft.h>
  #include <X11/Xaw3d/TextSinkP.h>
  #include <X11/Xaw3d/AsciiSink.h>
  
***************
*** 89,100 ****
--- 90,103 ----
      XFontStruct *font;          /* Font to draw in. */
      Boolean echo;
      Boolean display_nonprinting;
+     char *xftfontname;
  
      /* private state */
      GC normgc, invgc, xorgc;
      Pixmap insertCursorOn;
      XawTextInsertState laststate;
      short cursor_x, cursor_y;	/* Cursor Location. */
+     XftFont *xftfont;
  } AsciiSinkPart;
  
  /****************************************************************
diff -rc libXaw3d-master/include/X11/Xaw3d/Label.h libXaw3dXft-1.6.2/include/X11/Xaw3d/Label.h
*** libXaw3d-master/include/X11/Xaw3d/Label.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/Label.h	2012-02-25 16:25:07.000000000 +0100
***************
*** 93,102 ****
  #define XawTextEncoding8bit	0
  #define XawTextEncodingChar2b	1
  
  #define XtNleftBitmap "leftBitmap"
  #define XtCLeftBitmap "LeftBitmap"
- #define XtNencoding "encoding"
  #define XtCEncoding "Encoding"
  
  #ifdef XAW_INTERNATIONALIZATION
  #ifndef XtNfontSet
--- 93,105 ----
  #define XawTextEncoding8bit	0
  #define XawTextEncodingChar2b	1
  
+ #define XtNencoding "encoding"
  #define XtNleftBitmap "leftBitmap"
+ #define XtNxftFont "xftFont"
+ 
  #define XtCLeftBitmap "LeftBitmap"
  #define XtCEncoding "Encoding"
+ #define XtCXftFont "XftFont"
  
  #ifdef XAW_INTERNATIONALIZATION
  #ifndef XtNfontSet
diff -rc libXaw3d-master/include/X11/Xaw3d/LabelP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/LabelP.h
*** libXaw3d-master/include/X11/Xaw3d/LabelP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/LabelP.h	2012-02-25 16:26:43.000000000 +0100
***************
*** 61,66 ****
--- 61,67 ----
   ***********************************************************************/
  
  #include "Xaw3dP.h"
+ #include <X11/Xft/Xft.h>
  #include <X11/Xaw3d/Label.h>
  #include <X11/Xaw3d/ThreeDP.h>
  
***************
*** 94,99 ****
--- 95,101 ----
      Boolean	resize;
      unsigned char encoding;
      Pixmap	left_bitmap;
+     char	*xftfontname;
  
      /* private state */
      GC		normal_GC;
***************
*** 109,114 ****
--- 111,117 ----
      int		lbm_y;			/* where in label */
      unsigned int lbm_width, lbm_height;	/* size of pixmap */
      unsigned int depth;			/* depth of pixmaps */
+     XftFont	*xftfont;
  } LabelPart;
  
  
diff -rc libXaw3d-master/include/X11/Xaw3d/List.h libXaw3dXft-1.6.2/include/X11/Xaw3d/List.h
*** libXaw3d-master/include/X11/Xaw3d/List.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/List.h	2012-02-25 16:43:30.000000000 +0100
***************
*** 122,127 ****
--- 122,128 ----
  #define XtCColumns "Columns"
  #define XtCLongest "Longest"
  #define XtCNumberStrings "NumberStrings"
+ #define XtCXftFont "XftFont"
  
  #define XtNcursor "cursor"
  #define XtNcolumnSpacing "columnSpacing"
***************
*** 133,138 ****
--- 134,140 ----
  #define XtNpasteBuffer "pasteBuffer"
  #define XtNrowSpacing "rowSpacing"
  #define XtNverticalList "verticalList"
+ #define XtNxftFont "xftFont"
  
  #ifdef XAW_INTERNATIONALIZATION
  #ifndef XtNfontSet
diff -rc libXaw3d-master/include/X11/Xaw3d/ListP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/ListP.h
*** libXaw3d-master/include/X11/Xaw3d/ListP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/ListP.h	2012-02-25 16:48:51.000000000 +0100
***************
*** 45,50 ****
--- 45,51 ----
   ***********************************************************************/
  
  #include "Xaw3dP.h"
+ #include <X11/Xft/Xft.h>
  #include <X11/Xaw3d/SimpleP.h>
  #include <X11/Xaw3d/List.h>
  
***************
*** 85,90 ****
--- 86,92 ----
  #endif
      String *    list;		/* for i18n, always in multibyte format */
      XtCallbackList callback;
+     char *	xftfontname;
  
      /* private state */
      int         is_highlighted,	/* set to the item currently highlighted. */
***************
*** 95,104 ****
                  ncols;		/* number of columns in the list. */
      GC		normgc,		/* a couple of GC's. */
                  revgc,
                  graygc;		/* used when inactive. */
  
      int         freedoms;       /* flags for resizing height and width */
! 
  } ListPart;
  
  
--- 97,107 ----
                  ncols;		/* number of columns in the list. */
      GC		normgc,		/* a couple of GC's. */
                  revgc,
+ 		hilitgc,
                  graygc;		/* used when inactive. */
  
      int         freedoms;       /* flags for resizing height and width */
!     XftFont *	xftfont;
  } ListPart;
  
  
diff -rc libXaw3d-master/include/X11/Xaw3d/Scrollbar.h libXaw3dXft-1.6.2/include/X11/Xaw3d/Scrollbar.h
*** libXaw3d-master/include/X11/Xaw3d/Scrollbar.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/Scrollbar.h	2012-02-29 17:23:31.000000000 +0100
***************
*** 137,142 ****
--- 137,151 ----
  #endif
  );
  
+ #ifdef XAW_ARROW_SCROLLBARS
+ extern void XawHandleMouseWheel(
+     Widget		/* scrollbar */,
+     XEvent *		/* event */,
+     String *		/* params */,
+     Cardinal *		/* num_params */
+ );
+ #endif
+ 
  _XFUNCPROTOEND
  
  #endif /* _Scrollbar_h */
diff -rc libXaw3d-master/include/X11/Xaw3d/ScrollbarP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/ScrollbarP.h
*** libXaw3d-master/include/X11/Xaw3d/ScrollbarP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/ScrollbarP.h	2012-02-29 22:59:33.000000000 +0100
***************
*** 78,84 ****
      float	  shown;	/* What percent is shown in the win */
      Dimension	  length;	/* either height or width */
      Dimension	  thickness;	/* either width or height */
!     Dimension	  min_thumb;	/* minium size for the thumb. */
      float         picked;       /* How much of the thumb is picked *
  				 * when scrolling starts */
  
--- 78,84 ----
      float	  shown;	/* What percent is shown in the win */
      Dimension	  length;	/* either height or width */
      Dimension	  thickness;	/* either width or height */
!     Dimension	  min_thumb;	/* minimum size for the thumb. */
      float         picked;       /* How much of the thumb is picked *
  				 * when scrolling starts */
  
***************
*** 86,91 ****
--- 86,92 ----
  #ifdef XAW_ARROW_SCROLLBARS
      XtIntervalId  timer_id;     /* autorepeat timer; remove on destruction */
      char	  scroll_mode;	/* 0:none 1:up/back 2:track 3:down/forward */
+     Dimension	  scroll_steps; /* number of steps when using mouse wheel */
  #else
      Cursor        inactiveCursor; /* the normal cursor for scrollbar */
      char          direction;	/* a scroll has started; which direction */
diff -rc libXaw3d-master/include/X11/Xaw3d/SimpleMenP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/SimpleMenP.h
*** libXaw3d-master/include/X11/Xaw3d/SimpleMenP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/SimpleMenP.h	2012-03-04 17:02:13.024530663 +0100
***************
*** 94,102 ****
    Dimension last_y;
    int first_y;                  /* Dimension doesn't do negatives! */
    int jump_val;                 /* number of entries to scroll by */
    Boolean too_tall;             /* menu doesn't fit on screen */
    Boolean didnt_fit;            /* if some entry didn't fit in the menu */
-   Widget sub_menu;              /* submenu of active SmeBSB object */
    unsigned char state;
  } SimpleMenuPart;
  
--- 94,103 ----
    Dimension last_y;
    int first_y;                  /* Dimension doesn't do negatives! */
    int jump_val;                 /* number of entries to scroll by */
+   Widget sub_menu;              /* submenu of active SmeBSB object */
    Boolean too_tall;             /* menu doesn't fit on screen */
+   Boolean multicolumn;          /* menu is set as multicolumn */
    Boolean didnt_fit;            /* if some entry didn't fit in the menu */
    unsigned char state;
  } SimpleMenuPart;
  
diff -rc libXaw3d-master/include/X11/Xaw3d/SmeBSB.h libXaw3dXft-1.6.2/include/X11/Xaw3d/SmeBSB.h
*** libXaw3d-master/include/X11/Xaw3d/SmeBSB.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/SmeBSB.h	2012-02-25 19:55:39.000000000 +0100
***************
*** 89,94 ****
--- 89,95 ----
  #define XtNvertSpace "vertSpace"
  #define XtNmenuName "menuName"
  #define XtNunderline "underline"
+ #define XtNxftFont "xftFont"
  
  #ifdef XAW_INTERNATIONALIZATION
  #ifndef XtNfontSet
***************
*** 105,109 ****
--- 106,111 ----
  #define XtCVertSpace "VertSpace"
  #define XtCMenuName "MenuName"
  #define XtCUnderline "Underline"
+ #define XtCXftFont "XftFont"
  
  #endif /* _SmeBSB_h */
diff -rc libXaw3d-master/include/X11/Xaw3d/SmeBSBP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/SmeBSBP.h
*** libXaw3d-master/include/X11/Xaw3d/SmeBSBP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/SmeBSBP.h	2012-02-25 19:56:42.000000000 +0100
***************
*** 40,45 ****
--- 40,46 ----
   ***********************************************************************/
  
  #include "Xaw3dP.h"
+ #include <X11/Xft/Xft.h>
  #include <X11/Xaw3d/SmeThreeDP.h>
  #include <X11/Xaw3d/SmeBSB.h>
  
***************
*** 78,86 ****
--- 79,89 ----
  #endif
      XtJustify justify;		/* Justification for the label. */
      int underline;		/* index of letter to underline in label. */
+     char * xftfontname;
  
      /* private resources. */
      Boolean set_values_area_cleared; /* Remember if we need to unhighlight. */
+     Boolean set_values_area_reverse; /* Remember if color is reversed. */
      GC norm_gc;			/* noral color gc. */
      GC rev_gc;			/* reverse color gc. */
      GC norm_gray_gc;		/* Normal color (grayed out) gc. */
***************
*** 93,98 ****
--- 96,102 ----
      unsigned int left_depth;
      unsigned int right_depth;
      String menu_name;		/* name of nested sub-menu or NULL */
+     XftFont * xftfont;
  } SmeBSBPart;
  
  /****************************************************************
diff -rc libXaw3d-master/include/X11/Xaw3d/TextP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/TextP.h
*** libXaw3d-master/include/X11/Xaw3d/TextP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/TextP.h	2012-02-26 16:54:20.000000000 +0100
***************
*** 51,56 ****
--- 51,57 ----
  
  #include <X11/Xaw3d/Text.h>
  #include <X11/Xaw3d/SimpleP.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  
  /****************************************************************
   *
***************
*** 185,191 ****
      XtCallbackList	unrealize_callbacks; /* used for scrollbars */
  
      /* private state */
- 
      XawTextMargin       margin;            /* The current margins. */
      XawTextLineTable	lt;
      XawTextScanDirection extendDir;
--- 186,191 ----
***************
*** 193,199 ****
      Time	    lasttime;	    /* timestamp of last processed action */
      Time	    time;	    /* time of last key or button action */
      Position	    ev_x, ev_y;	    /* x, y coords for key or button action */
!     Widget	    vbar, hbar;	    /* The scroll bars (none = NULL). */
      struct SearchAndReplace * search;/* Search and replace structure. */
      Widget          file_insert;    /* The file insert popup widget. */
      XawTextPosition  *updateFrom;   /* Array of start positions for update. */
--- 193,199 ----
      Time	    lasttime;	    /* timestamp of last processed action */
      Time	    time;	    /* time of last key or button action */
      Position	    ev_x, ev_y;	    /* x, y coords for key or button action */
!     Widget          vbar, hbar;	    /* The scroll bars (none = NULL). */
      struct SearchAndReplace * search;/* Search and replace structure. */
      Widget          file_insert;    /* The file insert popup widget. */
      XawTextPosition  *updateFrom;   /* Array of start positions for update. */
***************
*** 214,219 ****
--- 214,221 ----
      /* private state, shared w/Source and Sink */
      Boolean	    redisplay_needed; /* in SetValues */
      XawTextSelectionSalt    *salt2;	     /* salted away selections */
+     XIC             xic;	/* used to handle UTF8 input */
+     XIM             xim;	/* used to handle UTF8 input */
  } TextPart;
  
  /*************************************************************
diff -rc libXaw3d-master/include/X11/Xaw3d/Tip.h libXaw3dXft-1.6.2/include/X11/Xaw3d/Tip.h
*** libXaw3d-master/include/X11/Xaw3d/Tip.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/Tip.h	2012-02-25 21:30:32.000000000 +0100
***************
*** 70,75 ****
--- 70,76 ----
  #define XtNencoding "encoding"
  #define XtNtimeout "timeout"
  #define XtNtip "tip"
+ #define XtNxftFont "xftFont"
  
  #ifdef XAW_INTERNATIONALIZATION
  #ifndef XtNfontSet
***************
*** 83,88 ****
--- 84,90 ----
  #define XtCEncoding "Encoding"
  #define XtCTimeout "Timeout"
  #define XtCTip "Tip"
+ #define XtCXftFont "XftFont"
  
  #ifndef _XtStringDefs_h_
  #define XtNforeground "foreground"
diff -rc libXaw3d-master/include/X11/Xaw3d/TipP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/TipP.h
*** libXaw3d-master/include/X11/Xaw3d/TipP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/TipP.h	2012-02-25 21:33:27.000000000 +0100
***************
*** 31,36 ****
--- 31,37 ----
  #define _XawTipP_h
  
  #include "Xaw3dP.h"
+ #include <X11/Xft/Xft.h>
  #include <X11/Xaw3d/Tip.h>
  
  typedef struct {
***************
*** 56,61 ****
--- 57,63 ----
      String label;
      int backing_store;
      int timeout;
+     char *xftfontname;
  
      /* private */
      GC gc;
***************
*** 64,69 ****
--- 66,72 ----
      Boolean international;
  #endif
      unsigned char encoding;
+     XftFont *xftfont;
  } TipPart;
  
  typedef struct _TipRec {
diff -rc libXaw3d-master/include/X11/Xaw3d/Viewport.h libXaw3dXft-1.6.2/include/X11/Xaw3d/Viewport.h
*** libXaw3d-master/include/X11/Xaw3d/Viewport.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/Viewport.h	2012-02-25 21:46:18.000000000 +0100
***************
*** 84,89 ****
--- 84,96 ----
  #define XtNuseRight "useRight"
  #endif
  
+ #ifndef XtNsbShiftX1
+ #define XtNsbShiftX1 "sbShiftX1"
+ #define XtNsbShiftX2 "sbShiftX2"
+ #define XtNsbShiftY1 "sbShiftY1"
+ #define XtNsbShiftY2 "sbShiftY2"
+ #endif
+ 
  extern WidgetClass viewportWidgetClass;
  
  typedef struct _ViewportClassRec *ViewportWidgetClass;
diff -rc libXaw3d-master/include/X11/Xaw3d/ViewportP.h libXaw3dXft-1.6.2/include/X11/Xaw3d/ViewportP.h
*** libXaw3d-master/include/X11/Xaw3d/ViewportP.h	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/include/X11/Xaw3d/ViewportP.h	2012-02-25 21:45:25.000000000 +0100
***************
*** 82,87 ****
--- 82,91 ----
      Widget clip, child;		/* The clipping and (scrolled) child widgets */
      Widget  horiz_bar, vert_bar;/* What scrollbars we currently have. */
      ThreeDWidget threeD;
+     Position sbShiftX1;
+     Position sbShiftX2;
+     Position sbShiftY1;
+     Position sbShiftY2;
  } ViewportPart;
  
  typedef struct _ViewportRec {
diff -rc libXaw3d-master/src/AsciiSink.c libXaw3dXft-1.6.2/src/AsciiSink.c
*** libXaw3d-master/src/AsciiSink.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/AsciiSink.c	2012-02-25 22:53:05.000000000 +0100
***************
*** 54,63 ****
--- 54,65 ----
  #include <X11/Xatom.h>
  #include <X11/IntrinsicP.h>
  #include <X11/StringDefs.h>
+ #include <X11/Xft/Xft.h>
  #include <X11/Xaw3d/XawInit.h>
  #include <X11/Xaw3d/AsciiSinkP.h>
  #include <X11/Xaw3d/AsciiSrcP.h>	/* For source function defs. */
  #include <X11/Xaw3d/TextP.h>	/* I also reach into the text widget. */
+ #include <X11/Xaw3d/Xaw3dXft.h>
  
  #ifdef GETLASTPOS
  #undef GETLASTPOS		/* We will use our own GETLASTPOS. */
***************
*** 87,92 ****
--- 89,96 ----
  static XtResource resources[] = {
      {XtNfont, XtCFont, XtRFontStruct, sizeof (XFontStruct *),
  	offset(font), XtRString, XtDefaultFont},
+     {XtNxftFont, XtCXftFont, XtRString, sizeof(String),
+ 	offset(xftfontname), XtRString, NULL},
      {XtNecho, XtCOutput, XtRBoolean, sizeof(Boolean),
  	offset(echo), XtRImmediate, (XtPointer) True},
      {XtNdisplayNonprinting, XtCOutput, XtRBoolean, sizeof(Boolean),
***************
*** 155,170 ****
  /* Utilities */
  
  static int
! CharWidth (Widget w, int x, unsigned char c)
  {
      int    i, width, nonPrinting;
      AsciiSinkObject sink = (AsciiSinkObject) w;
!     XFontStruct *font = sink->ascii_sink.font;
      Position *tab;
  
!     if ( c == XawLF ) return(0);
  
!     if (c == XawTAB) {
  	/* Adjust for Left Margin. */
  	x -= ((TextWidget) XtParent(w))->text.margin.left;
  
--- 159,177 ----
  /* Utilities */
  
  static int
! CharWidth (Widget w, int x, unsigned char *c, int *l)
  {
      int    i, width, nonPrinting;
      AsciiSinkObject sink = (AsciiSinkObject) w;
!     XFontStruct *font;
!     XftFont *xftfont;
!     XGlyphInfo extents = {};
      Position *tab;
+     unsigned char first;
  
!     if (*c == XawLF ) return(0);
  
!     if (*c == XawTAB) {
  	/* Adjust for Left Margin. */
  	x -= ((TextWidget) XtParent(w))->text.margin.left;
  
***************
*** 181,203 ****
  	return 0;
      }
  
!     if ( (nonPrinting = (c < (unsigned char) XawSP)) ) {
  	if (sink->ascii_sink.display_nonprinting)
! 	    c += '@';
  	else {
! 	    c = XawSP;
  	    nonPrinting = False;
  	}
      }
  
!     if (font->per_char &&
! 	    (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
! 	width = font->per_char[c - font->min_char_or_byte2].width;
!     else
! 	width = font->min_bounds.width;
  
!     if (nonPrinting)
! 	width += CharWidth(w, x, (unsigned char) '^');
  
      return width;
  }
--- 188,252 ----
  	return 0;
      }
  
!     if ( (nonPrinting = (*c < (unsigned char) XawSP)) ) {
  	if (sink->ascii_sink.display_nonprinting)
! 	    *c += '@';
  	else {
! 	    *c = XawSP;
  	    nonPrinting = False;
  	}
      }
  
!     if (l) *l = 1;
!   
!     if (Xaw3dXftEncoding) {
!         xftfont = sink->ascii_sink.xftfont;
!         if (Xaw3dXftEncoding == -1) {
!             /* Dealing with Unicode string */
!             if (*c<0x80) {
!                 XftTextExtentsUtf8(XtDisplayOfObject(w), xftfont,
!                                    (FcChar8*)c, 1, (XGlyphInfo*)&extents);
!                 width = extents.xOff;
!             } else
!             if (((*c)&0xc0) == 0x80)
!                 width = 0;
!             else
!             if (((*c)&0xc0) == 0xc0) {
!                 int len;
!                 first = *c;
!                 len = 1;
!                 while (len<4 && ((c[len]&0xc0)==0x80) && 
!                            (first=(first<<1))&0x80) 
!                     ++len;
!                 XftTextExtentsUtf8(XtDisplayOfObject(w), xftfont,
!                                    (FcChar8*)c, len, (XGlyphInfo*)&extents);
!                 width = extents.xOff;       
!                 if (l) *l = len;
!             } else
!                 width = 0;
! 	}
!         else
!         if (Xaw3dXftEncoding == 8)
!             XftTextExtents8(XtDisplayOfObject(w), xftfont,
!                 (FcChar8*)c, 1, (XGlyphInfo*)&extents);
!         else
!         if (Xaw3dXftEncoding == 16)
!             XftTextExtents16(XtDisplayOfObject(w), xftfont,
!                 (FcChar16*)c, 2, (XGlyphInfo*)&extents);
!         width = extents.xOff;
!     } else {
!         font = sink->ascii_sink.font;
!         if (font->per_char &&
! 	       (*c >= font->min_char_or_byte2 && *c <= font->max_char_or_byte2))
! 	    width = font->per_char[*c - font->min_char_or_byte2].width;
!         else
! 	    width = font->min_bounds.width;
!     }
  
!     if (nonPrinting) {
!         first = (unsigned char) '^';
! 	width += CharWidth(w, x, &first, NULL);
!     }
  
      return width;
  }
***************
*** 221,243 ****
      TextWidget ctx = (TextWidget) XtParent(w);
  
      Position max_x;
!     Dimension width = XTextWidth(sink->ascii_sink.font, (char *) buf, len);
      max_x = (Position) ctx->core.width;
  
!     if ( ((int) width) <= -x)	           /* Don't draw if we can't see it. */
!       return(width);
  
-     XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc,
- 		     (int) x, (int) y, (char *) buf, len);
      if ( (((Position) width + x) > max_x) && (ctx->text.margin.right != 0) ) {
  	x = ctx->core.width - ctx->text.margin.right;
  	width = ctx->text.margin.right;
  	XFillRectangle(XtDisplay((Widget) ctx), XtWindow( (Widget) ctx),
  		       sink->ascii_sink.normgc, (int) x,
! 		       (int) y - sink->ascii_sink.font->ascent,
! 		       (unsigned int) width,
! 		       (unsigned int) (sink->ascii_sink.font->ascent +
! 				       sink->ascii_sink.font->descent));
  	return(0);
      }
      return(width);
--- 270,308 ----
      TextWidget ctx = (TextWidget) XtParent(w);
  
      Position max_x;
!     int width, height, ascent;
! 
      max_x = (Position) ctx->core.width;
  
!     if (Xaw3dXftEncoding) {
! 	width = Xaw3dXftTextWidth(w, sink->ascii_sink.xftfont, 
! 		(char *) buf, len);
! 	/* Don't draw if we can't see it. */
! 	if (((int) width) <= -x)
! 	    return(width);
! 	Xaw3dXftDrawString((Widget)ctx, sink->ascii_sink.xftfont, 
!                            (int) x, (int) y, (char *) buf, len);
! 	height = sink->ascii_sink.xftfont->height;
! 	ascent = sink->ascii_sink.xftfont->ascent;
!     } else {
!         width = XTextWidth(sink->ascii_sink.font, (char *) buf, len);
! 	/* Don't draw if we can't see it. */
! 	if (((int) width) <= -x)
! 	    return(width);
! 	XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc,
! 		         (int) x, (int) y, (char *) buf, len);
! 	height = sink->ascii_sink.font->ascent +
!     		 sink->ascii_sink.font->descent;
! 	ascent = sink->ascii_sink.font->ascent;
!     }
  
      if ( (((Position) width + x) > max_x) && (ctx->text.margin.right != 0) ) {
  	x = ctx->core.width - ctx->text.margin.right;
  	width = ctx->text.margin.right;
  	XFillRectangle(XtDisplay((Widget) ctx), XtWindow( (Widget) ctx),
  		       sink->ascii_sink.normgc, (int) x,
! 		       (int) y - ascent,
! 		       (unsigned int) width, (unsigned int) height);
  	return(0);
      }
      return(width);
***************
*** 256,270 ****
      AsciiSinkObject sink = (AsciiSinkObject) w;
      Widget source = XawTextGetSource(XtParent(w));
      unsigned char buf[BUFSIZ];
  
      int j, k;
      XawTextBlock blk;
      GC gc = highlight ? sink->ascii_sink.invgc : sink->ascii_sink.normgc;
      GC invgc = highlight ? sink->ascii_sink.normgc : sink->ascii_sink.invgc;
  
      if (!sink->ascii_sink.echo) return;
  
!     y += sink->ascii_sink.font->ascent;
      for ( j = 0 ; pos1 < pos2 ; ) {
  	pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1);
  	for (k = 0; k < blk.length; k++) {
--- 321,347 ----
      AsciiSinkObject sink = (AsciiSinkObject) w;
      Widget source = XawTextGetSource(XtParent(w));
      unsigned char buf[BUFSIZ];
+     unsigned char special;
  
      int j, k;
+     int width, height, ascent;
      XawTextBlock blk;
      GC gc = highlight ? sink->ascii_sink.invgc : sink->ascii_sink.normgc;
      GC invgc = highlight ? sink->ascii_sink.normgc : sink->ascii_sink.invgc;
  
      if (!sink->ascii_sink.echo) return;
  
!     if (Xaw3dXftEncoding) {
! 	height = sink->ascii_sink.xftfont->height;
! 	ascent =  sink->ascii_sink.xftfont->ascent;
!     } else {
!         height = sink->ascii_sink.font->ascent +
! 		 sink->ascii_sink.font->descent;
! 	ascent =  sink->ascii_sink.font->ascent;
!     }
! 
!     y += ascent;
! 
      for ( j = 0 ; pos1 < pos2 ; ) {
  	pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1);
  	for (k = 0; k < blk.length; k++) {
***************
*** 278,296 ****
  
  	    else if (buf[j] == '\t') {
  	        Position temp = 0;
- 		Dimension width;
  
  	        if ((j != 0) && ((temp = PaintText(w, gc, x, y, buf, j)) == 0))
  		  return;
  
  	        x += temp;
! 		width = CharWidth(w, x, (unsigned char) '\t');
  		XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
  			       invgc, (int) x,
! 			       (int) y - sink->ascii_sink.font->ascent,
! 			       (unsigned int) width,
! 			       (unsigned int) (sink->ascii_sink.font->ascent +
! 					       sink->ascii_sink.font->descent));
  		x += width;
  		j = -1;
  	    }
--- 355,371 ----
  
  	    else if (buf[j] == '\t') {
  	        Position temp = 0;
  
  	        if ((j != 0) && ((temp = PaintText(w, gc, x, y, buf, j)) == 0))
  		  return;
  
  	        x += temp;
! 		special = '\t';
! 		width = CharWidth(w, x, &special, NULL);
  		XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
  			       invgc, (int) x,
! 			       (int) y - ascent,
! 			       (unsigned int) width, (unsigned int) height);
  		x += width;
  		j = -1;
  	    }
***************
*** 380,387 ****
      Widget source = XawTextGetSource(XtParent(w));
  
      XawTextPosition index, lastPos;
!     unsigned char c;
      XawTextBlock blk;
  
      /* we may not need this */
      lastPos = GETLASTPOS;
--- 455,463 ----
      Widget source = XawTextGetSource(XtParent(w));
  
      XawTextPosition index, lastPos;
!     unsigned char *c;
      XawTextBlock blk;
+     int len;
  
      /* we may not need this */
      lastPos = GETLASTPOS;
***************
*** 390,404 ****
      for (index = fromPos; index != toPos && index < lastPos; index++) {
  	if (index - blk.firstPos >= blk.length)
  	    XawTextSourceRead(source, index, &blk, (int) toPos - fromPos);
! 	c = blk.ptr[index - blk.firstPos];
! 	*resWidth += CharWidth(w, fromx + *resWidth, c);
! 	if (c == XawLF) {
  	    index++;
  	    break;
  	}
      }
      *resPos = index;
!     *resHeight = sink->ascii_sink.font->ascent +sink->ascii_sink.font->descent;
  }
  
  
--- 466,483 ----
      for (index = fromPos; index != toPos && index < lastPos; index++) {
  	if (index - blk.firstPos >= blk.length)
  	    XawTextSourceRead(source, index, &blk, (int) toPos - fromPos);
! 	c = (unsigned char *)(blk.ptr + index - blk.firstPos);
! 	*resWidth += CharWidth(w, fromx + *resWidth, c, &len);
! 	if (*c == XawLF) {
  	    index++;
  	    break;
  	}
+ 	if (len>1) index += len-1;
      }
      *resPos = index;
!     *resHeight = (Xaw3dXftEncoding)?
!         sink->ascii_sink.xftfont->height :
! 	sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent;
  }
  
  
***************
*** 419,449 ****
      XawTextPosition lastPos, index, whiteSpacePosition = 0;
      int     lastWidth = 0, whiteSpaceWidth = 0;
      Boolean whiteSpaceSeen;
!     unsigned char c;
      XawTextBlock blk;
  
      lastPos = GETLASTPOS;
  
      XawTextSourceRead(source, fromPos, &blk, BUFSIZ);
      *resWidth = 0;
      whiteSpaceSeen = FALSE;
!     c = 0;
      for (index = fromPos; *resWidth <= width && index < lastPos; index++) {
  	lastWidth = *resWidth;
  	if (index - blk.firstPos >= blk.length)
  	    XawTextSourceRead(source, index, &blk, BUFSIZ);
! 	c = blk.ptr[index - blk.firstPos];
! 	*resWidth += CharWidth(w, fromx + *resWidth, c);
  
! 	if ((c == XawSP || c == XawTAB) && *resWidth <= width) {
  	    whiteSpaceSeen = TRUE;
  	    whiteSpacePosition = index;
  	    whiteSpaceWidth = *resWidth;
  	}
! 	if (c == XawLF) {
  	    index++;
  	    break;
  	}
      }
      if (*resWidth > width && index > fromPos) {
  	*resWidth = lastWidth;
--- 498,531 ----
      XawTextPosition lastPos, index, whiteSpacePosition = 0;
      int     lastWidth = 0, whiteSpaceWidth = 0;
      Boolean whiteSpaceSeen;
!     unsigned char *c;
      XawTextBlock blk;
+     int len;
  
      lastPos = GETLASTPOS;
  
      XawTextSourceRead(source, fromPos, &blk, BUFSIZ);
      *resWidth = 0;
      whiteSpaceSeen = FALSE;
!     c = NULL;
! 
      for (index = fromPos; *resWidth <= width && index < lastPos; index++) {
  	lastWidth = *resWidth;
  	if (index - blk.firstPos >= blk.length)
  	    XawTextSourceRead(source, index, &blk, BUFSIZ);
! 	c = (unsigned char *)(blk.ptr + index - blk.firstPos);
! 	*resWidth += CharWidth(w, fromx + *resWidth, c, &len);
  
! 	if ((*c == XawSP || *c == XawTAB) && *resWidth <= width) {
  	    whiteSpaceSeen = TRUE;
  	    whiteSpacePosition = index;
  	    whiteSpaceWidth = *resWidth;
  	}
! 	if (*c == XawLF) {
  	    index++;
  	    break;
  	}
+ 	if (len>1) index += len-1; 
      }
      if (*resWidth > width && index > fromPos) {
  	*resWidth = lastWidth;
***************
*** 453,461 ****
  	    *resWidth = whiteSpaceWidth;
  	}
      }
!     if (index == lastPos && c != XawLF) index = lastPos + 1;
      *resPos = index;
!     *resHeight = sink->ascii_sink.font->ascent +sink->ascii_sink.font->descent;
  }
  
  static void
--- 535,545 ----
  	    *resWidth = whiteSpaceWidth;
  	}
      }
!     if (index == lastPos && (c==NULL || *c != XawLF))
! 	index = lastPos + 1;
      *resPos = index;
!     *resHeight = (Xaw3dXftEncoding)? sink->ascii_sink.xftfont->height :
! 	sink->ascii_sink.font->ascent +sink->ascii_sink.font->descent;
  }
  
  static void
***************
*** 518,523 ****
--- 602,611 ----
      sink->ascii_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new));
      sink->ascii_sink.laststate = XawisOff;
      sink->ascii_sink.cursor_x = sink->ascii_sink.cursor_y = 0;
+     if (Xaw3dXftEncoding)
+ 	sink->ascii_sink.xftfont = Xaw3dXftGetFont(XtDisplayOfObject(new), sink->ascii_sink.xftfontname);
+     else
+ 	sink->ascii_sink.xftfont = NULL;
  }
  
  /*	Function Name: Destroy
***************
*** 536,541 ****
--- 624,632 ----
     XtReleaseGC(w, sink->ascii_sink.invgc);
     XtReleaseGC(w, sink->ascii_sink.xorgc);
     XFreePixmap(XtDisplayOfObject(w), sink->ascii_sink.insertCursorOn);
+    if (Xaw3dXftEncoding && sink->ascii_sink.xftfont && 
+        sink->ascii_sink.xftfont != Xaw3dXftDefaultFont)
+        XftFontClose(XtDisplayOfObject(w), sink->ascii_sink.xftfont);
  }
  
  /*	Function Name: SetValues
***************
*** 586,592 ****
    AsciiSinkObject sink = (AsciiSinkObject) w;
    int font_height;
  
!   font_height = sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent;
    return( ((int) height) / font_height );
  }
  
--- 677,684 ----
    AsciiSinkObject sink = (AsciiSinkObject) w;
    int font_height;
  
!   font_height = (Xaw3dXftEncoding)? sink->ascii_sink.xftfont->height:
!                 sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent;
    return( ((int) height) / font_height );
  }
  
***************
*** 603,611 ****
  MaxHeight(Widget w, int lines)
  {
    AsciiSinkObject sink = (AsciiSinkObject) w;
  
!   return(lines * (sink->ascii_sink.font->ascent +
! 		  sink->ascii_sink.font->descent));
  }
  
  /*	Function Name: SetTabs
--- 695,706 ----
  MaxHeight(Widget w, int lines)
  {
    AsciiSinkObject sink = (AsciiSinkObject) w;
+   int font_height;
  
!   font_height = (Xaw3dXftEncoding)? sink->ascii_sink.xftfont->height:
!                 sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent;
! 
!   return(lines * font_height);
  }
  
  /*	Function Name: SetTabs
***************
*** 623,643 ****
    int i;
    Atom XA_FIGURE_WIDTH;
    unsigned long figure_width = 0;
!   XFontStruct *font = sink->ascii_sink.font;
  
  /*
   * Find the figure width of the current font.
   */
  
!   XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
!   if ( (XA_FIGURE_WIDTH != None) &&
!        ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
! 	 (figure_width == 0)) ) {
!     if (font->per_char && font->min_char_or_byte2 <= '$' &&
! 	font->max_char_or_byte2 >= '$')
!       figure_width = font->per_char['$' - font->min_char_or_byte2].width;
!     else
!       figure_width = font->max_bounds.width;
    }
  
    if (tab_count > sink->text_sink.tab_count) {
--- 718,745 ----
    int i;
    Atom XA_FIGURE_WIDTH;
    unsigned long figure_width = 0;
!   XFontStruct *font;
!   XftFont *xftfont;
  
  /*
   * Find the figure width of the current font.
   */
  
!   if (Xaw3dXftEncoding) {
!       xftfont = sink->ascii_sink.xftfont;
!       figure_width = xftfont->max_advance_width;
!   } else {
!       font = sink->ascii_sink.font;
!       XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
!       if ( (XA_FIGURE_WIDTH != None) &&
!           ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
!         	 (figure_width == 0)) ) {
!       if (font->per_char && font->min_char_or_byte2 <= '$' &&
! 	  font->max_char_or_byte2 >= '$')
!           figure_width = font->per_char['$' - font->min_char_or_byte2].width;
!       else
!           figure_width = font->max_bounds.width;
!       }
    }
  
    if (tab_count > sink->text_sink.tab_count) {
diff -rc libXaw3d-master/src/AsciiSrc.c libXaw3dXft-1.6.2/src/AsciiSrc.c
*** libXaw3d-master/src/AsciiSrc.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/AsciiSrc.c	2012-02-25 16:24:08.000000000 +0100
***************
*** 259,265 ****
  ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
  {
    AsciiSrcObject src = (AsciiSrcObject) w;
!   XawTextPosition count, start;
    Piece * piece = FindPiece(src, pos, &start);
  
    text->firstPos = pos;
--- 259,265 ----
  ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
  {
    AsciiSrcObject src = (AsciiSrcObject) w;
!   XawTextPosition count, start = 0;
    Piece * piece = FindPiece(src, pos, &start);
  
    text->firstPos = pos;
***************
*** 284,290 ****
  {
    AsciiSrcObject src = (AsciiSrcObject) w;
    Piece *start_piece, *end_piece, *temp_piece;
!   XawTextPosition start_first, end_first;
    int length, firstPos;
  
  /*
--- 284,290 ----
  {
    AsciiSrcObject src = (AsciiSrcObject) w;
    Piece *start_piece, *end_piece, *temp_piece;
!   XawTextPosition start_first = 0, end_first;
    int length, firstPos;
  
  /*
***************
*** 423,429 ****
    AsciiSrcObject src = (AsciiSrcObject) w;
    int inc;
    Piece* piece;
!   XawTextPosition first, first_eol_position = 0;
    char* ptr;
  
    if (type == XawstAll) {	/* Optomize this common case. */
--- 423,429 ----
    AsciiSrcObject src = (AsciiSrcObject) w;
    int inc;
    Piece* piece;
!   XawTextPosition first = 0, first_eol_position = 0;
    char* ptr;
  
    if (type == XawstAll) {	/* Optomize this common case. */
***************
*** 556,562 ****
    char * ptr;
    Piece * piece;
    char * buf;
!   XawTextPosition first;
  
    if ( dir == XawsdRight )
      inc = 1;
--- 556,562 ----
    char * ptr;
    Piece * piece;
    char * buf;
!   XawTextPosition first = 0;
  
    if ( dir == XawsdRight )
      inc = 1;
diff -rc libXaw3d-master/src/Command.c libXaw3dXft-1.6.2/src/Command.c
*** libXaw3d-master/src/Command.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Command.c	2012-02-25 15:46:22.000000000 +0100
***************
*** 59,64 ****
--- 59,65 ----
  #include <X11/StringDefs.h>
  #include <X11/Xmu/Misc.h>
  #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #include <X11/Xaw3d/CommandP.h>
  #include <X11/Xmu/Converters.h>
  #include <X11/extensions/shape.h>
***************
*** 416,423 ****
  
    if (cbw->command.set) {
      cbw->label.normal_GC = cbw->command.inverse_GC;
!     XFillRectangle(XtDisplay(w), XtWindow(w), cbw->command.normal_GC,
! 		   s, s, cbw->core.width - 2 * s, cbw->core.height - 2 * s);
      region = NULL;		/* Force label to repaint text. */
    }
    else
--- 417,425 ----
  
    if (cbw->command.set) {
      cbw->label.normal_GC = cbw->command.inverse_GC;
!     if (Xaw3dXftButtonInverse)
!         XFillRectangle(XtDisplay(w), XtWindow(w), cbw->command.normal_GC,
! 		       s, s, cbw->core.width - 2 * s, cbw->core.height - 2 * s);
      region = NULL;		/* Force label to repaint text. */
    }
    else
***************
*** 454,462 ****
      else {
        /* wide lines are centered on the path, so indent it */
        int offset = cbw->command.highlight_thickness/2;
!       XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, s + offset, s + offset,
! 		     cbw->core.width - cbw->command.highlight_thickness - 2 * s,
! 		     cbw->core.height - cbw->command.highlight_thickness - 2 * s);
      }
    }
    (*SuperClass->core_class.expose) (w, event, region);
--- 456,484 ----
      else {
        /* wide lines are centered on the path, so indent it */
        int offset = cbw->command.highlight_thickness/2;
!       if (Xaw3dXftButtonDashed) {
!         int i;
!         for (i=0; i<cbw->core.width-cbw->command.highlight_thickness-2*s; ++i)
!     	if (i%3!=0)
!    	  XDrawPoint(XtDisplay(w),XtWindow(w), rev_gc, s + offset+i, s + offset);
!         for (i=0; i<cbw->core.width-cbw->command.highlight_thickness-2*s; ++i)
!    	if (i%3!=0)
!    	  XDrawPoint(XtDisplay(w),XtWindow(w), rev_gc, s+offset+i, 
!                 offset+cbw->core.height - cbw->command.highlight_thickness-s-1);
!    
!         for (i=0; i<cbw->core.height-cbw->command.highlight_thickness-2*s; ++i)
!    	if (i%3!=0)
!    	  XDrawPoint(XtDisplay(w),XtWindow(w), rev_gc, s+offset, s+offset+i);
!    
!         for (i=0; i<cbw->core.height-cbw->command.highlight_thickness-2*s; ++i)
!    	if (i%3!=0)
!    	  XDrawPoint(XtDisplay(w),XtWindow(w), rev_gc, 
!    	     offset+cbw->core.width - cbw->command.highlight_thickness-s-1,
!    	     s+offset+i);
!       } else
! 	  XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, s + offset, s + offset,
! 		         cbw->core.width - cbw->command.highlight_thickness - 2 * s,
! 		     	 cbw->core.height - cbw->command.highlight_thickness - 2 * s);
      }
    }
    (*SuperClass->core_class.expose) (w, event, region);
diff -rc libXaw3d-master/src/Label.c libXaw3dXft-1.6.2/src/Label.c
*** libXaw3d-master/src/Label.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Label.c	2012-02-25 22:54:10.000000000 +0100
***************
*** 59,64 ****
--- 59,65 ----
  #include <X11/StringDefs.h>
  #include <X11/Xos.h>
  #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #include <X11/Xaw3d/Command.h>
  #include <X11/Xaw3d/LabelP.h>
  #include <X11/Xmu/Converters.h>
***************
*** 95,100 ****
--- 96,103 ----
  	offset(label.foreground), XtRString, XtDefaultForeground},
      {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  	offset(label.font),XtRString, XtDefaultFont},
+     {XtNxftFont,  XtCXftFont, XtRString, sizeof(String),
+ 	offset(label.xftfontname),XtRString, NULL},
  #ifdef XAW_INTERNATIONALIZATION
      {XtNfontSet,  XtCFontSet, XtRFontSet, sizeof(XFontSet ),
          offset(label.fontset),XtRString, XtDefaultFontSet},
***************
*** 252,259 ****
  static void
  SetTextWidthAndHeight(LabelWidget lw)
  {
-     XFontStruct	*fs = lw->label.font;
- 
      char *nl;
  
      if (lw->label.pixmap != None) {
--- 255,260 ----
***************
*** 269,274 ****
--- 270,310 ----
  	    return;
  	}
      }
+ 
+     if (Xaw3dXftEncoding) {
+         XftFont *xftfont = lw->label.xftfont;
+         lw->label.label_height = xftfont->height;
+         if (lw->label.label == NULL) {
+             lw->label.label_len = 0;
+             lw->label.label_width = 0;
+         }
+         else if ((nl = index(lw->label.label, '\n')) != NULL) {
+ 	    char *label;
+             lw->label.label_len = MULTI_LINE_LABEL;
+             lw->label.label_width = 0;
+             for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) {
+ 	        int width;
+ 
+                 width = Xaw3dXftTextWidth((Widget)lw, xftfont, label, (int)(nl - label));
+ 	        if (width > (int)lw->label.label_width)
+ 		    lw->label.label_width = width;
+ 	        label = nl + 1;
+ 	        if (*label)
+ 		    lw->label.label_height += xftfont->height;
+ 	    }
+ 	    if (*label) {
+ 	        int width;
+                 width = Xaw3dXftTextWidth((Widget)lw, xftfont, label, strlen(label));
+ 	        if (width > (int) lw->label.label_width)
+ 		    lw->label.label_width = width;
+ 	    }
+         } else {
+ 	    lw->label.label_len = strlen(lw->label.label);
+ 	    lw->label.label_width =
+ 	        Xaw3dXftTextWidth((Widget)lw, xftfont,
+                                   lw->label.label, (int) lw->label.label_len);
+         }
+     } else
  #ifdef XAW_INTERNATIONALIZATION
      if ( lw->simple.international == True ) {
        XFontSet	fset = lw->label.fontset;
***************
*** 308,314 ****
      } else
  #endif
      {
!         lw->label.label_height = fs->max_bounds.ascent + fs->max_bounds.descent;
          if (lw->label.label == NULL) {
              lw->label.label_len = 0;
              lw->label.label_width = 0;
--- 344,351 ----
      } else
  #endif
      {
!         XFontStruct *font = lw->label.font;
!         lw->label.label_height = font->max_bounds.ascent + font->max_bounds.descent;
          if (lw->label.label == NULL) {
              lw->label.label_len = 0;
              lw->label.label_width = 0;
***************
*** 321,343 ****
  	        int width;
  
  	        if (lw->label.encoding)
! 		    width = XTextWidth16(fs, (TXT16*)label, (int)(nl - label)/2);
  	        else
! 		    width = XTextWidth(fs, label, (int)(nl - label));
  	        if (width > (int)lw->label.label_width)
  		    lw->label.label_width = width;
  	        label = nl + 1;
  	        if (*label)
  		    lw->label.label_height +=
! 		        fs->max_bounds.ascent + fs->max_bounds.descent;
  	    }
  	    if (*label) {
! 	        int width = XTextWidth(fs, label, strlen(label));
  
  	        if (lw->label.encoding)
! 		    width = XTextWidth16(fs, (TXT16*)label, (int)strlen(label)/2);
  	        else
! 		    width = XTextWidth(fs, label, strlen(label));
  	        if (width > (int) lw->label.label_width)
  		    lw->label.label_width = width;
  	    }
--- 358,380 ----
  	        int width;
  
  	        if (lw->label.encoding)
! 		    width = XTextWidth16(font, (TXT16*)label, (int)(nl - label)/2);
  	        else
! 		    width = XTextWidth(font, label, (int)(nl - label));
  	        if (width > (int)lw->label.label_width)
  		    lw->label.label_width = width;
  	        label = nl + 1;
  	        if (*label)
  		    lw->label.label_height +=
! 		        font->max_bounds.ascent + font->max_bounds.descent;
  	    }
  	    if (*label) {
! 	        int width = XTextWidth(font, label, strlen(label));
  
  	        if (lw->label.encoding)
! 		    width = XTextWidth16(font, (TXT16*)label, (int)strlen(label)/2);
  	        else
! 		    width = XTextWidth(font, label, strlen(label));
  	        if (width > (int) lw->label.label_width)
  		    lw->label.label_width = width;
  	    }
***************
*** 345,357 ****
  	    lw->label.label_len = strlen(lw->label.label);
  	    if (lw->label.encoding)
  	        lw->label.label_width =
! 		    XTextWidth16(fs, (TXT16*)lw->label.label,
  			         (int) lw->label.label_len/2);
  	    else
  	        lw->label.label_width =
! 		    XTextWidth(fs, lw->label.label, (int) lw->label.label_len);
          }
- 
      }
  }
  
--- 382,393 ----
  	    lw->label.label_len = strlen(lw->label.label);
  	    if (lw->label.encoding)
  	        lw->label.label_width =
! 		    XTextWidth16(font, (TXT16*)lw->label.label,
  			         (int) lw->label.label_len/2);
  	    else
  	        lw->label.label_width =
! 		    XTextWidth(font, lw->label.label, (int) lw->label.label_len);
          }
      }
  }
  
***************
*** 444,449 ****
--- 480,490 ----
  {
      LabelWidget lw = (LabelWidget) new;
  
+     if (Xaw3dXftEncoding)
+ 	lw->label.xftfont = Xaw3dXftGetFont(XtDisplayOfObject(new), lw->label.xftfontname);
+     else
+ 	lw->label.xftfont = NULL;
+ 
      /* disable shadows if we're not a subclass of Command */
      if (!XtIsSubclass(new, commandWidgetClass))
  	lw->threeD.shadow_width = 0;
***************
*** 527,536 ****
      if (w->label.pixmap == None) {
  	int len = w->label.label_len;
  	char *label = w->label.label;
- 	Position y = w->label.label_y + w->label.font->max_bounds.ascent;
  #ifdef XAW_INTERNATIONALIZATION
          Position ksy = w->label.label_y;
  #endif
  
  	/* display left bitmap */
  	if (w->label.left_bitmap && w->label.lbm_width != 0) {
--- 568,581 ----
      if (w->label.pixmap == None) {
  	int len = w->label.label_len;
  	char *label = w->label.label;
  #ifdef XAW_INTERNATIONALIZATION
          Position ksy = w->label.label_y;
  #endif
+ 	Position y;
+ 	if (Xaw3dXftEncoding)
+             y = w->label.label_y + w->label.xftfont->ascent;
+ 	else
+             y = w->label.label_y + w->label.font->max_bounds.ascent;
  
  	/* display left bitmap */
  	if (w->label.left_bitmap && w->label.lbm_width != 0) {
***************
*** 559,566 ****
  			  (int) w->label.lbm_y);
  	}
  
  #ifdef XAW_INTERNATIONALIZATION
!         if ( w->simple.international == True ) {
  
  	    XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset);
  
--- 604,629 ----
  			  (int) w->label.lbm_y);
  	}
  
+ 	if (Xaw3dXftEncoding) {
+ 	    if (len == MULTI_LINE_LABEL) {
+ 	        char *nl;
+ 	        while ((nl = index(label, '\n')) != NULL) {
+ 		    Xaw3dXftDrawString(gw, w->label.xftfont,
+ 				       w->label.label_x, y, 
+ 				       label, (int)(nl - label));
+ 		    y += w->label.xftfont->height;
+ 		    label = nl + 1;
+ 	        }
+ 	        len = strlen(label);
+ 	    }
+ 	    if (len) {
+ 		Xaw3dXftDrawString(gw, w->label.xftfont,
+ 				   w->label.label_x, y,
+ 				   label, len);
+ 	    }
+ 	} else
  #ifdef XAW_INTERNATIONALIZATION
!         if ( w->simple.international == True) {
  
  	    XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset);
  
***************
*** 582,588 ****
  
          } else
  #endif
!         { /* international false, so use R5 routine */
  
  	    if (len == MULTI_LINE_LABEL) {
  	        char *nl;
--- 645,651 ----
  
          } else
  #endif
! 	{ /* international false, so use R5 routine */
  
  	    if (len == MULTI_LINE_LABEL) {
  	        char *nl;
***************
*** 823,828 ****
--- 886,893 ----
  
      if ( lw->label.label != lw->core.name )
  	XtFree( lw->label.label );
+     if (lw->label.xftfont && lw->label.xftfont != Xaw3dXftDefaultFont)
+         XftFontClose(XtDisplayOfObject(w), lw->label.xftfont);
      XtReleaseGC( w, lw->label.normal_GC );
      XtReleaseGC( w, lw->label.gray_GC);
  #ifdef XAW_MULTIPLANE_PIXMAPS
diff -rc libXaw3d-master/src/List.c libXaw3dXft-1.6.2/src/List.c
*** libXaw3d-master/src/List.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/List.c	2012-02-25 23:25:47.000000000 +0100
***************
*** 45,50 ****
--- 45,51 ----
  #include <X11/StringDefs.h>
  #include <X11/Xmu/Drawing.h>
  #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #include <X11/Xaw3d/ListP.h>
  
  /* These added so widget knows whether its height, width are user selected.
***************
*** 83,88 ****
--- 84,91 ----
         offset(simple.cursor), XtRString, "left_ptr"},
      {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  	offset(list.font),XtRString, XtDefaultFont},
+     {XtNxftFont,  XtCXftFont, XtRString, sizeof(String),
+ 	offset(list.xftfontname),XtRString, NULL},
  #ifdef XAW_INTERNATIONALIZATION
      {XtNfontSet,  XtCFontSet, XtRFontSet, sizeof(XFontSet ),
  	offset(list.fontset),XtRString, XtDefaultFontSet},
***************
*** 186,193 ****
  static void
  GetGCs(Widget w)
  {
-     XGCValues	values;
      ListWidget lw = (ListWidget) w;
  
      values.foreground	= lw->list.foreground;
      values.font		= lw->list.font->fid;
--- 189,199 ----
  static void
  GetGCs(Widget w)
  {
      ListWidget lw = (ListWidget) w;
+     XGCValues values;
+     XtGCMask mask;
+     XColor color;
+   
  
      values.foreground	= lw->list.foreground;
      values.font		= lw->list.font->fid;
***************
*** 226,231 ****
--- 232,247 ----
  #endif
          lw->list.graygc = XtGetGC( w, (unsigned) GCFont | GCTile | GCFillStyle,
  			      &values);
+ 
+     if (Xaw3dXftNoHilitReverse) {
+ 	if (!Xaw3dXftHilitColor) Xaw3dXftSetDefaultHilitColor();
+ 	XAllocNamedColor(XtDisplayOfObject(w), w->core.colormap,
+ 			    Xaw3dXftHilitColor, &color, &color); 
+ 	values.foreground = color.pixel;
+ 	values.function = GXxor;
+ 	mask = GCForeground | GCFunction;
+ 	lw->list.hilitgc = XtGetGC(w, mask, &values);
+     }
  }
  
  
***************
*** 371,376 ****
--- 387,396 ----
                          (lw->core.height != 0) * HeightLock +
                          (lw->list.longest != 0) * LongestLock;
  
+     if (Xaw3dXftEncoding)
+ 	lw->list.xftfont = Xaw3dXftGetFont(XtDisplayOfObject(new), lw->list.xftfontname);
+     else
+ 	lw->list.xftfont = NULL;
      GetGCs(new);
  
      /* Set row height. based on font or fontset */
***************
*** 525,530 ****
--- 545,553 ----
          height = height - ( lw->list.internal_height - x );
          y = lw->list.internal_height;
      }
+ 
+     if (Xaw3dXftStringHilight)
+         XClearArea(XtDisplay(w), XtWindow(w), x, y, width, height, False);
      XFillRectangle( XtDisplay( w ), XtWindow( w ), gc, x, y,
  		    width, height );
  }
***************
*** 599,605 ****
      if (item == lw->list.is_highlighted) {
          if (item == lw->list.highlight) {
              gc = lw->list.revgc;
! 	    HighlightBackground(w, x, y, lw->list.normgc);
  	}
          else {
  	    if (XtIsSensitive(w))
--- 622,632 ----
      if (item == lw->list.is_highlighted) {
          if (item == lw->list.highlight) {
              gc = lw->list.revgc;
!             if (Xaw3dXftNoHilitReverse) {
! 		Xaw3dXftStringHilight = 1;
! 		HighlightBackground(w, x, y, lw->list.hilitgc);
! 	    } else
! 		HighlightBackground(w, x, y, lw->list.normgc);
  	}
          else {
  	    if (XtIsSensitive(w))
***************
*** 613,619 ****
      else {
          if (item == lw->list.highlight) {
              gc = lw->list.revgc;
! 	    HighlightBackground(w, x, y, lw->list.normgc);
  	    lw->list.is_highlighted = item;
  	}
  	else {
--- 640,650 ----
      else {
          if (item == lw->list.highlight) {
              gc = lw->list.revgc;
!             if (Xaw3dXftNoHilitReverse) {
! 		Xaw3dXftStringHilight = 1;
! 		HighlightBackground(w, x, y, lw->list.hilitgc);
! 	    } else
! 		HighlightBackground(w, x, y, lw->list.normgc);
  	    lw->list.is_highlighted = item;
  	}
  	else {
***************
*** 636,641 ****
--- 667,677 ----
  
      ClipToShadowInteriorAndLongest( lw, &gc, x );
  
+     if (Xaw3dXftEncoding) {
+ 	Xaw3dXftDrawString(w, lw->list.xftfont, 
+ 			   x, str_y, str, strlen( str ) );
+         Xaw3dXftStringHilight = 0;
+     } else
  #ifdef XAW_INTERNATIONALIZATION
      if ( lw->simple.international == True )
          XmbDrawString( XtDisplay( w ), XtWindow( w ), lw->list.fontset,
***************
*** 1043,1048 ****
--- 1079,1086 ----
      XtReleaseGC(w, lw->list.graygc);
      XtReleaseGC(w, lw->list.revgc);
      XtReleaseGC(w, lw->list.normgc);
+     if (lw->list.xftfont && lw->list.xftfont != Xaw3dXftDefaultFont)
+         XftFontClose(XtDisplayOfObject(w), lw->list.xftfont);
  }
  
  /* Exported Functions */
diff -rc libXaw3d-master/src/Makefile.am libXaw3dXft-1.6.2/src/Makefile.am
*** libXaw3d-master/src/Makefile.am	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Makefile.am	2012-03-04 18:14:53.188670098 +0100
***************
*** 63,68 ****
--- 63,69 ----
  	Vendor.c \
  	Viewport.c \
  	Xaw3dP.c \
+ 	Xaw3dXft.c \
  	XawInit.c \
  	laygram.y \
  	laylex.l \
***************
*** 71,77 ****
  libXaw3d_la_LIBADD = \
  	$(X11_LIBS) $(XPM_LIBS)
  
! libXaw3d_la_LDFLAGS = -version-info 8:0:0 -no-undefined
  
  BUILT_SOURCES = laygram.h
  
--- 72,78 ----
  libXaw3d_la_LIBADD = \
  	$(X11_LIBS) $(XPM_LIBS)
  
! libXaw3d_la_LDFLAGS = -version-info 8:1:0 -no-undefined
  
  BUILT_SOURCES = laygram.h
  
diff -rc libXaw3d-master/src/MultiSink.c libXaw3dXft-1.6.2/src/MultiSink.c
*** libXaw3d-master/src/MultiSink.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/MultiSink.c	2012-02-25 21:52:27.000000000 +0100
***************
*** 579,585 ****
      if ( w->multi_sink.fontset != old_w->multi_sink.fontset ) {
  	((TextWidget)XtParent(new))->text.redisplay_needed = True;
  #ifndef NO_TAB_FIX
! 	SetTabs( w, w->text_sink.tab_count, w->text_sink.char_tabs );
  #endif
      }
  
--- 579,585 ----
      if ( w->multi_sink.fontset != old_w->multi_sink.fontset ) {
  	((TextWidget)XtParent(new))->text.redisplay_needed = True;
  #ifndef NO_TAB_FIX
! 	SetTabs((Widget) w, w->text_sink.tab_count, w->text_sink.char_tabs );
  #endif
      }
  
diff -rc libXaw3d-master/src/MultiSrc.c libXaw3dXft-1.6.2/src/MultiSrc.c
*** libXaw3d-master/src/MultiSrc.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/MultiSrc.c	2012-02-25 20:28:57.000000000 +0100
***************
*** 267,273 ****
  ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
  {
    MultiSrcObject src = (MultiSrcObject) w;
!   XawTextPosition count, start;
    MultiPiece * piece = FindPiece(src, pos, &start);
  
    text->format = XawFmtWide;
--- 267,273 ----
  ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
  {
    MultiSrcObject src = (MultiSrcObject) w;
!   XawTextPosition count, start = 0;
    MultiPiece * piece = FindPiece(src, pos, &start);
  
    text->format = XawFmtWide;
***************
*** 292,298 ****
  {
    MultiSrcObject src = (MultiSrcObject) w;
    MultiPiece *start_piece, *end_piece, *temp_piece;
!   XawTextPosition start_first, end_first;
    int length, firstPos;
    wchar_t *wptr;
    Boolean local_artificial_block = False;
--- 292,298 ----
  {
    MultiSrcObject src = (MultiSrcObject) w;
    MultiPiece *start_piece, *end_piece, *temp_piece;
!   XawTextPosition start_first = 0, end_first;
    int length, firstPos;
    wchar_t *wptr;
    Boolean local_artificial_block = False;
***************
*** 472,478 ****
    MultiSrcObject src = (MultiSrcObject) w;
    int inc;
    MultiPiece * piece;
!   XawTextPosition first, first_eol_position = 0;
    wchar_t * ptr;
  
    if (type == XawstAll) {	/* Optimize this common case. */
--- 472,478 ----
    MultiSrcObject src = (MultiSrcObject) w;
    int inc;
    MultiPiece * piece;
!   XawTextPosition first = 0, first_eol_position = 0;
    wchar_t * ptr;
  
    if (type == XawstAll) {	/* Optimize this common case. */
***************
*** 604,611 ****
    Display * d = XtDisplay(XtParent(w));
    MultiPiece * piece;
    wchar_t* buf;
!   XawTextPosition first;
! 
  
    /* STEP 1: First, a brief sanity check. */
  
--- 604,610 ----
    Display * d = XtDisplay(XtParent(w));
    MultiPiece * piece;
    wchar_t* buf;
!   XawTextPosition first = 0;
  
    /* STEP 1: First, a brief sanity check. */
  
***************
*** 934,940 ****
    mb_string = StorePiecesInString( src );
  
    if ( mb_string != 0 ) {
!       ret = WriteToFile( mb_string, name );
        XtFree( mb_string );
        return( ret );
    }
--- 933,939 ----
    mb_string = StorePiecesInString( src );
  
    if ( mb_string != 0 ) {
!       ret = WriteToFile( mb_string, (char *)name );
        XtFree( mb_string );
        return( ret );
    }
diff -rc libXaw3d-master/src/Scrollbar.c libXaw3dXft-1.6.2/src/Scrollbar.c
*** libXaw3d-master/src/Scrollbar.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Scrollbar.c	2012-03-01 14:45:16.000000000 +0100
***************
*** 78,83 ****
--- 78,85 ----
      "<Btn1Down>:   NotifyScroll()\n\
       <Btn2Down>:   MoveThumb() NotifyThumb() \n\
       <Btn3Down>:   NotifyScroll()\n\
+      <Btn4Down>:   HandleMouseWheel()\n\
+      <Btn5Down>:   HandleMouseWheel()\n\
       <Btn1Motion>: HandleThumb() \n\
       <Btn3Motion>: HandleThumb() \n\
       <Btn2Motion>: MoveThumb() NotifyThumb() \n\
***************
*** 166,171 ****
--- 168,174 ----
  static XtActionsRec actions[] = {
  #ifdef XAW_ARROW_SCROLLBARS
      {"HandleThumb",	HandleThumb},
+     {"HandleMouseWheel",	XawHandleMouseWheel},
  #else
      {"StartScroll",     StartScroll},
  #endif
***************
*** 553,558 ****
--- 556,562 ----
      SetDimensions (sbw);
  #ifdef XAW_ARROW_SCROLLBARS
      sbw->scrollbar.scroll_mode = 0;
+     sbw->scrollbar.scroll_steps = 0;
      sbw->scrollbar.timer_id = (XtIntervalId)0;
  #else
      sbw->scrollbar.direction = 0;
***************
*** 879,884 ****
--- 883,889 ----
      intptr_t call_data;
      Position x, y;
  
+    
      if (sbw->scrollbar.scroll_mode == 2  /* if scroll continuous */
  	|| LookAhead (w, event))
  	return;
***************
*** 917,922 ****
--- 922,956 ----
  	}
      return;
  }
+ 
+ void
+ XawHandleMouseWheel (Widget w, XEvent *event, String *params, Cardinal *num_params)
+ {
+     ScrollbarWidget sbw = (ScrollbarWidget) w;
+     intptr_t call_data; 
+     
+     if (!sbw->scrollbar.scroll_steps)
+ 	return;
+ 
+     if (sbw->scrollbar.orientation != XtorientVertical) 
+ 	return;
+  
+     if (event->xbutton.button != 4 && event->xbutton.button != 5)
+         return;
+ 
+     if (sbw->scrollbar.scroll_mode == 2 /* if scroll continuous */
+ 	|| LookAhead (w, event))
+ 	return;
+ 
+     if (sbw->scrollbar.shown >= 1.0)
+ 	return; 
+ 
+     call_data = sbw->scrollbar.length / sbw->scrollbar.scroll_steps;
+     if (call_data < 5) call_data = 5;
+     if (event->xbutton.button == 4)
+ 	call_data = -call_data;
+     XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data));
+ }
  #else /* XAW_ARROW_SCROLLBARS */
  static void
  NotifyScroll (Widget w, XEvent *event, String *params, Cardinal *num_params)
***************
*** 1098,1104 ****
   ************************************************************/
  
  /* Set the scroll bar to the given location. */
- 
  void XawScrollbarSetThumb (Widget w,
  #if NeedWidePrototypes
  			double top, double shown)
--- 1132,1137 ----
***************
*** 1108,1114 ****
  {
      ScrollbarWidget sbw = (ScrollbarWidget) w;
  
! #ifdef WIERD
      fprintf(stderr,"< XawScrollbarSetThumb w=%p, top=%f, shown=%f\n",
  	    w,top,shown);
  #endif
--- 1141,1147 ----
  {
      ScrollbarWidget sbw = (ScrollbarWidget) w;
  
! #ifdef WEIRD
      fprintf(stderr,"< XawScrollbarSetThumb w=%p, top=%f, shown=%f\n",
  	    w,top,shown);
  #endif
diff -rc libXaw3d-master/src/SimpleMenu.c libXaw3dXft-1.6.2/src/SimpleMenu.c
*** libXaw3d-master/src/SimpleMenu.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/SimpleMenu.c	2012-03-04 17:01:01.073528365 +0100
***************
*** 43,48 ****
--- 43,49 ----
  
  #include <X11/Xaw3d/Xaw3dP.h>
  #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #include <X11/Xaw3d/SimpleMenP.h>
  #include <X11/Xaw3d/SmeBSBP.h>
  #include <X11/Xaw3d/SmeLine.h>
***************
*** 55,60 ****
--- 56,62 ----
  #define streq(a, b)        ( strcmp((a), (b)) == 0 )
  
  #define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field)
+ #define MULTICOLUMN 255
  
  static XtResource resources[] = {
  
***************
*** 298,303 ****
--- 300,306 ----
    smw->simple_menu.current_first = NULL;
    smw->simple_menu.first_y = 0;
    smw->simple_menu.too_tall = FALSE;
+   smw->simple_menu.multicolumn = FALSE;
    smw->simple_menu.sub_menu = NULL;
    smw->simple_menu.state = 0;
  
***************
*** 353,366 ****
      int y, max_y, new_y, dy, s = tdw->threeD.shadow_width;
      Boolean can_paint;
      XPoint point[3];
  
      if (region == NULL)
  	XClearWindow(XtDisplay(w), XtWindow(w));
  
!     if (XtIsRealized((Widget)smw))
  	_ShadowSurroundedBox((Widget)smw, tdw,
  			0, 0, smw->core.width, smw->core.height,
  			tdw->threeD.relief, True);
  
      smw->simple_menu.didnt_fit = False;
      y = 0;
--- 356,387 ----
      int y, max_y, new_y, dy, s = tdw->threeD.shadow_width;
      Boolean can_paint;
      XPoint point[3];
+     static int bw = -1;
+ 
+     memset(&old_pos, 0, sizeof(RectObjPart));
  
      if (region == NULL)
  	XClearWindow(XtDisplay(w), XtWindow(w));
  
!     if (XtIsRealized((Widget)smw)) {
  	_ShadowSurroundedBox((Widget)smw, tdw,
  			0, 0, smw->core.width, smw->core.height,
  			tdw->threeD.relief, True);
+         if (Xaw3dXftBorderHack) {
+ 	    /* work around composition/Xft related bug on some X servers... */
+ 	    if (bw == -1)
+ 	        bw = XtBorderWidth(w);
+             if (bw)
+                 XSetWindowBorderWidth(XtDisplayOfObject(w), 
+                                       XtWindowOfObject(w), 0);
+             for (y=0; y<bw; y++) {
+ 	        dy = 2*y+1;
+                 XDrawRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), 
+                                XtGetGC(w, 0, 0), y, y, 
+                                XtWidth(w)-dy, XtHeight(w)-dy);
+ 	    }
+         }
+     }
  
      smw->simple_menu.didnt_fit = False;
      y = 0;
***************
*** 389,399 ****
  
  		if (smw->simple_menu.current_first != smw->simple_menu.first_entry)
  		{
! 		    point[0].x = (*entry)->rectangle.width / 2;
  		    point[0].y = s + 1;
! 		    point[1].x = (*entry)->rectangle.width / 2 - SMW_ARROW_SIZE / 2;
  		    point[1].y = s + SMW_ARROW_SIZE;
! 		    point[2].x = (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2;
  		    point[2].y = s + SMW_ARROW_SIZE;
  		    XFillPolygon(XtDisplay(w), smw->core.window,
  			    tdw->threeD.bot_shadow_GC, point, 3, Convex,
--- 410,420 ----
  
  		if (smw->simple_menu.current_first != smw->simple_menu.first_entry)
  		{
! 		    point[0].x = (*entry)->rectangle.x + (*entry)->rectangle.width / 2;
  		    point[0].y = s + 1;
! 		    point[1].x = (*entry)->rectangle.x + (*entry)->rectangle.width / 2 - SMW_ARROW_SIZE / 2;
  		    point[1].y = s + SMW_ARROW_SIZE;
! 		    point[2].x = (*entry)->rectangle.x + (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2;
  		    point[2].y = s + SMW_ARROW_SIZE;
  		    XFillPolygon(XtDisplay(w), smw->core.window,
  			    tdw->threeD.bot_shadow_GC, point, 3, Convex,
***************
*** 415,425 ****
  	    if ((*entry)->rectangle.y + (*entry)->rectangle.height + dy > max_y)
  	    {
  		smw->simple_menu.last_y = (*entry)->rectangle.y;
! 		point[0].x = (*entry)->rectangle.width / 2;
  		point[0].y = max_y - 1;
! 		point[1].x = (*entry)->rectangle.width / 2 - SMW_ARROW_SIZE / 2;
  		point[1].y = max_y - SMW_ARROW_SIZE;
! 		point[2].x = (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2;
  		point[2].y = max_y - SMW_ARROW_SIZE;
  		XFillPolygon(XtDisplay(w), smw->core.window,
  			tdw->threeD.bot_shadow_GC, point, 3, Convex,
--- 436,446 ----
  	    if ((*entry)->rectangle.y + (*entry)->rectangle.height + dy > max_y)
  	    {
  		smw->simple_menu.last_y = (*entry)->rectangle.y;
! 		point[0].x = (*entry)->rectangle.x + (*entry)->rectangle.width / 2;
  		point[0].y = max_y - 1;
! 		point[1].x = (*entry)->rectangle.x + (*entry)->rectangle.width / 2 - SMW_ARROW_SIZE / 2;
  		point[1].y = max_y - SMW_ARROW_SIZE;
! 		point[2].x = (*entry)->rectangle.x + (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2;
  		point[2].y = max_y - SMW_ARROW_SIZE;
  		XFillPolygon(XtDisplay(w), smw->core.window,
  			tdw->threeD.bot_shadow_GC, point, 3, Convex,
***************
*** 1023,1031 ****
      SmeObject current_entry, *entry;
      SimpleMenuWidget smw;
      ThreeDWidget tdw;
!     Dimension width, height;
      Boolean do_layout = (height_ret == NULL || width_ret == NULL);
!     Boolean allow_change_size;
      height = 0;
  
      if (XtIsSubclass(w, simpleMenuWidgetClass))
--- 1044,1053 ----
      SmeObject current_entry, *entry;
      SimpleMenuWidget smw;
      ThreeDWidget tdw;
!     Dimension width, height, height_max = 0, scr_height_max, column = 0;
      Boolean do_layout = (height_ret == NULL || width_ret == NULL);
!     Boolean allow_change_size, allow_multi_column;
! 
      height = 0;
  
      if (XtIsSubclass(w, simpleMenuWidgetClass))
***************
*** 1048,1054 ****
  	height = smw->core.height;
      else if (do_layout)
      {
! 	height = smw->simple_menu.top_margin + tdw->threeD.shadow_width;
  
  	ForAllChildren(smw, entry)
  	{
--- 1070,1084 ----
  	height = smw->core.height;
      else if (do_layout)
      {
!         /* width still unset, using it as place holder */
! 	width = smw->simple_menu.top_margin + tdw->threeD.shadow_width;
! 	height = width;
!         scr_height_max =  HeightOfScreen(XtScreen(smw)) 
! 	  - (smw->simple_menu.top_margin + smw->simple_menu.bottom_margin +
! 	     2 * tdw->threeD.shadow_width);
!         /* MultiColumnMenu works only when NoHilitReverse is also set */
! 	allow_multi_column = allow_change_size && 
! 			     Xaw3dXftMultiColumnMenu && Xaw3dXftNoHilitReverse;
  
  	ForAllChildren(smw, entry)
  	{
***************
*** 1057,1069 ****
  	    if (smw->simple_menu.row_height != 0 &&
  			*entry != smw->simple_menu.label)
  		(*entry)->rectangle.height = smw->simple_menu.row_height;
! 
  	    (*entry)->rectangle.y = height;
! 	    (*entry)->rectangle.x = 0;
  	    height += (*entry)->rectangle.height;
  	}
  
! 	height += smw->simple_menu.bottom_margin + tdw->threeD.shadow_width;
      }
      else if (smw->simple_menu.row_height != 0 &&
  		current_entry != smw->simple_menu.label)
--- 1087,1106 ----
  	    if (smw->simple_menu.row_height != 0 &&
  			*entry != smw->simple_menu.label)
  		(*entry)->rectangle.height = smw->simple_menu.row_height;
!             if (allow_multi_column && 
! 		height > scr_height_max - (*entry)->rectangle.height) {
!                 column += 1;
!                 height = width;
! 		smw->simple_menu.multicolumn = TRUE;
! 	    }
  	    (*entry)->rectangle.y = height;
! 	    (*entry)->rectangle.x = column;
  	    height += (*entry)->rectangle.height;
+ 	    if (height > height_max)
+ 	        height_max = height;
  	}
  
! 	height = height_max + smw->simple_menu.bottom_margin + tdw->threeD.shadow_width;
      }
      else if (smw->simple_menu.row_height != 0 &&
  		current_entry != smw->simple_menu.label)
***************
*** 1077,1083 ****
      else if (allow_change_size)
      {
  	SetMarginWidths((Widget)smw);
- 
  	width = GetMenuWidth((Widget)smw, (Widget)NULL);
      }
      else
--- 1114,1119 ----
***************
*** 1085,1101 ****
  
      if (do_layout)
      {
! 	ForAllChildren(smw, entry)
  	    if (XtIsManaged((Widget)*entry))
  		(*entry)->rectangle.width = width;
! 
! 	if (allow_change_size)
  	    MakeSetValuesRequest((Widget) smw, width, height);
      }
      else
      {
! 	*width_ret = width;
! 	if (height != 0) *height_ret = height;
      }
  }
  
--- 1121,1140 ----
  
      if (do_layout)
      {
!         ForAllChildren(smw, entry) {
! 	    (*entry)->rectangle.x = (*entry)->rectangle.x * width;
  	    if (XtIsManaged((Widget)*entry))
  		(*entry)->rectangle.width = width;
! 	}
! 	if (allow_change_size) {
!             width *= (column+1);
  	    MakeSetValuesRequest((Widget) smw, width, height);
+ 	}
      }
      else
      {
!         *width_ret = width;
!         if (height != 0) *height_ret = height;
      }
  }
  
***************
*** 1292,1298 ****
      SimpleMenuWidget smw = (SimpleMenuWidget)w;
      SmeObject *entry;
      SmeBSBObject bsb_entry;
!     Dimension l_mrgn, l_bmw, r_mrgn, r_bmw;
  
      if (smw->simple_menu.left_whitespace || smw->simple_menu.right_whitespace)
      {
--- 1331,1337 ----
      SimpleMenuWidget smw = (SimpleMenuWidget)w;
      SmeObject *entry;
      SmeBSBObject bsb_entry;
!     Dimension l_mrgn = 0, l_bmw, r_mrgn = 0, r_bmw;
  
      if (smw->simple_menu.left_whitespace || smw->simple_menu.right_whitespace)
      {
***************
*** 1446,1451 ****
--- 1485,1491 ----
  	default:
  	    XtAppError(XtWidgetToApplicationContext(w),
  		       "Unknown event type in GetEventEntry().");
+ 	    pos.y = 0;
  	    break;
      }
  
***************
*** 1484,1493 ****
--- 1524,1537 ----
  	if (!XtIsManaged((Widget)*entry)) continue;
  
  	tmp_y = (*entry)->rectangle.y - smw->simple_menu.first_y;
+ 
  	if (tmp_y < y_loc && tmp_y + (int)(*entry)->rectangle.height > y_loc) {
  	    if (*entry == smw->simple_menu.label)
  		return NULL;	/* cannot select the label */
  	    else
+ 	    if (!smw->simple_menu.multicolumn || 
+ 		(x_loc >= (*entry)->rectangle.x && 
+ 		 x_loc <= (*entry)->rectangle.x + (*entry)->rectangle.width))
  		return *entry;
  	}
      }
diff -rc libXaw3d-master/src/SmeBSB.c libXaw3dXft-1.6.2/src/SmeBSB.c
*** libXaw3d-master/src/SmeBSB.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/SmeBSB.c	2012-03-04 16:29:14.006467157 +0100
***************
*** 47,52 ****
--- 47,53 ----
  #include <X11/Xos.h>
  #include <X11/Xmu/Drawing.h>
  #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #include <X11/Xaw3d/ThreeDP.h>
  #include <X11/Xaw3d/SimpleMenP.h>
  #include <X11/Xaw3d/SmeBSBP.h>
***************
*** 81,86 ****
--- 82,89 ----
       offset(foreground), XtRString, XtDefaultForeground},
    {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
       offset(font), XtRString, XtDefaultFont},
+   {XtNxftFont,  XtCXftFont, XtRString, sizeof(String),
+      offset(xftfontname), XtRString, NULL},
  #ifdef XAW_INTERNATIONALIZATION
    {XtNfontSet,  XtCFontSet, XtRFontSet, sizeof(XFontSet ),
       offset(fontset),XtRString, XtDefaultFontSet},
***************
*** 202,207 ****
--- 205,215 ----
  {
      SmeBSBObject entry = (SmeBSBObject) new;
  
+     if (Xaw3dXftEncoding)
+ 	entry->sme_bsb.xftfont = Xaw3dXftGetFont(XtDisplayOfObject(new), entry->sme_bsb.xftfontname);
+     else
+ 	entry->sme_bsb.xftfont = NULL;
+ 
      if (entry->sme_bsb.label == NULL)
  	entry->sme_bsb.label = XtName(new);
      else
***************
*** 257,283 ****
      int	font_ascent = 0, font_descent = 0, y_loc;
  #ifdef XAW_INTERNATIONALIZATION
      int	fontset_ascent = 0, fontset_descent = 0;
!     XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
  #endif
  
      entry->sme_bsb.set_values_area_cleared = FALSE;
  #ifdef XAW_INTERNATIONALIZATION
!     if ( entry->sme.international == True ) {
          fontset_ascent = abs(ext->max_ink_extent.y);
          fontset_descent = ext->max_ink_extent.height - fontset_ascent;
      }
      else
  #endif
!     { /*else, compute size from font like R5*/
          font_ascent = entry->sme_bsb.font->max_bounds.ascent;
          font_descent = entry->sme_bsb.font->max_bounds.descent;
      }
      y_loc = entry->rectangle.y;
  
      if (XtIsSensitive(w) && XtIsSensitive( XtParent(w) ) ) {
  	if ( w == XawSimpleMenuGetActiveEntry(XtParent(w)) ) {
! 	    XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
! 			   entry->sme_bsb.norm_gc, s, y_loc + s,
  			   (unsigned int) entry->rectangle.width - 2 * s,
  			   (unsigned int) entry->rectangle.height - 2 * s);
  	    gc = entry->sme_bsb.rev_gc;
--- 265,301 ----
      int	font_ascent = 0, font_descent = 0, y_loc;
  #ifdef XAW_INTERNATIONALIZATION
      int	fontset_ascent = 0, fontset_descent = 0;
!     XFontSetExtents *ext;
  #endif
  
      entry->sme_bsb.set_values_area_cleared = FALSE;
+ 
  #ifdef XAW_INTERNATIONALIZATION
!     if ( entry->sme.international == True && !Xaw3dXftEncoding) {
!         ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
          fontset_ascent = abs(ext->max_ink_extent.y);
          fontset_descent = ext->max_ink_extent.height - fontset_ascent;
      }
      else
  #endif
!     if (Xaw3dXftEncoding) {
!         font_ascent = entry->sme_bsb.xftfont->ascent;
!         font_descent = entry->sme_bsb.xftfont->descent;
!     } else {
          font_ascent = entry->sme_bsb.font->max_bounds.ascent;
          font_descent = entry->sme_bsb.font->max_bounds.descent;
      }
      y_loc = entry->rectangle.y;
+     entry->sme_bsb.set_values_area_reverse = FALSE;
  
      if (XtIsSensitive(w) && XtIsSensitive( XtParent(w) ) ) {
  	if ( w == XawSimpleMenuGetActiveEntry(XtParent(w)) ) {
! 	    if (Xaw3dXftNoHilitReverse)
! 	        entry->sme_bsb.set_values_area_reverse = True;
!             else
! 	        XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
! 			   entry->sme_bsb.norm_gc,
! 			   entry->rectangle.x + s, y_loc + s,
  			   (unsigned int) entry->rectangle.width - 2 * s,
  			   (unsigned int) entry->rectangle.height - 2 * s);
  	    gc = entry->sme_bsb.rev_gc;
***************
*** 289,295 ****
  	gc = entry->sme_bsb.norm_gray_gc;
  
      if (entry->sme_bsb.label != NULL) {
! 	int x_loc = entry->sme_bsb.left_margin;
  	int len = strlen(entry->sme_bsb.label);
  	int width, t_width;
  	char * label = entry->sme_bsb.label;
--- 307,313 ----
  	gc = entry->sme_bsb.norm_gray_gc;
  
      if (entry->sme_bsb.label != NULL) {
!         int x_loc = entry->rectangle.x + entry->sme_bsb.left_margin;
  	int len = strlen(entry->sme_bsb.label);
  	int width, t_width;
  	char * label = entry->sme_bsb.label;
***************
*** 301,306 ****
--- 319,328 ----
  		    t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
  		else
  #endif
+ 		if (Xaw3dXftEncoding)
+ 		    t_width = Xaw3dXftTextWidth(w, entry->sme_bsb.xftfont,
+ 						label, len);
+ 		else
  		    t_width = XTextWidth(entry->sme_bsb.font, label, len);
  
  		width = entry->rectangle.width -
***************
*** 310,322 ****
  		break;
  	    case XtJustifyRight:
  #ifdef XAW_INTERNATIONALIZATION
! 		if ( entry->sme.international == True )
  		    t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
  		else
  #endif
  		    t_width = XTextWidth(entry->sme_bsb.font, label, len);
  
! 		x_loc = entry->rectangle.width -
  				(entry->sme_bsb.right_margin + t_width);
  		break;
  	    case XtJustifyLeft:
--- 332,348 ----
  		break;
  	    case XtJustifyRight:
  #ifdef XAW_INTERNATIONALIZATION
! 		if (Xaw3dXftEncoding)
! 		    t_width = Xaw3dXftTextWidth(w, entry->sme_bsb.xftfont,
! 						label, len);
! 		else
! 		if ( entry->sme.international == True)
  		    t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
  		else
  #endif
  		    t_width = XTextWidth(entry->sme_bsb.font, label, len);
  
! 		x_loc = entry->rectangle.x + entry->rectangle.width -
  				(entry->sme_bsb.right_margin + t_width);
  		break;
  	    case XtJustifyLeft:
***************
*** 326,331 ****
--- 352,364 ----
  
  	/* this will center the text in the gadget top-to-bottom */
  
+         if (Xaw3dXftEncoding) {
+ 	    y_loc += ((int)entry->rectangle.height - 
+ 			(font_ascent + font_descent)) / 2 + font_ascent;
+ 
+ 	    Xaw3dXftDrawString(w, entry->sme_bsb.xftfont,
+ 			x_loc + s, y_loc, label, len);
+ 	} else
  #ifdef XAW_INTERNATIONALIZATION
          if ( entry->sme.international==True ) {
              y_loc += ((int)entry->rectangle.height -
***************
*** 349,357 ****
  	    int ul_x1_loc = x_loc + s;
  	    int ul_wid;
  
! 	    if (ul != 0)
! 		ul_x1_loc += XTextWidth(entry->sme_bsb.font, label, ul);
! 	    ul_wid = XTextWidth(entry->sme_bsb.font, &label[ul], 1) - 2;
  	    XDrawLine(XtDisplayOfObject(w), XtWindowOfObject(w), gc,
  		      ul_x1_loc, y_loc + 1, ul_x1_loc + ul_wid, y_loc + 1);
  	}
--- 382,396 ----
  	    int ul_x1_loc = x_loc + s;
  	    int ul_wid;
  
! 	    if (Xaw3dXftEncoding) {
! 		if (ul != 0)
! 		    ul_x1_loc += Xaw3dXftTextWidth(w, entry->sme_bsb.xftfont, label, ul);
! 		ul_wid = Xaw3dXftTextWidth(w, entry->sme_bsb.xftfont, &label[ul], 1) - 2;
! 	    } else {
! 		if (ul != 0)
! 		    ul_x1_loc += XTextWidth(entry->sme_bsb.font, label, ul);
! 		ul_wid = XTextWidth(entry->sme_bsb.font, &label[ul], 1) - 2;
! 	    }
  	    XDrawLine(XtDisplayOfObject(w), XtWindowOfObject(w), gc,
  		      ul_x1_loc, y_loc + 1, ul_x1_loc + ul_wid, y_loc + 1);
  	}
***************
*** 552,557 ****
--- 591,605 ----
      SmeBSBObject entry = (SmeBSBObject) w;
      Dimension h;
  
+     if (Xaw3dXftEncoding) {
+         if (entry->sme_bsb.label == NULL)
+ 	    *width = 0;
+         else
+ 	    *width = Xaw3dXftTextWidth(w, entry->sme_bsb.xftfont,
+ 			    entry->sme_bsb.label,
+ 			    strlen(entry->sme_bsb.label));
+         *height = entry->sme_bsb.xftfont->height + Xaw3dXftMenuSpacing;
+     } else
  #ifdef XAW_INTERNATIONALIZATION
      if ( entry->sme.international == True ) {
          XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
***************
*** 569,578 ****
      {
          if (entry->sme_bsb.label == NULL)
  	    *width = 0;
!         else
  	    *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label,
  			    strlen(entry->sme_bsb.label));
- 
          *height = (entry->sme_bsb.font->max_bounds.ascent +
  	       entry->sme_bsb.font->max_bounds.descent);
      }
--- 617,625 ----
      {
          if (entry->sme_bsb.label == NULL)
  	    *width = 0;
! 	else
  	    *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label,
  			    strlen(entry->sme_bsb.label));
          *height = (entry->sme_bsb.font->max_bounds.ascent +
  	       entry->sme_bsb.font->max_bounds.descent);
      }
***************
*** 612,618 ****
   */
  
    if (entry->sme_bsb.left_bitmap != None) {
!     x_loc = entry->sme_threeD.shadow_width +
  		(int)(entry->sme_bsb.left_margin -
  		entry->sme_bsb.left_bitmap_width) / 2;
  
--- 659,665 ----
   */
  
    if (entry->sme_bsb.left_bitmap != None) {
!     x_loc = entry->rectangle.x + entry->sme_threeD.shadow_width +
  		(int)(entry->sme_bsb.left_margin -
  		entry->sme_bsb.left_bitmap_width) / 2;
  
***************
*** 650,656 ****
   */
  
    if (entry->sme_bsb.right_bitmap != None) {
!     x_loc = entry->rectangle.width - entry->sme_threeD.shadow_width -
  		(int)(entry->sme_bsb.right_margin +
  		entry->sme_bsb.right_bitmap_width) / 2;
  
--- 697,704 ----
   */
  
    if (entry->sme_bsb.right_bitmap != None) {
!     x_loc = entry->rectangle.x + entry->rectangle.width - 
! 		entry->sme_threeD.shadow_width -
  		(int)(entry->sme_bsb.right_margin +
  		entry->sme_bsb.right_bitmap_width) / 2;
  
***************
*** 769,777 ****
  #ifdef XAW_INTERNATIONALIZATION
      XtGCMask mask_i18n;
  #endif
  
!     values.foreground = XtParent(w)->core.background_pixel;
!     values.background = entry->sme_bsb.foreground;
      values.font = entry->sme_bsb.font->fid;
      values.graphics_exposures = FALSE;
      mask      = GCForeground | GCBackground | GCGraphicsExposures | GCFont;
--- 817,831 ----
  #ifdef XAW_INTERNATIONALIZATION
      XtGCMask mask_i18n;
  #endif
+     XColor color;
  
!     if (Xaw3dXftNoHilitReverse) {
!         values.background = XtParent(w)->core.background_pixel;
!         values.foreground = entry->sme_bsb.foreground;
!     } else {
!         values.foreground = XtParent(w)->core.background_pixel;
!         values.background = entry->sme_bsb.foreground;
!     }
      values.font = entry->sme_bsb.font->fid;
      values.graphics_exposures = FALSE;
      mask      = GCForeground | GCBackground | GCGraphicsExposures | GCFont;
***************
*** 806,815 ****
  #endif
          entry->sme_bsb.norm_gray_gc = XtGetGC(w, mask, &values);
  
!     values.foreground ^= values.background;
!     values.background = 0;
!     values.function = GXxor;
!     mask = GCForeground | GCBackground | GCGraphicsExposures | GCFunction;
      entry->sme_bsb.invert_gc = XtGetGC(w, mask, &values);
  }
  
--- 860,878 ----
  #endif
          entry->sme_bsb.norm_gray_gc = XtGetGC(w, mask, &values);
  
!     if (Xaw3dXftEncoding) {
! 	if (!Xaw3dXftHilitColor) Xaw3dXftSetDefaultHilitColor();
! 	XAllocNamedColor(XtDisplayOfObject(w), XtParent(w)->core.colormap,
! 			    Xaw3dXftHilitColor, &color, &color); 
! 	values.foreground = color.pixel;
! 	values.function = GXxor;
! 	mask = GCForeground | GCGraphicsExposures | GCFunction;
!     } else {
! 	values.foreground ^= values.background;
! 	values.background = 0;
! 	values.function = GXxor;
! 	mask = GCForeground | GCBackground | GCGraphicsExposures | GCFunction;
!     }
      entry->sme_bsb.invert_gc = XtGetGC(w, mask, &values);
  }
  
***************
*** 845,861 ****
      ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
      Dimension s = tdw->threeD.shadow_width;
  
      if (entry->sme_bsb.set_values_area_cleared) {
  	entry->sme_threeD.shadowed = False;
  	return;
      }
  
!     if (entry->sme_threeD.shadow_width > 0) {
  	(*oclass->sme_threeD_class.shadowdraw) (w);
      } else
! 		XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
  		   entry->sme_bsb.invert_gc,
! 		   s, (int) entry->rectangle.y,
  		   (unsigned int) entry->rectangle.width - 2 * s,
  		   (unsigned int) entry->rectangle.height);
  }
--- 908,933 ----
      ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
      Dimension s = tdw->threeD.shadow_width;
  
+     if (entry->sme_bsb.set_values_area_reverse) {
+       if (!strcmp(XtName((Widget)smw), "popup-menu")) {
+ 	    entry->sme_threeD.shadowed = False;
+             entry->sme_bsb.set_values_area_reverse = False;
+             return;
+ 	}
+     }
+    
      if (entry->sme_bsb.set_values_area_cleared) {
  	entry->sme_threeD.shadowed = False;
  	return;
      }
  
!     if (!Xaw3dXftNoHilitReverse && entry->sme_threeD.shadow_width > 0 &&
! 	entry->rectangle.x == 0) {
  	(*oclass->sme_threeD_class.shadowdraw) (w);
      } else
! 	XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
  		   entry->sme_bsb.invert_gc,
! 		   entry->rectangle.x + s, (int) entry->rectangle.y,
  		   (unsigned int) entry->rectangle.width - 2 * s,
  		   (unsigned int) entry->rectangle.height);
  }
diff -rc libXaw3d-master/src/TextAction.c libXaw3dXft-1.6.2/src/TextAction.c
*** libXaw3d-master/src/TextAction.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/TextAction.c	2012-02-25 22:29:31.000000000 +0100
***************
*** 37,42 ****
--- 37,43 ----
  #include <X11/Xmu/StdSel.h>		/* for XmuConvertStandardSelection */
  #include <X11/Xmu/Atoms.h>		/* for XA_COMPOUND_TEXT */
  #include <X11/Xaw3d/TextP.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #ifdef XAW_INTERNATIONALIZATION
  #include <X11/Xaw3d/MultiSrcP.h>
  #include <X11/Xaw3d/XawImP.h>
***************
*** 364,372 ****
--- 365,398 ----
  Move(TextWidget ctx, XEvent *event, XawTextScanDirection dir,
       XawTextScanType type, Boolean include)
  {
+   XawTextPosition to, from;
+   XawTextBlock text;
+ 
    StartAction(ctx, event);
    ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos,
  				type, dir, ctx->text.mult, include);
+ 
+   /* hack for UTF8 encoding */
+   if (Xaw3dXftEncoding == -1) {
+       if (dir == XawsdLeft) {
+           to = from = ctx->text.insertPos;
+           rep1 : XawTextSourceRead(ctx->text.source, from, &text, 1);
+           if (from>0 && to-from <3 && (*(text.ptr)&0xc0) == 0x80) { 
+               --from; 
+               goto rep1; 
+ 	  }
+           ctx->text.insertPos = from;
+       } else {
+           to = from = ctx->text.insertPos;
+           rep2 : XawTextSourceRead(ctx->text.source, to, &text, 1);
+           if (to-from <3 && (*(text.ptr)&0xc0) == 0x80) { 
+               ++to; 
+               goto rep2; 
+ 	  }
+           ctx->text.insertPos = to;
+       }
+   }
+ 
    EndAction(ctx);
  }
  
***************
*** 860,865 ****
--- 886,892 ----
               XawTextScanType type, Boolean include, Boolean kill)
  {
    XawTextPosition from, to;
+   XawTextBlock text;
  
    StartAction(ctx, event);
    to = SrcScan(ctx->text.source, ctx->text.insertPos,
***************
*** 877,886 ****
  
    if (dir == XawsdLeft) {
      from = to;
      to = ctx->text.insertPos;
    }
!   else
!     from = ctx->text.insertPos;
  
    _DeleteOrKill(ctx, from, to, kill);
    _XawTextSetScrollBars(ctx);
--- 904,930 ----
  
    if (dir == XawsdLeft) {
      from = to;
+     /* hack for UTF8 encoded strings */
+     if (Xaw3dXftEncoding == -1) {
+ 	rep1 : XawTextSourceRead(ctx->text.source, from, &text, 1);
+ 	if (from > 0 && (*(text.ptr)&0xc0) == 0x80) { 
+             --from; 
+             goto rep1; 
+ 	}
+     }
      to = ctx->text.insertPos;
    }
!   else { /* dir == XawsdRight */
!       from = ctx->text.insertPos;
!       /* hack for UTF8 encoded strings */
!       if (Xaw3dXftEncoding == -1) {
!           rep2 : XawTextSourceRead(ctx->text.source, to, &text, 1);
!           if (to-from <4 && (*(text.ptr)&0xc0) == 0x80) { 
!               ++to; 
!               goto rep2; 
! 	  }
!       }
!   }
  
    _DeleteOrKill(ctx, from, to, kill);
    _XawTextSetScrollBars(ctx);
***************
*** 1365,1371 ****
--- 1409,1419 ----
    int count, error;
    KeySym keysym;
    XawTextBlock text;
+   Status status;
  
+   if (Xaw3dXftEncoding == -1)
+       text.length = Xutf8LookupString (ctx->text.xic, (XKeyEvent*)event, strbuf, BUFSIZ, &keysym, &status);
+   else
  #ifdef XAW_INTERNATIONALIZATION
    if (XtIsSubclass (ctx->text.source, (WidgetClass) multiSrcObjectClass))
      text.length = _XawImWcLookupString (w, &event->xkey,
diff -rc libXaw3d-master/src/Text.c libXaw3dXft-1.6.2/src/Text.c
*** libXaw3d-master/src/Text.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Text.c	2012-02-28 17:00:51.000000000 +0100
***************
*** 436,441 ****
--- 436,442 ----
    ctx->text.vbar = vbar =
      XtCreateWidget("vScrollbar", scrollbarWidgetClass, (Widget)ctx,
  		(ArgList) NULL, ZERO);
+ 
    XtAddCallback( vbar, XtNscrollProc, VScroll, (XtPointer)ctx );
    XtAddCallback( vbar, XtNjumpProc, VJump, (XtPointer)ctx );
    if (ctx->text.hbar == NULL)
***************
*** 488,493 ****
--- 489,495 ----
    XtSetArg(args[0], XtNorientation, XtorientHorizontal);
    ctx->text.hbar = hbar =
      XtCreateWidget("hScrollbar", scrollbarWidgetClass, (Widget)ctx, args, ONE);
+ 
    XtAddCallback( hbar, XtNscrollProc, HScroll, (XtPointer)ctx );
    XtAddCallback( hbar, XtNjumpProc, HJump, (XtPointer)ctx );
    if (ctx->text.vbar == NULL)
***************
*** 555,561 ****
    memset(&(ctx->text.s), 0, sizeof(XawTextSelection));
    ctx->text.s.type = XawselectPosition;
    ctx->text.salt = NULL;
!   ctx->text.hbar = ctx->text.vbar = (Widget) NULL;
    ctx->text.lasttime = 0; /* ||| correct? */
    ctx->text.time = 0; /* ||| correct? */
    ctx->text.showposition = TRUE;
--- 557,563 ----
    memset(&(ctx->text.s), 0, sizeof(XawTextSelection));
    ctx->text.s.type = XawselectPosition;
    ctx->text.salt = NULL;
!   ctx->text.hbar = ctx->text.vbar = (Widget) None;
    ctx->text.lasttime = 0; /* ||| correct? */
    ctx->text.time = 0; /* ||| correct? */
    ctx->text.showposition = TRUE;
***************
*** 567,573 ****
    ctx->text.numranges = ctx->text.maxranges = 0;
    ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx));
    ctx->text.hasfocus = FALSE;
!   ctx->text.margin = ctx->text.r_margin; /* Strucure copy. */
    ctx->text.update_disabled = FALSE;
    ctx->text.old_insert = -1;
    ctx->text.mult = 1;
--- 569,575 ----
    ctx->text.numranges = ctx->text.maxranges = 0;
    ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx));
    ctx->text.hasfocus = FALSE;
!   ctx->text.margin = ctx->text.r_margin; /* Structure copy. */
    ctx->text.update_disabled = FALSE;
    ctx->text.old_insert = -1;
    ctx->text.mult = 1;
***************
*** 575,580 ****
--- 577,595 ----
    ctx->text.copy_area_offsets = NULL;
    ctx->text.salt2 = NULL;
  
+   if (Xaw3dXftEncoding == -1) {
+       ctx->text.xim = XOpenIM(XtDisplay((Widget)ctx), NULL, NULL, NULL);
+       ctx->text.xic = XCreateIC(ctx->text.xim,
+ 		          XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
+ 		          XNClientWindow, XtWindow((Widget)ctx),
+ 		          XNFocusWindow,  XtWindow((Widget)ctx),
+ 		          (void*)NULL);
+       Xutf8ResetIC(ctx->text.xic);
+   } else {
+       ctx->text.xim = None;
+       ctx->text.xic = None;
+   }
+ 
    if (ctx->core.height == DEFAULT_TEXT_HEIGHT) {
      ctx->core.height = VMargins(ctx);
      if (ctx->text.sink != NULL)
***************
*** 857,862 ****
--- 872,878 ----
  {
    int fromx, line, width, height;
    XawTextPosition position;
+   XawTextBlock text;
  
    if (ctx->text.lt.lines == 0) return 0;
  
***************
*** 874,879 ****
--- 890,906 ----
    if (position >= ctx->text.lt.info[line + 1].position)
      position = SrcScan(ctx->text.source, ctx->text.lt.info[line + 1].position,
  		       XawstPositions, XawsdLeft, 1, TRUE);
+ 
+   /* UTF8 hack - don't stop in middle of multibyte char */
+   if (Xaw3dXftEncoding == -1) {
+       XawTextPosition from = position;
+       rep : XawTextSourceRead(ctx->text.source, from, &text, 1);
+       if (from>0 && position-from<3 && (*(text.ptr)&0xc0) == 0x80) { 
+           --from; 
+           goto rep; 
+       }
+       position = from;
+   }
    return(position);
  }
  
***************
*** 1691,1697 ****
    return False;
  }
  
! /*	Function Name: GetCutBuffferNumber
   *	Description: Returns the number of the cut buffer.
   *	Arguments: atom - the atom to check.
   *	Returns: the number of the cut buffer representing this atom or
--- 1718,1724 ----
    return False;
  }
  
! /*	Function Name: GetCutBufferNumber
   *	Description: Returns the number of the cut buffer.
   *	Arguments: atom - the atom to check.
   *	Returns: the number of the cut buffer representing this atom or
***************
*** 2833,2838 ****
--- 2860,2869 ----
    DestroyHScrollBar(ctx);
    DestroyVScrollBar(ctx);
  
+   if (ctx->text.xic) XDestroyIC(ctx->text.xic);
+   if (ctx->text.xim) XCloseIM(ctx->text.xim);
+   ctx->text.xic = None;
+   ctx->text.xim = None;
    XtFree((char *)ctx->text.s.selections);
    XtFree((char *)ctx->text.lt.info);
    XtFree((char *)ctx->text.search);
diff -rc libXaw3d-master/src/TextPop.c libXaw3dXft-1.6.2/src/TextPop.c
*** libXaw3d-master/src/TextPop.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/TextPop.c	2012-02-25 20:58:20.000000000 +0100
***************
*** 59,64 ****
--- 59,65 ----
  #include <X11/Xaw3d/Command.h>
  #include <X11/Xaw3d/Form.h>
  #include <X11/Xaw3d/Toggle.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  #include <X11/Xmu/CharSet.h>
  #ifdef XAW_INTERNATIONALIZATION
  #include "XawI18n.h"
***************
*** 608,614 ****
  static void
  AddSearchChildren(Widget form, char *ptr, Widget tw)
  {
!   Arg args[10];
    Cardinal num_args;
    Widget cancel, search_button, s_label, s_text, r_text;
    XtTranslations trans;
--- 609,615 ----
  static void
  AddSearchChildren(Widget form, char *ptr, Widget tw)
  {
!   Arg args[12];
    Cardinal num_args;
    Widget cancel, search_button, s_label, s_text, r_text;
    XtTranslations trans;
***************
*** 678,683 ****
--- 679,687 ----
    num_args = 0;
    XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
    XtSetArg(args[num_args], XtNfromHoriz, s_label); num_args++;
+   if (Xaw3dXftEncoding) {
+       XtSetArg(args[num_args], XtNhorizDistance, 10); num_args++;
+   }
    XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
    XtSetArg(args[num_args], XtNright, XtChainRight); num_args++;
    XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
***************
*** 700,705 ****
--- 704,712 ----
    num_args = 0;
    XtSetArg(args[num_args], XtNfromHoriz, s_label); num_args++;
    XtSetArg(args[num_args], XtNfromVert, s_text); num_args++;
+   if (Xaw3dXftEncoding) {
+       XtSetArg(args[num_args], XtNhorizDistance, 10); num_args++;
+   }
    XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
    XtSetArg(args[num_args], XtNright, XtChainRight); num_args++;
    XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
***************
*** 1262,1298 ****
    Widget popup, form;
    Arg args[5];
    Cardinal num_args;
- 
    num_args = 0;
    XtSetArg(args[num_args], XtNiconName, name); num_args++;
    XtSetArg(args[num_args], XtNgeometry, NULL); num_args++;
    XtSetArg(args[num_args], XtNallowShellResize, TRUE); num_args++;
!   XtSetArg(args[num_args], XtNtransientFor, GetShell(parent)); num_args++;
    popup = XtCreatePopupShell(name, transientShellWidgetClass,
  			     parent, args, num_args);
- 
    form = XtCreateManagedWidget(FORM_NAME, formWidgetClass, popup,
  			       (ArgList)NULL, ZERO);
    XtManageChild (form);
- 
    (*func) (form, ptr, parent);
    return(popup);
  }
  
!  /*	Function Name: GetShell
!   * 	Description: Walks up the widget hierarchy to find the
!   * 		nearest shell widget.
!   * 	Arguments: w - the widget whose parent shell should be returned.
!   * 	Returns: The shell widget among the ancestors of w that is the
!   * 		fewest levels up in the widget hierarchy.
!   */
  
  static Widget
  GetShell(Widget w)
  {
      while ((w != NULL) && !XtIsShell(w))
  	w = XtParent(w);
- 
      return (w);
  }
  
--- 1269,1303 ----
    Widget popup, form;
    Arg args[5];
    Cardinal num_args;
    num_args = 0;
    XtSetArg(args[num_args], XtNiconName, name); num_args++;
    XtSetArg(args[num_args], XtNgeometry, NULL); num_args++;
    XtSetArg(args[num_args], XtNallowShellResize, TRUE); num_args++;
!   XtSetArg(args[num_args], XtNtransientFor, (void *)(GetShell(parent))); num_args++;
! 
    popup = XtCreatePopupShell(name, transientShellWidgetClass,
  			     parent, args, num_args);
    form = XtCreateManagedWidget(FORM_NAME, formWidgetClass, popup,
  			       (ArgList)NULL, ZERO);
    XtManageChild (form);
    (*func) (form, ptr, parent);
+   popup = None;
    return(popup);
  }
  
! /*	Function Name: GetShell
!  * 	Description: Walks up the widget hierarchy to find the
!  * 		nearest shell widget.
!  * 	Arguments: w - the widget whose parent shell should be returned.
!  * 	Returns: The shell widget among the ancestors of w that is the
!  * 		fewest levels up in the widget hierarchy.
!  */
  
  static Widget
  GetShell(Widget w)
  {
      while ((w != NULL) && !XtIsShell(w))
  	w = XtParent(w);
      return (w);
  }
  
diff -rc libXaw3d-master/src/Tip.c libXaw3dXft-1.6.2/src/Tip.c
*** libXaw3d-master/src/Tip.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Tip.c	2012-02-25 23:12:55.000000000 +0100
***************
*** 42,54 ****
  #include <X11/Xmu/Converters.h>
  #include <X11/Xaw3d/TipP.h>
  #include <X11/Xaw3d/XawInit.h>
  
  #include <stdlib.h>
  
  #define	TIP_EVENT_MASK (ButtonPressMask	  |	\
  			ButtonReleaseMask |	\
- 			PointerMotionMask |	\
  			ButtonMotionMask  |	\
  			KeyPressMask	  |	\
  			KeyReleaseMask	  |	\
  			EnterWindowMask	  |	\
--- 42,55 ----
  #include <X11/Xmu/Converters.h>
  #include <X11/Xaw3d/TipP.h>
  #include <X11/Xaw3d/XawInit.h>
+ #include <X11/Xaw3d/Xaw3dXft.h>
  
  #include <stdlib.h>
  
  #define	TIP_EVENT_MASK (ButtonPressMask	  |	\
  			ButtonReleaseMask |	\
  			ButtonMotionMask  |	\
+ /* 			PointerMotionMask |*/	\
  			KeyPressMask	  |	\
  			KeyReleaseMask	  |	\
  			EnterWindowMask	  |	\
***************
*** 109,114 ****
--- 110,117 ----
      offset(foreground), XtRString, XtDefaultForeground},
    {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct*),
      offset(font), XtRString, XtDefaultFont},
+   {XtNxftFont, XtCXftFont, XtRString, sizeof(String),
+     offset(xftfontname), XtRString, NULL},
  #ifdef XAW_INTERNATIONALIZATION
    {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
      offset(fontset), XtRString, XtDefaultFontSet},
***************
*** 125,131 ****
      offset(backing_store), XtRImmediate,
      (XtPointer)(Always + WhenMapped + NotUseful)},
    {XtNtimeout, XtCTimeout, XtRInt, sizeof(int),
!     offset(timeout), XtRImmediate, (XtPointer)500},
  };
  #undef offset
  
--- 128,134 ----
      offset(backing_store), XtRImmediate,
      (XtPointer)(Always + WhenMapped + NotUseful)},
    {XtNtimeout, XtCTimeout, XtRInt, sizeof(int),
!     offset(timeout), XtRImmediate, (XtPointer)1200},
  };
  #undef offset
  
***************
*** 257,262 ****
--- 260,270 ----
  
      tip->tip.gc = XtAllocateGC(w, 0, GCForeground | GCBackground | GCFont |
  			       GCGraphicsExposures, &values, GCFont, 0);
+ 
+     if (Xaw3dXftEncoding)
+ 	tip->tip.xftfont = Xaw3dXftGetFont(XtDisplayOfObject(w), tip->tip.xftfontname);
+     else
+ 	tip->tip.xftfont = NULL;
  }
  
  static void
***************
*** 319,324 ****
--- 327,335 ----
  				XtBorderWidth(w),
  				DefaultDepthOfScreen(XtScreen(w)),
  				InputOutput, CopyFromParent, *mask, attr);
+ 
+     if (Xaw3dXftTipBackgroundColor != -1)
+ 	XtVaSetValues(w, XtNbackground, Xaw3dXftTipBackgroundColor, NULL);
  }
  
  static void
***************
*** 327,337 ****
      TipWidget tip = (TipWidget)w;
      GC gc = tip->tip.gc;
      char *nl, *label = tip->tip.label;
!     Position y = tip->tip.internal_height + tip->tip.font->max_bounds.ascent;
      int len;
  
  #ifdef XAW_INTERNATIONALIZATION
!     if (tip->tip.international == True) {
  	Position ksy = tip->tip.internal_height;
  	XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
  
--- 338,367 ----
      TipWidget tip = (TipWidget)w;
      GC gc = tip->tip.gc;
      char *nl, *label = tip->tip.label;
!     Position y;
      int len;
+     static int bw = -1;
+ 
+     if (Xaw3dXftBorderHack) {
+ 	/* work around composition/Xft related bug on some X servers... */
+         if (bw == -1)
+             bw = XtBorderWidth(w);
+         if (bw)
+             XSetWindowBorderWidth(XtDisplayOfObject(w), XtWindowOfObject(w), 0);
+         for (y=0; y<bw; y++) {
+ 	    len = 2*y + 1;
+             XDrawRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
+                            XtGetGC(w, 0, 0), y, y, 
+                            XtWidth(w)-len, XtHeight(w)-len);
+ 	}
+     }
+ 
+     y = tip->tip.internal_height + ((Xaw3dXftEncoding)?
+ 	tip->tip.xftfont->ascent + Xaw3dXftMenuSpacing : 
+ 	tip->tip.font->max_bounds.ascent );
  
  #ifdef XAW_INTERNATIONALIZATION
!     if (tip->tip.international == True && !Xaw3dXftEncoding) {
  	Position ksy = tip->tip.internal_height;
  	XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
  
***************
*** 351,357 ****
      }
      else
  #endif
!     {
  	while ((nl = index(label, '\n')) != NULL) {
  	    if (tip->tip.encoding)
  		XDrawString16(XtDisplay(w), XtWindow(w), gc,
--- 381,401 ----
      }
      else
  #endif
!     if (Xaw3dXftEncoding) {
! 	bw = XtBorderWidth(w);
! 	while ((nl = index(label, '\n')) != NULL) {
! 	    Xaw3dXftDrawString(w, tip->tip.xftfont, 
! 		tip->tip.internal_width+3, y+Xaw3dXftBorderHack,
! 		label, (int)(nl - label));
! 	    y += tip->tip.xftfont->height + 3*Xaw3dXftMenuSpacing;
! 	    label = nl + 1;
! 	}
! 	len = strlen(label);
! 	if (len)
! 	    Xaw3dXftDrawString(w, tip->tip.xftfont, 
! 		tip->tip.internal_width+3, y+Xaw3dXftBorderHack,
! 		label, len);
!     } else {
  	while ((nl = index(label, '\n')) != NULL) {
  	    if (tip->tip.encoding)
  		XDrawString16(XtDisplay(w), XtWindow(w), gc,
***************
*** 407,418 ****
  static void
  TipLayout(XawTipInfo *info)
  {
!     XFontStruct	*fs = info->tip->tip.font;
      int width = 0, height;
      char *nl, *label = info->tip->tip.label;
  
  #ifdef XAW_INTERNATIONALIZATION
!     if (info->tip->tip.international == True) {
  	XFontSet fset = info->tip->tip.fontset;
  	XFontSetExtents *ext = XExtentsOfFontSet(fset);
  
--- 451,485 ----
  static void
  TipLayout(XawTipInfo *info)
  {
!     XFontStruct	*font = info->tip->tip.font;
!     XftFont *xftfont = info->tip->tip.xftfont;
      int width = 0, height;
      char *nl, *label = info->tip->tip.label;
  
+     if (Xaw3dXftEncoding) {
+ 	height = xftfont->height + 4;
+ 	if ((nl = index(label, '\n')) != NULL) {
+ 	    /*CONSTCOND*/
+ 	    while (True) {
+ 	        int w;
+ 		w = Xaw3dXftTextWidth((Widget)info->tip, 
+                                   xftfont, label, (int)(nl - label));
+ 		if (w > width)
+ 		    width = w;
+ 		if (*nl == '\0')
+ 		    break;
+ 		label = nl + 1;
+ 		if (*label)
+ 		    height += xftfont->height + 3*Xaw3dXftMenuSpacing;
+ 		if ((nl = index(label, '\n')) == NULL)
+ 		    nl = index(label, '\0');
+ 	    }
+ 	}
+ 	else
+ 	    width = Xaw3dXftTextWidth((Widget)info->tip, xftfont, label, strlen(label));
+     } else
  #ifdef XAW_INTERNATIONALIZATION
!     if (info->tip->tip.international == True && !Xaw3dXftEncoding) {
  	XFontSet fset = info->tip->tip.fontset;
  	XFontSetExtents *ext = XExtentsOfFontSet(fset);
  
***************
*** 439,452 ****
      else
  #endif
      {
! 	height = fs->max_bounds.ascent + fs->max_bounds.descent;
  	if ((nl = index(label, '\n')) != NULL) {
  	    /*CONSTCOND*/
  	    while (True) {
  		int w = info->tip->tip.encoding ?
! 			XTextWidth16(fs, (XChar2b*)label,
  				     (int)(nl - label) >> 1) :
! 			XTextWidth(fs, label, (int)(nl - label));
  
  		if (w > width)
  		    width = w;
--- 506,519 ----
      else
  #endif
      {
! 	height = font->max_bounds.ascent + font->max_bounds.descent;
  	if ((nl = index(label, '\n')) != NULL) {
  	    /*CONSTCOND*/
  	    while (True) {
  		int w = info->tip->tip.encoding ?
! 			XTextWidth16(font, (XChar2b*)label,
  				     (int)(nl - label) >> 1) :
! 			XTextWidth(font, label, (int)(nl - label));
  
  		if (w > width)
  		    width = w;
***************
*** 454,470 ****
  		    break;
  		label = nl + 1;
  		if (*label)
! 		    height += fs->max_bounds.ascent + fs->max_bounds.descent;
  		if ((nl = index(label, '\n')) == NULL)
  		    nl = index(label, '\0');
  	    }
  	}
  	else
  	    width = info->tip->tip.encoding ?
! 		    XTextWidth16(fs, (XChar2b*)label, strlen(label) >> 1) :
! 		    XTextWidth(fs, label, strlen(label));
      }
!     XtWidth(info->tip) = width + info->tip->tip.internal_width * 2;
      XtHeight(info->tip) = height + info->tip->tip.internal_height * 2;
  }
  
--- 521,538 ----
  		    break;
  		label = nl + 1;
  		if (*label)
! 		    height += font->max_bounds.ascent + font->max_bounds.descent;
  		if ((nl = index(label, '\n')) == NULL)
  		    nl = index(label, '\0');
  	    }
  	}
  	else
  	    width = info->tip->tip.encoding ?
! 		    XTextWidth16(font, (XChar2b*)label, strlen(label) >> 1) :
! 		    XTextWidth(font, label, strlen(label));
      }
!     XtWidth(info->tip) = width + info->tip->tip.internal_width * 2
! 			 + ((Xaw3dXftEncoding)? 6:0);
      XtHeight(info->tip) = height + info->tip->tip.internal_height * 2;
  }
  
***************
*** 578,584 ****
  	info->tip->tip.timer = 0;
      }
      if (info->mapped) {
! 	XtRemoveGrab(XtParent((Widget)info->tip));
  	XUnmapWindow(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
  	info->mapped = False;
      }
--- 646,653 ----
  	info->tip->tip.timer = 0;
      }
      if (info->mapped) {
! 	if (Xaw3dXftTipDoGrab)
! 	    XtRemoveGrab(XtParent((Widget)info->tip));
  	XUnmapWindow(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
  	info->mapped = False;
      }
***************
*** 613,621 ****
  
      TipLayout(info);
      TipPosition(info);
!     XMapRaised(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
!     XtAddGrab(XtParent((Widget)info->tip), True, True);
!     info->mapped = True;
  }
  
  /*ARGSUSED*/
--- 682,693 ----
  
      TipLayout(info);
      TipPosition(info);
!     if (Xaw3dXftShowTips) {
!         XMapRaised(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
!         if (Xaw3dXftTipDoGrab)
!             XtAddGrab(XtParent((Widget)info->tip), True, True);
!         info->mapped = True;
!     }
  }
  
  /*ARGSUSED*/
diff -rc libXaw3d-master/src/Viewport.c libXaw3dXft-1.6.2/src/Viewport.c
*** libXaw3d-master/src/Viewport.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/Viewport.c	2012-02-25 21:44:18.000000000 +0100
***************
*** 76,81 ****
--- 76,89 ----
  	 offset(usebottom), XtRImmediate, (XtPointer)False},
      {XtNuseRight, XtCBoolean, XtRBoolean, sizeof(Boolean),
  	 offset(useright), XtRImmediate, (XtPointer)False},
+     {XtNsbShiftX1, XtCPosition, XtRPosition, sizeof(Position),
+ 	 offset(sbShiftX1), XtRImmediate, (XtPointer)0},
+     {XtNsbShiftX2, XtCPosition, XtRPosition, sizeof(Position),
+ 	 offset(sbShiftX2), XtRImmediate, (XtPointer)0},
+     {XtNsbShiftY1, XtCPosition, XtRPosition, sizeof(Position),
+ 	 offset(sbShiftY1), XtRImmediate, (XtPointer)0},
+     {XtNsbShiftY2, XtCPosition, XtRPosition, sizeof(Position),
+ 	 offset(sbShiftY2), XtRImmediate, (XtPointer)0},
      {XtNreportCallback, XtCReportCallback, XtRCallback, sizeof(XtPointer),
  	 offset(report_callbacks), XtRImmediate, (XtPointer) NULL},
  };
***************
*** 225,230 ****
--- 233,242 ----
  
      w->viewport.child = (Widget) NULL;
      w->viewport.horiz_bar = w->viewport.vert_bar = (Widget)NULL;
+     w->viewport.sbShiftX1 = 0;
+     w->viewport.sbShiftY1 = 0;
+     w->viewport.sbShiftX2 = 0;
+     w->viewport.sbShiftY2 = 0;
  
  /*
   * Create 3D Widget.
***************
*** 705,719 ****
  	else {
  	    int bw = bar->core.border_width;
  	    XtResizeWidget( bar,
! 			    (Dimension)(clip_width + 2 * sw), bar->core.height,
  			    (Dimension)bw );
! 	    XtMoveWidget( bar,
! 			  (Position)((needsvert && !w->viewport.useright)
! 			   ? w->viewport.vert_bar->core.width + pad
! 			   : -bw),
! 			  (Position)(w->viewport.usebottom
! 			    ? w->core.height - bar->core.height - bw
! 			    : -bw) );
  	    XtSetMappedWhenManaged( bar, True );
  	}
      }
--- 717,731 ----
  	else {
  	    int bw = bar->core.border_width;
  	    XtResizeWidget( bar,
! 			    (Dimension)(clip_width + 2 * sw - 
!                             (w->viewport.sbShiftX1+w->viewport.sbShiftX2)),
!                             bar->core.height,
  			    (Dimension)bw );
! 	    XtMoveWidget( bar, w->viewport.sbShiftX1 +
! 			  (Position)((needsvert && !w->viewport.useright) ?
! 			  w->viewport.vert_bar->core.width + pad : -bw),
! 			  (Position)(w->viewport.usebottom ?
! 			  w->core.height - bar->core.height - bw : -bw) );
  	    XtSetMappedWhenManaged( bar, True );
  	}
      }
***************
*** 729,744 ****
  	}
  	else {
  	    int bw = bar->core.border_width;
! 	    XtResizeWidget( bar,
! 			    bar->core.width, (Dimension)(clip_height + 2 * sw),
  			    (Dimension)bw );
  	    XtMoveWidget( bar,
! 			  (Position)(w->viewport.useright
! 			   ? w->core.width - bar->core.width - bw
! 			   : -bw),
! 			  (Position)((needshoriz && !w->viewport.usebottom)
! 			    ? w->viewport.horiz_bar->core.height + pad
! 			    : -bw) );
  	    XtSetMappedWhenManaged( bar, True );
  	}
      }
--- 741,756 ----
  	}
  	else {
  	    int bw = bar->core.border_width;
! 	    XtResizeWidget( bar, bar->core.width, 
!                             (Dimension)(clip_height + 2 * sw - 
!                             (w->viewport.sbShiftY1+w->viewport.sbShiftY2)),
  			    (Dimension)bw );
  	    XtMoveWidget( bar,
! 			  (Position)(w->viewport.useright ? 
!                           w->core.width - bar->core.width - bw : -bw), 
!                           w->viewport.sbShiftY1 +
! 			  (Position)((needshoriz && !w->viewport.usebottom) ?
! 			  w->viewport.horiz_bar->core.height + pad : -bw) );
  	    XtSetMappedWhenManaged( bar, True );
  	}
      }
diff -rc libXaw3d-master/src/XawIm.c libXaw3dXft-1.6.2/src/XawIm.c
*** libXaw3d-master/src/XawIm.c	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/src/XawIm.c	2012-02-25 21:56:34.000000000 +0100
***************
*** 1373,1379 ****
      if ( !XtIsRealized( w ) || !XtIsVendorShell( w ) ) return;
      if ((ve = GetExtPart( (VendorShellWidget) w ))) {
  	XtAddEventHandler( w, (EventMask)StructureNotifyMask, FALSE,
! 			  XawVendorShellExtResize, (XtPointer)NULL );
  	AllCreateIC(ve);
      }
  }
--- 1373,1380 ----
      if ( !XtIsRealized( w ) || !XtIsVendorShell( w ) ) return;
      if ((ve = GetExtPart( (VendorShellWidget) w ))) {
  	XtAddEventHandler( w, (EventMask)StructureNotifyMask, FALSE,
! 			    (XtEventHandler)XawVendorShellExtResize,
! 			    (XtPointer)NULL );
  	AllCreateIC(ve);
      }
  }
***************
*** 1551,1557 ****
      VendorShellWidget		vw;
  
      if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) {
! 	XawVendorShellExtResize(vw);
      }
  }
  
--- 1552,1558 ----
      VendorShellWidget		vw;
  
      if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) {
! 	XawVendorShellExtResize((Widget)vw);
      }
  }
  
diff -rc libXaw3d-master/xaw3d.pc.in libXaw3dXft-1.6.2/xaw3d.pc.in
*** libXaw3d-master/xaw3d.pc.in	2012-02-29 20:26:06.000000000 +0100
--- libXaw3dXft-1.6.2/xaw3d.pc.in	2012-02-25 14:12:40.000000000 +0100
***************
*** 6,12 ****
  Name: Xaw3d
  Description: X 3D Athena Widgets Library
  Version: @PACKAGE_VERSION@
! Requires: xproto xmu xt
  Requires.private: x11 xext
  Cflags: -I${includedir} @XAW3D_CPPFLAGS@
! Libs: -L${libdir} -lXaw3d
--- 6,12 ----
  Name: Xaw3d
  Description: X 3D Athena Widgets Library
  Version: @PACKAGE_VERSION@
! Requires: xproto xmu xt xft
  Requires.private: x11 xext
  Cflags: -I${includedir} @XAW3D_CPPFLAGS@
! Libs: -L${libdir} -lXaw3d -lXft -lfontconfig
