rpms/iiimf/FC-4 xiiimp-pango.patch,NONE,1.1 iiimf.spec,1.55,1.56

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jul 7 11:52:08 UTC 2005


Author: tagoh

Update of /cvs/dist/rpms/iiimf/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv15459

Modified Files:
	iiimf.spec 
Added Files:
	xiiimp-pango.patch 
Log Message:
* Thu Jul  7 2005 Akira TAGOH <tagoh at redhat.com> - 1:12.2-4.fc4.1
- Backported a patch from devel.
  - xiiimp-pango.patch: applied to show the glyphs on the status window
    and the candidate window with Pango. (#141723)
  - the above patch also contains a fix to get the hotmenu working
    on even iiimx. (#162125)
  - removed the unnecessary/not applied anymore patches:
    - im-sdk-12.1-x-xft-highlight.patch
    - xiiimp-xft-statusarea-147457.patch
    - xiiimp-xft.patch

xiiimp-pango.patch:
 configure.ac            |   12 +
 iiimp/Makefile.am       |    3 
 iiimp/XimpConv.c        |    2 
 iiimp/codeinput.c       |   11 -
 iiimp/guiIMLookup.c     |  448 +++++++++++++++++++++++++++++++++++++++++++++---
 iiimp/guiIMLookup.h     |   17 +
 iiimp/guiIMSts.c        |  137 ++++++++++++++
 iiimp/guiIMSts.h        |   16 +
 iiimp/guiIMStsArea.c    |   19 ++
 iiimp/guiIMStsNothing.c |   20 ++
 iiimp/iiimpAux.c        |    3 
 iiimp/iiimpColor.c      |   56 ++++++
 iiimp/iiimpColor.h      |   15 +
 iiimp/iiimpConv.h       |    2 
 iiimp/popupIM.c         |  149 +++++++++++++++
 iiimp/popupIM.h         |   16 +
 iiimp/xfactory.c        |   43 ++++
 iiimp/xfactory.h        |   10 +
 18 files changed, 935 insertions(+), 44 deletions(-)

--- NEW FILE xiiimp-pango.patch ---
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/configure.ac iiimf-12.2/iiimxcf/xiiimp.so/configure.ac
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/configure.ac	2005-05-02 22:16:12.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/configure.ac	2005-06-24 10:00:04.000000000 +0900
@@ -61,6 +61,16 @@
 IM_CHECK_X
 IM_CHECK_XUTF8API
 
+AC_ARG_ENABLE(pango,
+	AC_HELP_STRING([--disable-pango],
+		[Do not build against Pango for glyph rendering.]),
+	[enable_pango=$enableval],
+	[enable_pango=yes])
+if test "x$enable_pango" = "xyes"; then
+   	PKG_CHECK_MODULES(PANGO, pangoxft pango,
+		AC_DEFINE(HAVE_PANGO,,[enable Pango support]))
+fi
+
 # Checks for library functions.
 #AC_FUNC_MALLOC
 #AC_FUNC_STAT
@@ -104,6 +114,8 @@
 AC_SUBST(XIIIMP_MAJOR_VERSION)
 AC_SUBST(XIIIMP_MINOR_VERSION)
 AC_SUBST(XIIIMP_SOX18N_VERSION)
+AC_SUBST(PANGO_CFLAGS)
+AC_SUBST(PANGO_LIBS)
 
 AC_OUTPUT(Makefile iiimp/Makefile)
 
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/Makefile.am iiimf-12.2/iiimxcf/xiiimp.so/iiimp/Makefile.am
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/Makefile.am	2005-03-03 16:18:18.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/Makefile.am	2005-06-24 12:28:44.000000000 +0900
@@ -1,7 +1,7 @@
 moduledir = $(IMDIR)
 xiiimp_la_CFLAGS = $(X_CFLAGS) -I$(X_PRIVATEINC) \
                    $(SHLIBCFLAGS) $(THREAD_CXX_CFLAGS) \
-                   -I$(CSCONV_DIR)
+                   -I$(CSCONV_DIR) $(PANGO_CFLAGS)
 xiiimp_la_LDFLAGS = -rpath $(moduledir) -version-info $(XIIIMP_SOX18N_VERSION) \
                     -module -export-dynamic -no-undefined
 # On GNU/Linux system, libtool does not take care of -no-undefined so that
@@ -10,6 +10,7 @@
 xiiimp_la_LIBADD = $(X_LIBS)  \
 		   $(IM_LIBDIR)/iiimcf/libiiimcf.la \
 		   $(IM_LIBDIR)/iiimp/libiiimp.la \
+		   $(PANGO_LIBS) \
                    $(DLOPEN_LIBS) $(THREAD_LIBS)
 xiiimp_la_SOURCES = \
 	KeyMap.c \
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/XimpConv.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/XimpConv.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/XimpConv.c	2005-03-11 09:50:06.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/XimpConv.c	2005-06-30 02:43:16.000000000 +0900
@@ -231,7 +231,7 @@
 static unsigned char look[BUF_SIZE] = {0};	/* Clean up bss */
 
 #ifndef MAXINT
-#define MAXINT          (~((unsigned int)1 << (8 * sizeof(int)) - 1))
+#define MAXINT          (~((unsigned int)1 << ((8 * sizeof(int)) - 1)))
 #endif /* !MAXINT */
 
 Public int
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/codeinput.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/codeinput.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/codeinput.c	2004-05-05 03:55:05.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/codeinput.c	2005-06-30 02:50:44.000000000 +0900
@@ -90,7 +90,7 @@
     hook = (LocalPreeditExt *)(ic->local_icpart->preedit_ext);
   }
   {
-    XIMCallback *cb = &ic->core.preedit_attr.start_callback;
+    XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.start_callback;
     int max_len = -1;
     if (cb->callback &&
 	ic->core.input_style & XIMPreeditCallbacks)
@@ -178,8 +178,7 @@
   preedit_draw.feedback_list = 0;
 
   {
-    XIMCallback *cb;
-    cb = &ic->core.preedit_attr.draw_callback;
+    XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.draw_callback;
     if (cb->callback &&
 	ic->core.input_style & XIMPreeditCallbacks)
       (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&call_data);
@@ -210,8 +209,7 @@
     preedit_draw.feedback_list = 0;
 
     {
-      XIMCallback *cb;
-      cb = &ic->core.preedit_attr.draw_callback;
+      XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.draw_callback;
       if (cb->callback &&
 	  ic->core.input_style & XIMPreeditCallbacks)
 	(*cb->callback)((XIC)ic, cb->client_data, (XPointer)&call_data);
@@ -221,8 +219,7 @@
     }
   }
   {
-    XIMCallback *cb;
-    cb = &ic->core.preedit_attr.done_callback;
+    XIMCallback *cb = (XIMCallback *)&ic->core.preedit_attr.done_callback;
     if (cb->callback &&
 	ic->core.input_style & XIMPreeditCallbacks)
       (*cb->callback)((XIC)ic, cb->client_data, NULL);
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c	2005-04-18 18:06:58.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMLookup.c	2005-06-30 05:49:07.000000000 +0900
@@ -39,6 +39,9 @@
 Sun Microsystems, Inc. or its licensors is granted.
 
 */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "xiiimp.h"
 #include "iiimpIM.h"
 #include "iiimpColor.h"
@@ -51,6 +54,10 @@
 #include <X11/keysym.h>
 #include "trace_message.h"
 #include <stdio.h>
+#ifdef HAVE_PANGO
+#include <wchar.h>
+#include <pango/pangoxft.h>
+#endif /* HAVE_PANGO */
 
 static void doneProc(XicCommon ic, XPointer p);
 
@@ -58,6 +65,157 @@
 static void UpdateLookup(XicCommon);
 static void highlightCandidate(XicCommon ic, int, Bool highlight);
 
+#ifdef HAVE_PANGO
+static void
+get_string_pixel_size(XicCommon   ic,
+		      LookupWin   lookup,
+		      const char *string,
+		      size_t      length,
+		      int        *width,
+		      int        *height)
+{
+	PangoLayout *layout = pango_layout_new(lookup->context);
+
+	if (string == NULL || length == 0) {
+		*width = 0;
+		*height = 0;
+		return;
+	}
+	if (lookup->font == NULL)
+		XFactoryCreateDefaultPangoFontDescription(XIM_IIIMP(ic->core.im, default_font_name));
+	pango_layout_set_font_description(layout, lookup->font);
+	pango_layout_set_text(layout, string, length);
+	pango_layout_get_pixel_size(layout, width, height);
+	g_object_unref(layout);
+}
+
+static void
+set_line_attribute_for_pango(XicCommon    ic,
+			     LookupWin    lookup,
+			     XIMFeedback  feedback,
+			     const char  *string,
+			     int          idx,
+			     int         *start_index)
+{
+	PangoAttrList *attrs = pango_layout_get_attributes(lookup->layout);
+	PangoAttribute *fg_attr, *bg_attr;
+
+	if (feedback & XIMReverse) {
+		fg_attr = pango_attr_foreground_new(lookup->bg.color.red,
+						    lookup->bg.color.green,
+						    lookup->bg.color.blue);
+		bg_attr = pango_attr_background_new(lookup->fg.color.red,
+						    lookup->fg.color.green,
+						    lookup->fg.color.blue);
+	} else {
+		fg_attr = pango_attr_foreground_new(lookup->fg.color.red,
+						    lookup->fg.color.green,
+						    lookup->fg.color.blue);
+		bg_attr = pango_attr_background_new(lookup->bg.color.red,
+						    lookup->bg.color.green,
+						    lookup->bg.color.blue);
+	}
+	if (lookup->nrows == 1) {
+		size_t len = strlen(lookup->candidateArray[idx]);
+
+		fg_attr->start_index = *start_index;
+		fg_attr->end_index = *start_index + len;
+		pango_attr_list_change(attrs, fg_attr);
+		bg_attr->start_index = *start_index;
+		bg_attr->end_index = *start_index + len;
+		pango_attr_list_change(attrs, bg_attr);
+		*start_index += len + 1;
+	} else {
+		PangoLayoutLine *line = pango_layout_get_line(lookup->layout, idx);
+
+		fg_attr->start_index = line->start_index;
+		fg_attr->end_index = line->start_index + line->length;
+		pango_attr_list_change(attrs, fg_attr);
+		bg_attr->start_index = line->start_index;
+		bg_attr->end_index = line->start_index + line->length;
+		pango_attr_list_change(attrs, bg_attr);
+	}
+	pango_layout_set_attributes(lookup->layout, attrs);
+}
+
+static char *
+convert_string_to_utf8(XimCommon im, char *string, int length)
+{
+	gchar *retval;
+	wchar_t *wcstr;
+	size_t len;
+
+	if (string == NULL)
+		return NULL;
+	len = strlen(string);
+	if (len <= 0)
+		return NULL;
+	wcstr = (wchar_t *)malloc(sizeof (wchar_t) * (len + 1));
+	if (IIimpMbstoWcs(im, string, len, wcstr, len, NULL) == 0) {
+		free(wcstr);
+		return NULL;
+	}
+	wcstr[length] = 0;
+	retval = g_ucs4_to_utf8((gunichar *)wcstr, len, NULL, NULL, NULL);
+	free(wcstr);
+
+	return retval;
+}
+
+static void
+set_line_attribute2_for_pango(XicCommon         ic,
+			      LookupWin         lookup,
+			      const char       *string,
+			      XIMChoiceObject2 *choice,
+			      int               idx,
+			      int              *start_index)
+{
+	XIMText *label = &choice->label[idx];
+	XIMText *value = &choice->value[idx];
+	IMFeedbackList *pfeedback;
+	PangoAttrList *attrs = pango_layout_get_attributes(lookup->layout);
+	PangoLayoutLine *line = NULL;
+	int i, j;
+	glong size = 0L;
+
+	if (lookup->nrows == 1) {
+		size = *start_index;
+	} else {
+		line = pango_layout_get_line(lookup->layout, idx);
+		size = g_utf8_strlen(string, line->start_index);
+	}
+	/* label */
+	for (pfeedback = choice->label_feedback[idx], i = 0; i < label->length; i++, pfeedback++) {
+		for (j = 1; j < (label->length - i); j++, pfeedback++) {
+			if (SameIMFeedbackList(pfeedback - 1, pfeedback) == False)
+				break;
+		}
+		set_attributes_for_pango(ic, ic->core.im->core.display,
+					 pfeedback, attrs, string,
+					 size + i,
+					 size + j);
+		pango_layout_set_attributes(lookup->layout, attrs);
+		i += j;
+	}
+	size += label->length;
+	/* space */
+	size++;
+  
+	/* value */
+	for (pfeedback = choice->value_feedback[idx], i = 0; i < value->length; pfeedback++) {
+		for (j = 1; j < (value->length - i); j++, pfeedback++) {
+			if (SameIMFeedbackList(pfeedback, pfeedback + 1) == False)
+				break;
+		}
+		set_attributes_for_pango(ic, ic->core.im->core.display,
+					 pfeedback, attrs, string,
+					 size + i,
+					 size + j);
+		pango_layout_set_attributes(lookup->layout, attrs);
+	}
+	*start_index = size;
+}
+#else /* !HAVE_PANGO */
 static void
 DrawLookupString(Display *display, Window win, XFontSet fontset,
 		 GC gc, GC rgc, XIMFeedback feedback,
@@ -158,6 +316,7 @@
 error:
   return;
 }
+#endif /* HAVE_PANGO */
 
 #if 0
 #define xMargin 5
@@ -182,6 +341,42 @@
   return value;
 }
 
+#ifdef HAVE_PANGO
+static int
+getChoiceIndex(XicCommon ic, XEvent *event)
+{
+	LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
+	int x = event->xbutton.x, y = event->xbutton.y;
+	int w, h;
+	int idx, i;
+
+	if (lookup == NULL)
+		return -1;
+
+	pango_layout_xy_to_index(lookup->layout, x * PANGO_SCALE, y * PANGO_SCALE, &idx, NULL);
+	if (lookup->nrows == 1) {
+		for (i = 0, w = 0; i < lookup->ncolumns; i++) {
+			w += strlen(lookup->candidateArray[i]) + 1;
+			if (idx < w)
+				break;
+		}
+		idx = i;
+	} else {
+		/*
+		 * assuming that lookup->ncolumns should be 1
+		 * not sure if multiple rows and multiple columns is possible.
+		 */
+		for (i = 0, h = 0; i < lookup->nrows; i++) {
+			h += strlen(lookup->candidateArray[i]) + 1;
+			if (idx < h)
+				break;
+		}
+		idx = i;
+	}
+
+	return idx;
+}
+#else /* !HAVE_PANGO */
 static int
 getChoiceIndex(XicCommon ic, XEvent *event) {
   LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
@@ -236,6 +431,7 @@
   idx = currentRow * curColumns + currentCol;
   return idx;
 }
+#endif /* HAVE_PANGO */
 
 static void
 selectCandidate(XicCommon ic, int idx) {
@@ -271,7 +467,8 @@
 	 index + 1 to keysym value */
       keysym = XK_0 + idx + 1;
   }
-	  
+
+  printf("%s: keysym %X\n", __FUNCTION__, keysym);
   ev.xkey.x = 0;
   ev.xkey.y = 0;
   ev.xkey.x_root = 0;
@@ -361,6 +558,94 @@
   return True;
 }
 
+#ifdef HAVE_PANGO
+static void
+highlightCandidate(XicCommon ic, int highlight_index, Bool highlight)
+{
+	LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
+
+	lookup->previous = lookup->highlight_index;
+	lookup->current = highlight_index;
+
+	if (highlight_index == lookup->highlight_index) {
+		/* nothing changed */
+		return;
+	}
+
+	UpdateLookup(ic);
+
+	if (highlight) {
+		lookup->highlight_index = highlight_index;
+	} else {
+		lookup->highlight_index = -1;
+	}
+}
+
+static void
+UpdateLookup(XicCommon ic)
+{
+	LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
+	int current_columns = lookup->ncolumns, x = xMargin, y = yMargin, i, baseline, start_index;
+	GString *strings = g_string_new(NULL);
+	PangoAttrList *attrs = NULL;
+	PangoLayoutLine *line;
+	PangoRectangle logrect;
+	PangoLayoutIter *iter = NULL;
+
+	if (lookup->candidates == NULL || lookup->length == 0)
+		return;
+	if (lookup->ncolumns > lookup->length)
+		current_columns = lookup->length;
+	if (lookup->redraw & CONTENTS)
+		XClearArea(ic->core.im->core.display, lookup->window, 0, 0, 0, 0, False);
+
+	if (lookup->nrows == 1) {
+		for (i = 0; i < lookup->length; i++)
+			g_string_append_printf(strings, "%s ", lookup->candidateArray[i]);
+	} else {
+		for (i = 0; i < lookup->length; i++)
+			g_string_append_printf(strings, "%s\n", lookup->candidateArray[i]);
+	}
+	pango_layout_set_font_description(lookup->layout, lookup->font);
+	pango_layout_set_text(lookup->layout, strings->str, strings->len);
+
+	/* set attributes */
+	attrs = pango_attr_list_new();
+	pango_layout_set_attributes(lookup->layout, attrs);
+	for (i = 0, start_index = 0; i < lookup->length; i++) {
+		if (lookup->candidates->label_feedback != NULL &&
+		    lookup->candidates->value_feedback != NULL &&
+		    lookup->candidates->label_feedback[i] != NULL &&
+		    lookup->candidates->value_feedback[i] != NULL) {
+			set_line_attribute2_for_pango(ic, lookup, strings->str, lookup->candidates, i, &start_index);
+		} else {
+			if (i == lookup->current) {
+				set_line_attribute_for_pango(ic, lookup, XIMReverse, strings->str, i, &start_index);
+			} else {
+				set_line_attribute_for_pango(ic, lookup, 0, strings->str, i, &start_index);
+			}
+		}
+	}
+	for (i = 0, iter = pango_layout_get_iter(lookup->layout);
+	     i < lookup->length && iter != NULL;
+	     i++, pango_layout_iter_next_line(iter)) {
+		line = pango_layout_iter_get_line(iter);
+		pango_layout_iter_get_line_extents(iter, NULL, &logrect);
+		baseline = pango_layout_iter_get_baseline(iter);
+		if (i == lookup->current) {
+			pango_xft_render_layout_line(lookup->xftdraw, &lookup->bg, line, x, y + baseline);
+		} else {
+			pango_xft_render_layout_line(lookup->xftdraw, &lookup->fg, line, x, y + baseline);
+		}
+	}
+	if (iter != NULL)
+		pango_layout_iter_free(iter);
+	lookup->redraw = DRAW_ALL;
+
+	pango_attr_list_unref(attrs);
+	g_string_free(strings, TRUE);
+}
+#else /* !HAVE_PANGO */
 static void
 UpdateLookup(XicCommon ic) {
   LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
@@ -514,6 +799,7 @@
 
   return;
 }
+#endif /* HAVE_PANGO */
 
 static Bool
 SetupLookupExt(XicCommon ic) {
@@ -534,12 +820,17 @@
   Display *display = ic->core.im->core.display;
   Window parent, win;
   unsigned long fg, bg;
+#ifndef HAVE_PANGO
   unsigned long val_mask;
   XGCValues gcval;
+#endif /* !HAVE_PANGO */
   LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
   XIMFilterRec filters[10];
   int	n;
   XClassHint class_hint;
+#ifdef HAVE_PANGO
+  int screen = DefaultScreen(display);
+#endif /* HAVE_PANGO */
 
   TRACE_MESSAGE('l', ("SetupLookupWindow: 0x%08x\n", lookup->window));
 
@@ -608,6 +899,22 @@
 
   lookup->window = win;
 
+#ifdef HAVE_PANGO
+  lookup->xftdraw = XftDrawCreate(display, lookup->window,
+				  DefaultVisual(display, screen),
+				  DefaultColormap(display, screen));
+  lookup->fg.color.red = 0;
+  lookup->fg.color.green = 0;
+  lookup->fg.color.blue = 0;
+  lookup->fg.color.alpha = 0xffff;
+  lookup->bg.color.red = 0xffff;
+  lookup->bg.color.green = 0xffff;
+  lookup->bg.color.blue = 0xffff;
+  lookup->bg.color.alpha = 0xffff;
+  lookup->context = pango_xft_get_context(display, screen);
+  lookup->layout = pango_layout_new(lookup->context);
+  lookup->font = XFactoryCreateDefaultPangoFontDescription(XIM_IIIMP(ic->core.im, default_font_name));
+#else /* !HAVE_PANGO */
   val_mask = GCForeground | GCBackground;
   gcval.foreground = fg;
   gcval.background = bg;
@@ -629,6 +936,7 @@
 						   XIM_IIIMP(ic->core.im, default_font_name));
     lookup->need_free_fontset = True;
   }
+#endif /* HAVE_PANGO */
 
   return True;
 }
@@ -638,6 +946,9 @@
   LookupWin lookup = (LookupWin)(ic->gui_icpart->lookup);
   XPoint point;
   int x = 0, y = 0;	/* default */
+#ifdef HAVE_PANGO
+  int width = 0, height = 0;
+#endif /* HAVE_PANGO */
 
   point.x = point.y = 0;	/* default */
   if (XIMP_CHK_PREAREAMASK(ic)) {
@@ -650,6 +961,13 @@
     point.y = -1;
     PreeditCaretPlacement(ic, &point);
     if ((-1 == point.x) && (-1 == point.y)) {
+#ifdef HAVE_PANGO
+      x = ic->core.preedit_attr.spot_location.x;
+      y = ic->core.preedit_attr.spot_location.y;
+      get_string_pixel_size(ic, lookup, " ", 1, &width, &height);
+      y += height;
+      y += yMargin;
+#else /* !HAVE_PANGO */
       XFontSetExtents *fse;
       fse = XExtentsOfFontSet(lookup->fontset);
 
@@ -657,6 +975,7 @@
       y = ic->core.preedit_attr.spot_location.y;
       y += (fse->max_logical_extent.height + fse->max_logical_extent.y);
       y += yMargin;
+#endif /* HAVE_PANGO */
     
       XFactoryGetLocationOnScreen(ic->core.im->core.display,
 				  ic->core.focus_window, x, y, &point);
@@ -679,6 +998,7 @@
       point.y += border_width_return;
   }
 
+#ifndef HAVE_PANGO
   if (lookup->fontset) {
     XFontSetExtents *fse;
     fse = XExtentsOfFontSet(lookup->fontset);
@@ -690,6 +1010,7 @@
       lookup->column_height = height;
     }
   }
+#endif /* !HAVE_PANGO */
 
   x = point.x;
   y = point.y;
@@ -710,6 +1031,7 @@
     XSetWMNormalHints (ic->core.im->core.display,
 		       lookup->window, &hints);
     XMoveWindow(ic->core.im->core.display, lookup->window, x, y);
+    fprintf(stderr, "%s: %dx%d\n", __FUNCTION__, x, y);
   }
   lookup->x = point.x;
   lookup->y = point.y;
@@ -792,12 +1114,12 @@
 FreeLookupData(LookupWin lookup) {
   if (lookup->array_size == 0) return;
 
-  if (lookup->n_choices && lookup->candidates) {
+  if (lookup->length && lookup->candidates) {
     XIMText *label = lookup->candidates->label;
     XIMText *value = lookup->candidates->value;
     int i;
 
-    for (i = 0; i < lookup->n_choices; i++) {
+    for (i = 0; i < lookup->length; i++) {
       if (lookup->candidates->label_feedback)
 	FreeFeedbackList(lookup->candidates->label_feedback[i],
 			 label[i].length);
@@ -850,6 +1172,23 @@
   return;
 }
 
+#ifdef HAVE_PANGO
+static void
+CopyXIMText(XicCommon ic, XIMText *to, XIMText *from)
+{
+	to->length = from->length;
+	to->encoding_is_wchar = False;
+	to->feedback = Xmalloc(sizeof (XIMFeedback) * to->length);
+
+	if (from->encoding_is_wchar == False) {
+		to->string.multi_byte = convert_string_to_utf8((XimCommon)ic->core.im, from->string.multi_byte, to->length);
+	} else {
+		to->string.multi_byte = g_ucs4_to_utf8((gunichar *)from->string.wide_char, wcslen(from->string.wide_char), NULL, NULL, NULL);
+	}
+	memmove((void *)(to->feedback), (void *)(from->feedback),
+		sizeof (XIMFeedback) * to->length);
+}
+#else /* !HAVE_PANGO */
 static void
 CopyXIMText(XicCommon ic, XIMText *to, XIMText *from) {
   to->length = from->length;
@@ -882,11 +1221,12 @@
 		sizeof(XIMFeedback) * to->length);
   return;
 }
+#endif /* HAVE_PANGO */
 
 static Bool
 CopyLookupData(XicCommon ic, LookupWin lookup,
 	       XIMLookupDrawCallbackStruct2 *call_data) {
-  int i;
+  int i, j;
   char *candidate;
   int len;
   int realRow = 0;
@@ -896,6 +1236,10 @@
   XIMText *label;
   IMFeedbackList **value_flist, **label_flist;
   int actual_width = 0;
+#ifdef HAVE_PANGO
+  int height = 0, total_height = 0, width = 0;
+  GString *str = g_string_new(NULL);
+#endif /* HAVE_PANGO */
 
   if (lookup->array_size == 0) {
     lookup->array_size = 26;	/* init size */
@@ -919,8 +1263,8 @@
     return False;
   }
 
-  lookup->candidates->label = Xmalloc(sizeof(XIMText) * lookup->n_choices);
-  lookup->candidates->value = Xmalloc(sizeof(XIMText) * lookup->n_choices);
+  lookup->candidates->label = Xmalloc(sizeof(XIMText) * lookup->length);
+  lookup->candidates->value = Xmalloc(sizeof(XIMText) * lookup->length);
 
   if (!lookup->candidates->label || !lookup->candidates->value) {
     /* something wrong */
@@ -929,18 +1273,18 @@
   if (call_data->choices->label_feedback &&
       call_data->choices->value_feedback) {
     lookup->candidates->label_feedback =
-      Xmalloc(sizeof(IMFeedbackList*) * lookup->n_choices);
+      Xmalloc(sizeof(IMFeedbackList*) * lookup->length);
     lookup->candidates->value_feedback =
-      Xmalloc(sizeof(IMFeedbackList*) * lookup->n_choices);
+      Xmalloc(sizeof(IMFeedbackList*) * lookup->length);
     if(!lookup->candidates->label_feedback ||
        !lookup->candidates->value_feedback) {
       /* something wrong */
       return False;
     }
     memset(lookup->candidates->label_feedback, 0,
-	   sizeof(IMFeedbackList*) * lookup->n_choices);
+	   sizeof(IMFeedbackList*) * lookup->length);
     memset(lookup->candidates->value_feedback, 0,
-	   sizeof(IMFeedbackList*) * lookup->n_choices);
+	   sizeof(IMFeedbackList*) * lookup->length);
   } else {
     lookup->candidates->label_feedback = 0;    
     lookup->candidates->value_feedback = 0;    
@@ -952,20 +1296,20 @@
   value_flist = lookup->candidates->value_feedback;
 
   lookup->maxWidth = 0;
-  for (i = 0; i < lookup->n_choices; i++) {
-    CopyXIMText(ic, &(label[i]), &(call_data->choices->label[i]));
-    CopyXIMText(ic, &(value[i]), &(call_data->choices->value[i]));
+  for (i = lookup->first, j = 0; i < lookup->last + 1 && i < lookup->n_choices; i++, j++) {
+    CopyXIMText(ic, &(label[j]), &(call_data->choices->label[i]));
+    CopyXIMText(ic, &(value[j]), &(call_data->choices->value[i]));
     if (label_flist)
-      CopyFeedbackList(ic, &(label_flist[i]),
+      CopyFeedbackList(ic, &(label_flist[j]),
 		       call_data->choices->label_feedback[i],
-		       label[i].length);
+		       label[j].length);
     if (value_flist)
-      CopyFeedbackList(ic, &(value_flist[i]),
+      CopyFeedbackList(ic, &(value_flist[j]),
 		       call_data->choices->value_feedback[i],
-		       value[i].length);
+		       value[j].length);
 
-    label_str = label[i].string.multi_byte;
-    value_str = value[i].string.multi_byte;
+    label_str = label[j].string.multi_byte;
+    value_str = value[j].string.multi_byte;
     if (call_data->choices->label_decoration != NO_DECORATION) {
       len = (label_str ? strlen(label_str) : 0) +
 	(value_str ? strlen(value_str) : 0) + 5;
@@ -991,15 +1335,24 @@
     }
     if (value_str) strcat(candidate, value_str);
     len = strlen(candidate);
+#ifdef HAVE_PANGO
+    if (lookup->nrows == 1)
+	    g_string_append_printf(str, "%s ", candidate);
+    get_string_pixel_size(ic, lookup, candidate, len, &cand_width, &height);
+    total_height += height;
+    if (lookup->maxWidth < cand_width)
+	    lookup->maxWidth = cand_width;
+#else /* !HAVE_PANGO */
     if (lookup->maxWidth < (cand_width = XmbTextEscapement(lookup->fontset,
 							   candidate, len))) {
       lookup->maxWidth = cand_width;
     }
+#endif /* HAVE_PANGO */
     actual_width += cand_width;
 
-    lookup->candidateArray[i] = candidate;
-    lookup->labelArray[i] = (char*)strdup((label_str ? label_str : ""));
-    lookup->candWidth[i] = cand_width;
+    lookup->candidateArray[j] = candidate;
+    lookup->labelArray[j] = (char*)strdup((label_str ? label_str : ""));
+    lookup->candWidth[j] = cand_width;
     if (i % lookup->ncolumns == 0) {
       realRow++;
     }
@@ -1010,6 +1363,22 @@
     lookup->maxWidth = (lookup->title_width / lookup->ncolumns);
   }
 
+#ifdef HAVE_PANGO
+  if (lookup->nrows == 1) {
+	  get_string_pixel_size(ic, lookup, str->str, str->len, &width, &height);
+	  lookup->width = width;
+  } else {
+	  lookup->width = (lookup->maxWidth + cMargin) * (lookup->length > lookup->ncolumns ?
+							  lookup->ncolumns : lookup->length);
+  }
+  lookup->column_height = total_height / lookup->n_choices;
+  if (lookup->nrows == 1)
+	  lookup->height = lookup->column_height;
+  else
+	  lookup->height = total_height;
+  g_string_free(str, TRUE);
+  resizeLookupWindow(ic);
+#else /* !HAVE_PANGO */
   if (lookup->nrows == 1)
     lookup->width = actual_width + cMargin * (lookup->length > lookup->ncolumns ?
 					      lookup->ncolumns : lookup->length); 
@@ -1019,6 +1388,7 @@
   lookup->height = (lookup->column_height + cMargin) * realRow;
   lookup->width -= cMargin;
   lookup->height -= cMargin;
+#endif /* HAVE_PANGO */
 
   return True;
 }
@@ -1032,7 +1402,7 @@
 
   if (lookup->length == (call_data->last_index - call_data->first_index + 1) &&
       DRAW_NOTHING == (lookup->redraw = CompareLookupData(lookup->candidates,
-							  lookup->first,
+							  0,
 							  call_data->choices,
 							  call_data->first_index,
 							  lookup->length))) {
@@ -1042,18 +1412,19 @@
     lookup->n_choices = call_data->n_choices;
     lookup->first = call_data->first_index;
     lookup->last = call_data->last_index;
+    if (lookup->last >= lookup->n_choices) {
+	    /* is this a bug? */
+	    lookup->last = lookup->n_choices - 1;
+    }
     lookup->length = lookup->last - lookup->first + 1;
 
-    if (lookup->length != lookup->n_choices) 
-      fprintf(stderr, "something is wrong?\n");
-
     if (!CopyLookupData(ic, lookup, call_data)) {
       DestroyLookup(ic, NULL);
       return;
     }
   }
   lookup->previous = lookup->current;
-  lookup->current = call_data->current_index;
+  lookup->current = call_data->current_index - lookup->first;
   return;
 }
 
@@ -1069,16 +1440,22 @@
 
   if ((call_data->title != NULL) && 
       (call_data->title->length != 0)) {
-    int title_width;
+    int title_width = 0;
 
     title_string = call_data->title->string.multi_byte;
 
     if ((lookup->title_width <= 0) ||
 	((NULL != lookup->title) &&
 	 (0 != strcmp(lookup->title, title_string)))) {
+#ifdef HAVE_PANGO
+	    int height = 0;
+
+	    get_string_pixel_size(ic, lookup, title_string, strlen(title_string), &title_width, &height);
+#else /* !HAVE_PANGO */
       title_width = XmbTextEscapement(lookup->fontset,
 				      title_string,
 				      strlen(title_string));
+#endif /* HAVE_PANGO */
       XFactoryRemoveDecorationExceptTitle(display, lookup->window);
       free(lookup->title);
       lookup->title = strdup(title_string);
@@ -1124,10 +1501,23 @@
 
   if (!lookup) return;
 
+#ifdef HAVE_PANGO
+  if (lookup->xftdraw != NULL) {
+	  XftDrawDestroy(lookup->xftdraw);
+	  lookup->xftdraw = NULL;
+  }
+  if (lookup->layout != NULL) {
+	  g_object_unref(lookup->layout);
+	  lookup->layout = NULL;
+  }
+  if (lookup->font != NULL)
+	  XFactoryFreeDefaultPangoFontDescription();
+#else /* !HAVE_PANGO */
   if (lookup->fontset && lookup->need_free_fontset) {
     XFactoryFreeDefaultFontSet (ic->core.im->core.display);
     lookup->need_free_fontset = False;
   }
+#endif /* HAVE_PANGO */
   XDestroyWindow(ic->core.im->core.display,
 		 lookup->window);
   _XUnregisterFilter(ic->core.im->core.display, lookup->window,
@@ -1141,8 +1531,10 @@
   _XUnregisterFilter(ic->core.im->core.display, lookup->window,
 		     FilterButtonRelease, (XPointer)ic);
 
+#ifndef HAVE_PANGO
   if (lookup->gc) XFreeGC(ic->core.im->core.display, lookup->gc);
   if (lookup->rgc) XFreeGC(ic->core.im->core.display, lookup->rgc);
+#endif /* !HAVE_PANGO */
 
   if (lookup->candidateArray) Xfree(lookup->candidateArray);
   if (lookup->labelArray) Xfree(lookup->labelArray);
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h	2004-12-14 13:05:20.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMLookup.h	2005-06-27 10:13:12.000000000 +0900
@@ -41,6 +41,14 @@
 */
 #ifndef _guiIM_LOOKUP_h
 #define _guiIM_LOOKUP_h
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_PANGO
+#include <X11/Xft/Xft.h>
+#include <pango/pango-layout.h>
+#include <pango/pango-font.h>
+#endif /* HAVE_PANGO */
 
 typedef enum {
   DRAW_NOTHING = 0,
@@ -57,10 +65,19 @@
   int		y;
   unsigned int	width;
   unsigned int	height;
+#ifndef HAVE_PANGO
   GC		gc;
   GC		rgc;
   XFontSet	fontset;
   Bool		need_free_fontset;
+#else /* HAVE_PANGO */
+  XftDraw              *xftdraw;
+  XftColor              fg;
+  XftColor              bg;
+  PangoContext         *context;
+  PangoLayout          *layout;
+  PangoFontDescription *font;
+#endif /* !HAVE_PANGO */
   int		nrows;
   int		ncolumns;
   int		choice_per_window;
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMSts.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.c	2005-03-17 19:32:55.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMSts.c	2005-06-28 22:02:28.000000000 +0900
@@ -46,6 +46,9 @@
 #include "XimpIm.h"
 #include "xfactory.h"
 #include <X11/Xatom.h>
+#ifdef HAVE_PANGO
+#include <pango/pangoxft.h>
+#endif /* HAVE_PANGO */
 
 static void UpdateStatus(XicCommon ic, Bool);
 char *MergeStatus(XicCommon ic);
@@ -93,6 +96,42 @@
   return False;
 }
 
+#ifdef HAVE_PANGO
+static void
+draw_status_string_for_pango(XicCommon      ic,
+			     StatusWin      status,
+			     const char    *string,
+			     int            length)
+{
+	IMFeedbackList *pfeedback;
+	int i;
+	PangoAttrList *attrs;
+
+	if (status->feedback != NULL) {
+		attrs = pango_attr_list_new();
+
+		for (i = 0, pfeedback = status->feedback;
+		     i < status->text.length;
+		     i++, pfeedback++) {
+			set_attributes_for_pango(ic, ic->core.im->core.display,
+						 pfeedback, attrs, string, i, i + 1);
+		}
+		pango_layout_set_attributes(status->layout, attrs);
+		pango_attr_list_unref(attrs);
+	} else {
+		attrs = pango_attr_list_new();
+		pango_layout_set_attributes(status->layout, attrs);
+		pango_attr_list_unref(attrs);
+	}
+	pango_layout_set_font_description(status->layout, status->font);
+	pango_layout_set_text(status->layout, string, length);
+	pango_xft_render_layout(status->xftdraw,
+				&status->xftcolor,
+				status->layout,
+				status->x,
+				status->y);
+}
+#else /* !HAVE_PANGO */
 static void
 DrawStatusString(XicCommon ic,
 		 Display *display, Window win, XFontSet fontset,
@@ -131,6 +170,7 @@
  error:
   XmbDrawString(display, win, fontset, gc, x, y, str, str_len);
 }
+#endif /* HAVE_PANGO */
 
 #if defined(USE_FILTER_KEY_PRESS_IN_STATUS)
 static Bool
@@ -172,12 +212,15 @@
 
   memset(&status->status_cache, 0, sizeof(CacheRec));
 
+#ifndef HAVE_PANGO
   status->need_free_fontset = False;
+#endif /* HAVE_PANGO */
 
   ic->gui_icpart->status = (void *)status;
   return True;
 }
 
+#ifndef HAVE_PANGO
 static void
 CreateGC(XicCommon ic) {
   StatusWin status = (StatusWin)(ic->gui_icpart->status);
@@ -220,23 +263,30 @@
 #endif
   return;
 }
+#endif /* !HAVE_PANGO */
 
 void
 UpdateStatus(XicCommon ic, Bool doCache) {
   StatusWin status = (StatusWin)(ic->gui_icpart->status);
   int len;
   char * status_string;
-  status_string = MergeStatus(ic);
-  if (NULL == status_string) return;
-  len = strlen(status_string);
+
   if (!status->window) {
     if (!SetupStatusWindow(ic, ic->core.client_window)) return;
   }
+  status_string = MergeStatus(ic);
+  if (NULL == status_string) return;
+  len = strlen(status_string);
 
+#ifdef HAVE_PANGO
+  if (status->font == NULL)
+	  SetStatusFont(ic, NULL);
+#else /* !HAVE_PANGO */
   if (!status->fontset)
     SetStatusFont(ic, NULL);
   if (!status->fontset)
     return;
+#endif /* HAVE_PANGO */
   if (!MapStatusWindow(ic, status->window))
     return;
 
@@ -250,6 +300,9 @@
 
   XClearArea(ic->core.im->core.display, status->window, 0, 0, 0, 0, False);
 
+#ifdef HAVE_PANGO
+  draw_status_string_for_pango(ic, status, status_string, -1);
+#else /* !HAVE_PANGO */
   if (!status->gc) {
     CreateGC(ic);
     if (!status->gc) return;
@@ -260,6 +313,7 @@
 		   status->gc, status->x, status->y,
 		   status_string, len,
 		   status->feedback, status->text.length);
+#endif /* HAVE_PANGO */
 
   /* status cache */
   status->len = len;
@@ -281,6 +335,9 @@
   XIMFilterRec filters[4];
   int n;
   unsigned int event_mask;
+#ifdef HAVE_PANGO
+  int screen = DefaultScreen(display);
+#endif /* HAVE_PANGO */
   extern Bool popup_button_press(Display *d, Window w, XEvent *ev,
 				 XPointer client_data);
 
@@ -381,6 +438,13 @@
 
     status->window = win;
   }
+#ifdef HAVE_PANGO
+  status->xftdraw = XftDrawCreate(display, status->window,
+				  DefaultVisual(display, screen),
+				  DefaultColormap(display, screen));
+  status->context = pango_xft_get_context(display, screen);
+  status->layout = pango_layout_new(status->context);
+#endif /* HAVE_PANGO */
 #if 0
  {
    unsigned long val_mask;
@@ -400,6 +464,27 @@
   return True;
 }
 
+#ifdef HAVE_PANGO
+void
+SetStatusForeground(XicCommon ic, XPointer call_data)
+{
+}
+
+void
+SetStatusBackground(XicCommon ic, XPointer call_data)
+{
+}
+
+void
+SetStatusFont(XicCommon ic, XPointer call_data)
+{
+	StatusWin status = (StatusWin)(ic->gui_icpart->status);
+
+	if (status != NULL && status->font == NULL) {
+		status->font = XFactoryCreateDefaultPangoFontDescription(XIM_IIIMP(ic->core.im, default_font_name));
+	}
+}
+#else /* !HAVE_PANGO */
 void
 SetStatusForeground(XicCommon ic, XPointer call_data) {
   StatusWin status = (StatusWin)(ic->gui_icpart->status);
@@ -503,6 +588,7 @@
   }
   return;
 }
+#endif /* HAVE_PANGO */
 
 void
 StatusStart(XicCommon ic, XPointer call_data) {
@@ -602,10 +688,23 @@
 
   if (!status) return;
 
+#ifdef HAVE_PANGO
+  if (status->xftdraw != NULL) {
+	  XftDrawDestroy(status->xftdraw);
+	  status->xftdraw = NULL;
+  }
+  if (status->layout != NULL) {
+	  g_object_unref(status->layout);
+	  status->layout = NULL;
+  }
+  if (status->font != NULL)
+	  XFactoryFreeDefaultPangoFontDescription();
+#else /* !HAVE_PANGO */
   if (status->fontset && status->need_free_fontset) {
     XFactoryFreeDefaultFontSet (ic->core.im->core.display);
     status->need_free_fontset = False;
   }
+#endif /* HAVE_PANGO */
   _XUnregisterFilter(ic->core.im->core.display, status->window,
 		     RepaintStatus, (XPointer)ic);
 #if defined(USE_FILTER_KEY_PRESS_IN_STATUS)
@@ -619,10 +718,12 @@
     status->window = 0;
   }
 
+#ifndef HAVE_PANGO
   if (status->gc) XFreeGC(ic->core.im->core.display, status->gc);
 #ifdef USE_STATUS_FEEDBACK
   if (status->rgc) XFreeGC(ic->core.im->core.display, status->rgc);
 #endif
+#endif /* !HAVE_PANGO */
   if (status->text.string.multi_byte) {
     Xfree(status->text.string.multi_byte);
   }
@@ -635,6 +736,35 @@
   return;
 }
 
+#ifdef HAVE_PANGO
+char *
+MergeStatus(XicCommon ic)
+{
+	StatusWin status = (StatusWin)(ic->gui_icpart->status);
+	size_t len = 0;
+	wchar_t *status_string;
+	XimCommon im = (XimCommon)ic->core.im;
+	gchar *retval;
+
+	if (status == NULL)
+		return NULL;
+	if (status->text.string.multi_byte != NULL) {
+		len = strlen(status->text.string.multi_byte);
+	}
+	if (len <= 0)
+		return NULL;
+	status_string = (wchar_t *)malloc(sizeof (wchar_t) * (len + 1));
+	if (IIimpMbstoWcs(im, status->text.string.multi_byte, len, status_string, len, NULL) == 0) {
+		free(status_string);
+		return NULL;
+	}
+	status_string[status->text.length] = 0;
+	retval = g_ucs4_to_utf8((gunichar *)status_string, len, NULL, NULL, NULL);
+	free(status_string);
+
+	return retval;
+}
+#else /* !HAVE_PANGO */
 char *
 MergeStatus(XicCommon ic) {
   StatusWin status = (StatusWin)(ic->gui_icpart->status);
@@ -660,3 +790,4 @@
   *(status_string + len) = '\0';
   return status_string;
 }
+#endif /* HAVE_PANGO */
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.h iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMSts.h
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMSts.h	2001-03-16 00:52:22.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMSts.h	2005-06-24 14:00:22.000000000 +0900
@@ -42,18 +42,34 @@
 #ifndef _guiIM_STS_h
 #define _guiIM_STS_h
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "guiIM.h"
+#ifdef HAVE_PANGO
+#include <X11/Xft/Xft.h>
+#include <pango/pango-layout.h>
+#include <pango/pango-font.h>
+#endif /* HAVE_PANGO */
 
 typedef void (*StatusCB)(XicCommon, XPointer);
 
 typedef struct _StatusWinRec {
   Window 	window;
+#ifndef HAVE_PANGO
   GC		gc;
 #ifdef USE_STATUS_FEEDBACK
   GC		rgc;
 #endif
   XFontSet	fontset;
   Bool		need_free_fontset;
+#else /* HAVE_PANGO */
+  XftDraw              *xftdraw;
+  XftColor              xftcolor;
+  PangoContext         *context;
+  PangoLayout          *layout;
+  PangoFontDescription *font;
+#endif /* !HAVE_PANGO */
   XIMText	text;
   IMFeedbackList  *feedback;
   int		x;
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c	2005-04-18 12:52:01.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMStsArea.c	2005-06-24 13:59:44.000000000 +0900
@@ -39,6 +39,9 @@
 Sun Microsystems, Inc. or its licensors is granted.
 
 */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "xiiimp.h"
 #include "guiIMSts.h"
 #include "XimpIm.h"
@@ -90,6 +93,14 @@
 
   status_cache = (CacheRec*)&(status->status_cache);
 
+#ifdef HAVE_PANGO
+  if (status_cache->win_x == ic->core.status_attr.area.x &&
+      status_cache->win_y == ic->core.status_attr.area.y &&
+      status_cache->win_width == ic->core.status_attr.area.width &&
+      status_cache->win_height == ic->core.status_attr.area.height) {
+	  return;
+  }
+#else /* !HAVE_PANGO */
   if (status_cache->win_x == ic->core.status_attr.area.x &&
       status_cache->win_y == ic->core.status_attr.area.y &&
       status_cache->win_width == ic->core.status_attr.area.width &&
@@ -97,9 +108,14 @@
       status_cache->font_set == status->fontset) {
     return;
   }
+#endif /* HAVE_PANGO */
       
   status->x = 0;
 
+#ifdef HAVE_PANGO
+  if (status->font == NULL)
+	  SetStatusFont(ic, NULL);
+#else /* !HAVE_PANGO */
   if (!status->fontset) {
     SetStatusFont(ic, NULL);
   }
@@ -114,6 +130,7 @@
   } else {
     status->y = ic->core.status_attr.area.height;
   }
+#endif /* HAVE_PANGO */
 
   if (!status->window)
     SetupStatusWindow(ic, ic->core.client_window);
@@ -129,7 +146,9 @@
   status_cache->win_y = ic->core.status_attr.area.y;
   status_cache->win_width = ic->core.status_attr.area.width;
   status_cache->win_height = ic->core.status_attr.area.height;
+#ifndef HAVE_PANGO
   status_cache->font_set = status->fontset;
+#endif /* !HAVE_PANGO */
 
   return;
 }
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c	2005-03-22 07:42:57.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/guiIMStsNothing.c	2005-06-29 13:51:06.000000000 +0900
@@ -39,6 +39,9 @@
 Sun Microsystems, Inc. or its licensors is granted.
 
 */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "xiiimp.h"
 #include "guiIMSts.h"
 #include "XimpIm.h"
@@ -168,23 +171,38 @@
       y = win_att.y;
       y += win_att.height;
 
+#ifdef HAVE_PANGO
+      if (status->font == NULL)
+	      SetStatusFont(ic, NULL);
+#else /* !HAVE_PANGO */
       if (!status->fontset)
 	SetStatusFont(ic, NULL);
 
       if (!status->fontset)
 	return;
+#endif /* HAVE_PANGO */
 
       status_string = MergeStatus(ic);
       len = ((NULL == status_string) ? 0 : strlen(status_string));
       if (0 < len) {
+#ifdef HAVE_PANGO
+	      PangoLayout *layout = pango_layout_new(status->context);
+
+	      pango_layout_set_font_description(layout, status->font);
+	      pango_layout_set_text(layout, status_string, len);
+	      pango_layout_get_pixel_size(layout, &width, &height);
+	      g_object_unref(layout);
+#else /* !HAVE_PANGO */
 	XFontSetExtents *fse;
 	fse = XExtentsOfFontSet(status->fontset);
 	width = XmbTextEscapement(status->fontset,
 				  status_string,
 				  len);
 	height = fse->max_logical_extent.height;
+#endif /* HAVE_PANGO */
       }
-      Xfree(status_string);
+      if (status_string != NULL)
+	      Xfree(status_string);
       /* avoid creating 0 width/height or too large status window */
       if (width == 0 || width > 1000) width = 100;
       if (height == 0 || height > 1000) height = 15;
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpAux.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpAux.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpAux.c	2005-03-22 07:42:57.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpAux.c	2005-06-30 01:31:36.000000000 +0900
@@ -169,6 +169,7 @@
 aux_string_length(
     const IIIMP_card16 *str
 );
+static void show_AC(aux_data_t *pad);
 
 /* faked "COMPOSED":-P structure.  */
 typedef struct {
@@ -1468,7 +1469,6 @@
 	const IIIMP_card16 **pstrs;
 
 #ifdef ENABLE_TRACE
-	static void show_AC(aux_data_t *pad);
 	show_AC(pac->pad);
 #endif
 	if (pad->integer_count > 0) {
@@ -1530,7 +1530,6 @@
 	const IIIMP_card16 **pstrs;
 
 #ifdef ENABLE_TRACE
-	static void show_AC(aux_data_t *pad);
 	show_AC(pac->pad);
 #endif
 	if (pad->integer_count > 0) {
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpColor.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.c	2004-05-05 03:55:05.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpColor.c	2005-06-28 21:56:18.000000000 +0900
@@ -64,6 +64,62 @@
   BG_COLOR = (1L << 2)
 } IMSetColor;
 
+#ifdef HAVE_PANGO
+void
+set_attributes_for_pango(XicCommon       ic,
+			 Display        *dpy,
+			 IMFeedbackList *flist,
+			 PangoAttrList  *attrs,
+			 const char     *str,
+			 int             start_pos,
+			 int             end_pos)
+{
+	XColor color;
+	Colormap cmap;
+	int i;
+	unsigned short r, g, b;
+	char colorName[20];		/* enough */
+	const char *formater = "#%2.2lX%2.2lX%2.2lX";
+	PangoAttribute *attr;
+	int start_index = g_utf8_offset_to_pointer(str, start_pos) - str;
+	int end_index = g_utf8_offset_to_pointer(str, end_pos) - str;
+
+	cmap = DefaultColormap(dpy, XIC_GUI(ic, screen_number));
+	for (i = 0; i < flist->count_feedbacks; i++) {
+		r = (flist->feedbacks[i].value & 0x00ff0000) >> 16;
+		g = (flist->feedbacks[i].value & 0x0000ff00) >> 8;
+		b = flist->feedbacks[i].value & 0x000000ff;
+		sprintf(colorName, formater, r, g, b);
+		if (XParseColor(dpy, cmap, colorName, &color)) {
+			XAllocColor(dpy, cmap, &color);
+
+			switch (flist->feedbacks[i].type) {
+			    case IM_FOREGROUND_RGB_FEEDBACK:
+				    attr = pango_attr_foreground_new(r, g, b);
+				    attr->start_index = start_index;
+				    attr->end_index = end_index;
+				    pango_attr_list_change(attrs, attr);
+				    break;
+			    case IM_BACKGROUND_RGB_FEEDBACK:
+				    attr = pango_attr_background_new(r, g, b);
+				    attr->start_index = start_index;
+				    attr->end_index = end_index;
+				    pango_attr_list_change(attrs, attr);
+				    break;
+			    case IM_UNDERLINE_RGB_FEEDBACK:
+				    attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+				    attr->start_index = start_index;
+				    attr->end_index = end_index;
+				    pango_attr_list_change(attrs, attr);
+				    break;
+			    default:
+				    break;
+			}
+		}
+	}
+}
+#endif /* HAVE_PANGO */
+
 int
 SetIMColors(XicCommon ic,
 	    Display *display, Window win, GC gc, GC rgc,
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.h iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpColor.h
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpColor.h	2004-11-05 17:16:21.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpColor.h	2005-06-28 21:58:07.000000000 +0900
@@ -47,12 +47,27 @@
 #ifndef _IIIMP_COLOR_H
 #define _IIIMP_COLOR_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <X11/X.h>
 #include <X11/Xlib.h>
 #include "xiiimp.h"
 #include "commonIM.h"
+#ifdef HAVE_PANGO
+#include <pango/pango-attributes.h>
+#endif /* HAVE_PANGO */
 
 extern Bool	SameIMFeedbackList(IMFeedbackList *a, IMFeedbackList *b);
+#ifdef HAVE_PANGO
+void            set_attributes_for_pango(XicCommon       ic,
+					 Display        *dpy,
+					 IMFeedbackList *flist,
+					 PangoAttrList  *attrs,
+					 const char     *str,
+					 int             start_pos,
+					 int             end_pos);
+#endif /* HAVE_PANGO */
 extern int	SetIMColors(XicCommon ic,
 			    Display *display, Window win, GC gc, GC rgc,
 			    IMFeedbackList *flist, XIMFeedback unused);
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpConv.h iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpConv.h
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/iiimpConv.h	2005-03-07 18:09:42.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/iiimpConv.h	2005-06-30 02:54:22.000000000 +0900
@@ -62,4 +62,4 @@
     char **pstr
 );
 
-#endif _IIIMP_CONV_H
+#endif /* _IIIMP_CONV_H */
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/popupIM.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/popupIM.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/popupIM.c	2005-03-03 16:18:18.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/popupIM.c	2005-06-30 06:11:52.000000000 +0900
@@ -84,6 +84,21 @@
   return True;
 }
 
+#ifdef HAVE_PANGO
+static PangoFontDescription *
+status_window_font_description(XicCommon ic)
+{
+	PangoFontDescription *font = NULL;
+	StatusWin status;
+
+	SetStatusFont(ic, NULL);
+	status = (StatusWin)ic->gui_icpart->status;
+	if (status != NULL)
+		font = status->font;
+
+	return font;
+}
+#else /* !HAVE_PANGO */
 static XFontSet
 status_window_fontset(XicCommon ic) {
   XFontSet fs = 0;
@@ -97,11 +112,16 @@
   }
   return fs;
 }
+#endif /* HAVE_PANGO */
 
 static unsigned int
 status_window_height(XicCommon ic) {
   unsigned int height = ic->core.status_attr.area.height;
   if (height == 0) {
+#ifdef HAVE_PANGO
+#warning FIXME: need to calculate height here
+	  fprintf(stderr, "%s: FIXME: need to calculate height here.\n", __FUNCTION__);
+#else /* !HAVE_PANGO */
     XFontSet fs;
     if ((fs = status_window_fontset(ic))) {
       XFontSetExtents *fse;
@@ -109,6 +129,7 @@
       height = fse->max_logical_extent.height;
       height += (fse->max_ink_extent.height + fse->max_ink_extent.y);
     }
+#endif /* HAVE_PANGO */
   }
   if (height == 0) height = 19;	/* may not work */
   return height;
@@ -172,6 +193,54 @@
   {"zh_TW", "[ T-Chinese ]"}
 };
 
+#ifdef HAVE_PANGO
+static void
+draw_text_for_pango(XicCommon             ic,
+		    PangoFontDescription *font,
+		    int                   x,
+		    int                   y,
+		    XftColor             *fg,
+		    XftColor             *bg,
+		    char                 *utf8_text)
+{
+	PangoAttrList *attrs = pango_attr_list_new();
+	PangoAttribute *attr;
+	size_t len = strlen(utf8_text);
+
+	attr = pango_attr_foreground_new(fg->color.red, fg->color.green, fg->color.blue);
+	attr->start_index = 0;
+	attr->end_index = len;
+	pango_attr_list_change(attrs, attr);
+	attr = pango_attr_background_new(bg->color.red, bg->color.green, bg->color.blue);
+	attr->start_index = 0;
+	attr->end_index = len;
+	pango_attr_list_change(attrs, attr);
+	pango_layout_set_attributes(XIM_POPUP(ic->core.im, layout), attrs);
+	pango_layout_set_font_description(XIM_POPUP(ic->core.im, layout), font);
+	pango_layout_set_text(XIM_POPUP(ic->core.im, layout), utf8_text, -1);
+	pango_xft_render_layout(XIM_POPUP(ic->core.im, xftdraw), fg, XIM_POPUP(ic->core.im, layout), x, y);
+}
+
+static unsigned int
+text_escapement_for_pango(XicCommon             ic,
+			  PangoFontDescription *font,
+			  char                 *utf8_text)
+{
+	StatusWin status = (StatusWin)ic->gui_icpart->status;
+	PangoLayout *layout;
+	int width = 0;
+
+	if (utf8_text == NULL || strlen(utf8_text) == 0)
+		return 0;
+	layout = pango_layout_new(status->context);
+	pango_layout_set_font_description(layout, font);
+	pango_layout_set_text(layout, utf8_text, -1);
+	pango_layout_get_pixel_size(layout, &width, NULL);
+	g_object_unref(layout);
+
+	return width;
+}
+#else /* !HAVE_PANGO */
 static void
 DrawText(XicCommon ic, XFontSet fs, GC gc, int x, int y,
 	 char *utf8_text)
@@ -216,6 +285,7 @@
   }
   return XmbTextEscapement(fs, utf8_text, len);
 }
+#endif /* HAVE_PANGO */
 
 static char*
 convertToDisplayLanguage(char *src) {
@@ -227,11 +297,19 @@
   }
   return (char*)src;
 }
+
 static void
 update_menu(XicCommon ic) {
   int y, n;
+#ifdef HAVE_PANGO
+  PangoFontDescription *font = status_window_font_description(ic);
+
+  if (font == NULL)
+	  return;
+#else /* !HAVE_PANGO */
   XFontSet fs = status_window_fontset(ic);
   if (!fs) return;
+#endif /* HAVE_PANGO */
 
   y = 0;
   n = 1;
@@ -246,12 +324,26 @@
       }
       y += status_window_height(ic);
       if (n == XIC_POPUP(ic, menu_index)) {
+#ifdef HAVE_PANGO
+	      draw_text_for_pango(ic, font,
+				  &XIM_POPUP(ic->core.im, bg),
+				  &XIM_POPUP(ic->core.im, fg),
+				  xMargin, y, state->name);
+#else /* !HAVE_PANGO */
 	DrawText(ic, fs, XIM_POPUP(ic->core.im, rgc),
 		 xMargin, y, state->name);
+#endif /* HAVE_PANGO */
       } else if ((-1 == XIC_POPUP(ic, menu_index_pre)) ||
 		 (n == XIC_POPUP(ic, menu_index_pre))) {
+#ifdef HAVE_PANGO
+	      draw_text_for_pango(ic, font,
+				  &XIM_POPUP(ic->core.im, fg),
+				  &XIM_POPUP(ic->core.im, bg),
+				  xMargin, y, state->name);
+#else /* !HAVE_PANGO */
 	DrawText(ic, fs, XIM_POPUP(ic->core.im, gc),
 		 xMargin, y, state->name);
+#endif /* HAVE_PANGO */
       }
       n++;
       state = state->next;
@@ -271,12 +363,26 @@
 	} 
         y += status_window_height(ic);
         if (n == XIC_POPUP(ic, menu_index)) {
+#ifdef HAVE_PANGO
+		draw_text_for_pango(ic, font,
+				    &XIM_POPUP(ic->core.im, bg),
+				    &XIM_POPUP(ic->core.im, fg),
+				    xMargin, y, display_lang);
+#else /* HAVE_PANGO */
 	  DrawText(ic, fs, XIM_POPUP(ic->core.im, rgc),
 		   xMargin, y, display_lang);
+#endif /* HAVE_PANGO */
         } else if ((-1 == XIC_POPUP(ic, menu_index_pre)) ||
                    (n == XIC_POPUP(ic, menu_index_pre))) {
+#ifdef HAVE_PANGO
+		draw_text_for_pango(ic, font,
+				    &XIM_POPUP(ic->core.im, fg),
+				    &XIM_POPUP(ic->core.im, bg),
+				    xMargin, y, display_lang);
+#else /* !HAVE_PANGO */
 	  DrawText(ic, fs, XIM_POPUP(ic->core.im, gc),
 		   xMargin, y, display_lang);
+#endif /* HAVE_PANGO */
         }
         n++;
       }
@@ -304,9 +410,16 @@
 static void
 get_menu_size(XicCommon ic, unsigned int *w, unsigned int *h) {
   unsigned int width, height, temp;
+#ifdef HAVE_PANGO
+  PangoFontDescription *font = status_window_font_description(ic);
+
+  if (font == NULL)
+	  return;
+#else /* !HAVE_PANGO */
   XFontSet fs = status_window_fontset(ic);
 
   if (!fs) return;
+#endif /* HAVE_PANGO */
 
   width = 0;
   height = 0;
@@ -320,7 +433,11 @@
 	    continue;
       }
       len = strlen(state->name);
+#ifdef HAVE_PANGO
+      temp = text_escapement_for_pango(ic, font, state->name);
+#else /* !HAVE_PANGO */
       temp = TextEscapement(ic, fs, state->name);
+#endif /* HAVE_PANGO */
       width = (temp > width) ? temp : width;
       height += status_window_height(ic);
       state = state->next;
@@ -340,7 +457,11 @@
 	   display_lang = convertToDisplayLanguage(p->string.multi_byte);
         }
         len = strlen(display_lang);
+#ifdef HAVE_PANGO
+	temp = text_escapement_for_pango(ic, font, display_lang);
+#else /* !HAVE_PANGO */
         temp = TextEscapement(ic, fs, display_lang);
+#endif /* HAVE_PANGO */
         width = (temp > width) ? temp : width;
         height += status_window_height(ic);
       }
@@ -375,8 +496,10 @@
   XSizeHints hints;
   unsigned int width;
   unsigned int height;
+#ifndef HAVE_PANGO
   unsigned long val_mask;
   XGCValues gcval;
+#endif /* !HAVE_PANGO */
   int	new_x;
   int	new_y;
   XIMPopup popup_impart = 0;
@@ -384,6 +507,9 @@
   Bool use_client_color;
   Display *display = ic->core.im->core.display;
   XIM im = ic->core.im;
+#ifdef HAVE_PANGO
+  int screen = DefaultScreen(display);
+#endif /* HAVE_PANGO */
 
   if (!display) return;
 
@@ -428,6 +554,21 @@
     XFree(popup_impart);
     return;
   }
+#ifdef HAVE_PANGO
+  XIM_POPUP(im, xftdraw) = XftDrawCreate(display, XIM_POPUP(im, window),
+					 DefaultVisual(display, screen),
+					 DefaultColormap(display, screen));
+  XIM_POPUP(im, fg).color.red = 0;
+  XIM_POPUP(im, fg).color.green = 0;
+  XIM_POPUP(im, fg).color.blue = 0;
+  XIM_POPUP(im, fg).color.alpha = 0xffff;
+  XIM_POPUP(im, fg).color.red = 0xffff;
+  XIM_POPUP(im, fg).color.green = 0xffff;
+  XIM_POPUP(im, fg).color.blue = 0xffff;
+  XIM_POPUP(im, fg).color.alpha = 0xffff;
+  XIM_POPUP(im, context) = pango_xft_get_context(display, screen);
+  XIM_POPUP(im, layout) = pango_layout_new(XIM_POPUP(im, context));
+#else /* !HAVE_PANGO */
   val_mask = GCForeground | GCBackground;
   gcval.foreground = fg;
   gcval.background = bg;
@@ -442,6 +583,7 @@
 
   XIM_POPUP(im, rgc) = XCreateGC(display,
 				 XIM_POPUP(im, window), val_mask, &gcval);
+#endif /* HAVE_PANGO */
 
 #ifdef override_redirect
   attr.override_redirect = True;
@@ -693,8 +835,15 @@
 void
 ClosePopupIM(XimCommon im) {
   if (im && im->popup_impart && im->core.display) {
+#ifdef HAVE_PANGO
+	  if (XIM_POPUP(im, xftdraw) != NULL)
+		  XftDrawDestroy(XIM_POPUP(im, xftdraw));
+	  if (XIM_POPUP(im, layout) != NULL)
+		  g_object_unref(XIM_POPUP(im, layout));
+#else /* !HAVE_PANGO */
     if (XIM_POPUP(im, gc)) XFreeGC(im->core.display, XIM_POPUP(im, gc));
     if (XIM_POPUP(im, rgc)) XFreeGC(im->core.display, XIM_POPUP(im, rgc));
+#endif /* HAVE_PANGO */
     if (XIM_POPUP(im, window)) {
       XDestroyWindow(im->core.display, XIM_POPUP(im, window));
     }
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/popupIM.h iiimf-12.2/iiimxcf/xiiimp.so/iiimp/popupIM.h
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/popupIM.h	2001-03-16 00:52:22.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/popupIM.h	2005-06-30 05:47:39.000000000 +0900
@@ -42,13 +42,29 @@
 #ifndef _popupIM_h
 #define _popupIM_h
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "commonIM.h"
 #include <X11/Xlib.h>
+#ifdef HAVE_PANGO
+#include <X11/Xft/Xft.h>
+#include <pango/pango-context.h>
+#include <pango/pango-layout.h>
+#endif /* HAVE_PANGO */
 
 typedef struct _XIMPopupRec {
   Window	window;
+#ifndef HAVE_PANGO
   GC		gc;
   GC		rgc;
+#else /* HAVE_PANGO */
+  XftDraw      *xftdraw;
+  XftColor      fg;
+  XftColor      bg;
+  PangoContext *context;
+  PangoLayout  *layout;
+#endif /* !HAVE_PANGO */
   int		status_height;
   int	x;
   int	y;
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/xfactory.c iiimf-12.2/iiimxcf/xiiimp.so/iiimp/xfactory.c
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/xfactory.c	2004-08-24 19:37:02.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/xfactory.c	2005-06-28 21:57:14.000000000 +0900
@@ -39,6 +39,9 @@
 Sun Microsystems, Inc. or its licensors is granted.
 
 */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>		/* Required for XA_ATOM */
 #ifndef linux
@@ -48,6 +51,10 @@
 #include "xfactory.h"
 
 #define PROP_WM_STATE_ELEMENTS 2
+#ifdef HAVE_PANGO
+#define DEFAULT_FONT_FAMILY	"Sans"
+#define DEFAULT_FONT_SIZE	12
+#endif /* HAVE_PANGO */
 
 typedef struct _PropWMState {
     unsigned long state;
@@ -437,6 +444,42 @@
   return s;
 }
 
+#ifdef HAVE_PANGO
+static PangoFontDescription *default_font = NULL;
+static unsigned int pango_ref_count = 0;
+
+PangoFontDescription *
+XFactoryCreateDefaultPangoFontDescription(char *default_fontname)
+{
+	pango_ref_count++;
+
+	if (default_font != NULL)
+		return default_font;
+
+	if (default_fontname != NULL)
+		default_font = pango_font_description_from_string(default_fontname);
+	else
+		default_font = pango_font_description_new();
+	if ((pango_font_description_get_set_fields(default_font) & PANGO_FONT_MASK_FAMILY) == 0)
+		pango_font_description_set_family(default_font, DEFAULT_FONT_FAMILY);
+	if ((pango_font_description_get_set_fields(default_font) & PANGO_FONT_MASK_SIZE) == 0)
+		pango_font_description_set_size(default_font, DEFAULT_FONT_SIZE * PANGO_SCALE);
+
+	return default_font;
+}
+
+void
+XFactoryFreeDefaultPangoFontDescription(void)
+{
+	if (--pango_ref_count == 0) {
+		if (default_font != NULL) {
+			pango_font_description_free(default_font);
+			default_font = NULL;
+		}
+	}
+}
+#endif /* HAVE_PANGO */
+
 static XFontSet default_fontset = (XFontSet)0;
 static int ref_count = 0;
 
diff -x libtool -x '*~' -x '*m4' -x Makefile -x Makefile.in -x 'config.*' -x configure -x .deps -x .libs -x autom4te.cache -x '*o' -x '*a' -x 'stamp*' -ruN iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/xfactory.h iiimf-12.2/iiimxcf/xiiimp.so/iiimp/xfactory.h
--- iiimf-12.2.orig/iiimxcf/xiiimp.so/iiimp/xfactory.h	2004-11-05 17:16:21.000000000 +0900
+++ iiimf-12.2/iiimxcf/xiiimp.so/iiimp/xfactory.h	2005-06-28 21:57:43.000000000 +0900
@@ -46,6 +46,12 @@
 
 #ifndef _XFACTORY_H
 #define _XFACTORY_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_PANGO
+#include <pango/pango-font.h>
+#endif /* HAVE_PANGO */
 
 extern void	XFactoryRemoveDecoration(Display *display, Window window);
 extern void	XFactoryRemoveDecorationExceptTitle(Display *display,
@@ -78,6 +84,10 @@
 extern int	XFactoryMoveWindowInsideScreen(Display * display, Window w,
 					       int x, int y);
 
+#ifdef HAVE_PANGO
+PangoFontDescription *XFactoryCreateDefaultPangoFontDescription(char *default_fontname);
+void                  XFactoryFreeDefaultPangoFontDescription  (void);
+#endif /* HAVE_PANGO */
 extern XFontSet XFactoryCreateDefaultFontSet (Display *display,
 					      char *default_font_name);
 extern void	XFactoryFreeDefaultFontSet(Display *display);


Index: iiimf.spec
===================================================================
RCS file: /cvs/dist/rpms/iiimf/FC-4/iiimf.spec,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- iiimf.spec	27 Jun 2005 01:05:53 -0000	1.55
+++ iiimf.spec	7 Jul 2005 11:52:05 -0000	1.56
@@ -36,7 +36,7 @@
 Version: 12.2
 ## for builds suffixed with the svn release please only increment the leading release number when updating
 # append .svn%{revision} for snapshots
-Release: 4.fc4.0
+Release: 4.fc4.1
 License: Distributable
 Source: %{name}-src-%{srclabel}.tar.bz2
 Source2: iiimd-init.d
@@ -105,11 +105,12 @@
 Patch800: xiiimp-fix-infinite-loop-property-notify-event-r2661.patch
 ### RH-specific (+50~)
 Patch850: xiiimp-rh-fix-build-20040203.patch
-Patch852: xiiimp-xft.patch
+Patch851: xiiimp-pango.patch
+#Patch852: xiiimp-xft.patch
 ## warning patches are in the way so cannot merge with xft patch
 ## TODO: merge it when tar ball is merging the trunk
-Patch853: im-sdk-12.1-x-xft-highlight.patch
-Patch854: xiiimp-xft-statusarea-147457.patch
+#Patch853: im-sdk-12.1-x-xft-highlight.patch
+#Patch854: xiiimp-xft-statusarea-147457.patch
 
 ## IIIMP patches (900-)
 ### RH-specific (+50~)
@@ -438,9 +439,10 @@
 %patch800 -p0 -b .800-loop-property-notify
 ### RH-specific (+50~)
 %patch850 -p1 -b .850-rh-build-20040203
-%patch852 -p1 -b .852-xft
-%patch853 -p1 -b .853-xft-highlight
-%patch854 -p1 -b .854-xft-statusarea
+%patch851 -p1 -b .851-pango
+#%%patch852 -p1 -b .852-xft
+#%%patch853 -p1 -b .853-xft-highlight
+#%%patch854 -p1 -b .854-xft-statusarea
 ## IIIMP patches (900-)
 ### RH-specific (+50~)
 %patch950 -p0 -R -b .950-revert-to-r2562
@@ -998,6 +1000,17 @@
 %endif
 
 %changelog
+* Thu Jul  7 2005 Akira TAGOH <tagoh at redhat.com> - 1:12.2-4.fc4.1
+- Backported a patch from devel.
+  - xiiimp-pango.patch: applied to show the glyphs on the status window
+    and the candidate window with Pango. (#141723)
+  - the above patch also contains a fix to get the hotmenu working
+    on even iiimx. (#162125)
+  - removed the unnecessary/not applied anymore patches:
+    - im-sdk-12.1-x-xft-highlight.patch
+    - xiiimp-xft-statusarea-147457.patch
+    - xiiimp-xft.patch
+
 * Thu Jun 16 2005 Akira TAGOH <tagoh at redhat.com> - 1:12.2-4.fc4.0
 - Backported various fixes/changes from devel.
   - gimlet-default-icon-r2665-159121.patch: set the default window icon. (#159121)




More information about the fedora-cvs-commits mailing list