FLTK logo

[Library] r6207 - in branches/branch-1.3-utf8: . src src/xutf8

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r6207 - in branches/branch-1.3-utf8: . src src/xutf8 fltk-dev Sep 10, 2008  
 
Author: matt
Date: 2008-09-10 12:19:56 -0700 (Wed, 10 Sep 2008)
New Revision: 6207
Log:
Moving all the X11 support for utf8 writte by O'ksi'd into the src subdirectory. Rationale: since 1.3 will always support utf8 on every platform, there is no reason to create yet another library which requires changes to the makefiles of existing project. In its new location, we can integrate the xutf8 code into the src Makefile and make it an integral part of the binaries.

Added:
   branches/branch-1.3-utf8/src/xutf8/
   branches/branch-1.3-utf8/src/xutf8/COPYING
   branches/branch-1.3-utf8/src/xutf8/MAPPINGS/
   branches/branch-1.3-utf8/src/xutf8/Makefile
   branches/branch-1.3-utf8/src/xutf8/Makefile.bak
   branches/branch-1.3-utf8/src/xutf8/README
   branches/branch-1.3-utf8/src/xutf8/Ximint.h
   branches/branch-1.3-utf8/src/xutf8/Xlibint.h
   branches/branch-1.3-utf8/src/xutf8/case.c
   branches/branch-1.3-utf8/src/xutf8/headers/
   branches/branch-1.3-utf8/src/xutf8/imKStoUCS.c
   branches/branch-1.3-utf8/src/xutf8/is_right2left.c
   branches/branch-1.3-utf8/src/xutf8/is_spacing.c
   branches/branch-1.3-utf8/src/xutf8/keysym2Ucs.c
   branches/branch-1.3-utf8/src/xutf8/lcUniConv/
   branches/branch-1.3-utf8/src/xutf8/makedepend
   branches/branch-1.3-utf8/src/xutf8/makedepend.bak
   branches/branch-1.3-utf8/src/xutf8/stamp-h
   branches/branch-1.3-utf8/src/xutf8/stamp-h.in
   branches/branch-1.3-utf8/src/xutf8/test.c
   branches/branch-1.3-utf8/src/xutf8/test2.c
   branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c
   branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c.mini
   branches/branch-1.3-utf8/src/xutf8/utf8Input.c
   branches/branch-1.3-utf8/src/xutf8/utf8Utils.c
   branches/branch-1.3-utf8/src/xutf8/utf8Wrap.c
   branches/branch-1.3-utf8/src/xutf8/utils/
Removed:
   branches/branch-1.3-utf8/src/xutf8/COPYING
   branches/branch-1.3-utf8/src/xutf8/MAPPINGS/
   branches/branch-1.3-utf8/src/xutf8/Makefile
   branches/branch-1.3-utf8/src/xutf8/Makefile.bak
   branches/branch-1.3-utf8/src/xutf8/README
   branches/branch-1.3-utf8/src/xutf8/Ximint.h
   branches/branch-1.3-utf8/src/xutf8/Xlibint.h
   branches/branch-1.3-utf8/src/xutf8/case.c
   branches/branch-1.3-utf8/src/xutf8/headers/
   branches/branch-1.3-utf8/src/xutf8/imKStoUCS.c
   branches/branch-1.3-utf8/src/xutf8/is_right2left.c
   branches/branch-1.3-utf8/src/xutf8/is_spacing.c
   branches/branch-1.3-utf8/src/xutf8/keysym2Ucs.c
   branches/branch-1.3-utf8/src/xutf8/lcUniConv/
   branches/branch-1.3-utf8/src/xutf8/makedepend
   branches/branch-1.3-utf8/src/xutf8/makedepend.bak
   branches/branch-1.3-utf8/src/xutf8/stamp-h
   branches/branch-1.3-utf8/src/xutf8/stamp-h.in
   branches/branch-1.3-utf8/src/xutf8/test.c
   branches/branch-1.3-utf8/src/xutf8/test2.c
   branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c
   branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c.mini
   branches/branch-1.3-utf8/src/xutf8/utf8Input.c
   branches/branch-1.3-utf8/src/xutf8/utf8Utils.c
   branches/branch-1.3-utf8/src/xutf8/utf8Wrap.c
   branches/branch-1.3-utf8/src/xutf8/utils/
   branches/branch-1.3-utf8/xutf8/

Copied: branches/branch-1.3-utf8/src/xutf8 (from rev 6201, branches/branch-1.3-utf8/xutf8)

Deleted: branches/branch-1.3-utf8/src/xutf8/COPYING

Copied: branches/branch-1.3-utf8/src/xutf8/COPYING (from rev 6206, branches/branch-1.3-utf8/xutf8/COPYING)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/COPYING	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/COPYING	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,63 @@
+
+ *                     X11 UTF-8 text drawing functions.
+ *
+ *      Copyright (c) 2000,2001 by O'ksi'D.
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+
+
+		lcUniConv directory: 
+
+Copyright (c) 1999-2000  Free Software Foundation, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+FREE SOFTWARE FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the Free Software Foundation
+shall not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from the
+Free Software Foundation.
+
+

Copied: branches/branch-1.3-utf8/src/xutf8/MAPPINGS (from rev 6206, branches/branch-1.3-utf8/xutf8/MAPPINGS)

Deleted: branches/branch-1.3-utf8/src/xutf8/Makefile

Copied: branches/branch-1.3-utf8/src/xutf8/Makefile (from rev 6206, branches/branch-1.3-utf8/xutf8/Makefile)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/Makefile	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/Makefile	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,130 @@
+#
+# "$Id: Makefile,v 1.1.2.6 2004/09/08 16:04:42 easysw Exp $"
+#
+# Xutf8 library makefile for the Fast Light Toolkit (FLTK).
+#
+# Copyright 1997-2005 by Jean-Marc Lienher.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+#
+# Please report all bugs and problems to "fltk-bugs@fltk.org".
+#
+
+include ../makeinclude
+
+
+#
+# Object files... set this based on the operating system and host
+#
+UNAME := $(shell uname)
+
+ifeq '$(OS)' "Windows_NT"
+OBJS	=	case.o is_right2left.o is_spacing.o 
+endif # end of WIN32 options
+
+ifeq ($(strip $(UNAME)),Linux)
+OBJS	=	case.o is_right2left.o is_spacing.o \
+		keysym2Ucs.o utf8Input.o utf8Utils.o \
+		utf8Wrap.o 
+endif # end of linux options
+
+ifeq ($(strip $(UNAME)),Darwin)
+OBJS	=	case.o is_right2left.o is_spacing.o 
+endif # end of OSX options
+
+
+
+XUTF8	=	../lib/libfltk_xutf8$(LIBEXT)
+
+
+#
+# Make all targets...
+#
+
+all:	$(XUTF8) $(XDSONAME)
+
+
+#
+# Clean all targets and object files...
+#
+
+clean:
+	$(RM) $(OBJS)
+	$(RM) $(XUTF8) $(XDSONAME) libfltk_xutf8.so
+
+
+#
+# Install everything...
+#
+
+install: $(XUTF8)
+	echo "Installing libfltk_xutf8$(LIBEXT) in $(libdir)..."
+	-$(MKDIR) $(libdir)
+	$(RM) $(libdir)/libfltk_xutf8$(LIBEXT)
+	$(CP) $(XUTF8) $(libdir)
+	$(RANLIB) $(libdir)/libfltk_xutf8$(LIBEXT)
+	if test x$(XDSONAME) = xlibfltk_xutf8.so.1.1; then\
+		$(RM) $(DESTDIR)$(libdir)/libfltk_xutf8.so*;\
+		$(CP) libfltk_xutf8.so.1.1 $(DESTDIR)$(libdir); \
+		$(CHMOD) 755 $(DESTDIR)$(libdir)/libfltk_xutf8.so.1.1; \
+		$(LN) libfltk_xutf8.so.1.1 $(DESTDIR)$(libdir)/libfltk_xutf8.so;\
+	fi
+
+
+#
+# Uninstall everything...
+#
+
+uninstall:
+	echo "Uninstalling libfltk_xutf8$(LIBEXT) in $(libdir)..."
+	$(RM) $(libdir)/libfltk_xutf8$(LIBEXT)
+	if test x$(XDSONAME) = xlibfltk_xutf8.so.1.1; then\
+		$(RM) $(DESTDIR)$(libdir)/libfltk_xutf8.so*;\
+	fi
+
+
+#
+# libfltk_xutf8.a
+#
+
+$(XUTF8):	$(OBJS)
+	echo Archiving $@...
+	$(RM) $@
+	$(LIBCOMMAND) $@ $(OBJS)
+	$(RANLIB) $@
+
+libfltk_xutf8.so.1.1: $(OBJS)
+	echo $(DSOCOMMAND) $@ ...
+	$(DSOCOMMAND) $@ $(OBJS)
+	$(RM) libfltk_xutf8.so
+	$(LN) libfltk_xutf8.so.1.1 libfltk_xutf8.so
+
+#
+# Make dependencies...
+#
+
+depend:	$(OBJS:.o=.c)
+	makedepend -Y -I.. -f makedepend $(OBJS:.o=.c)
+
+include makedepend
+
+$(OBJS):	../makeinclude
+
+
+#
+# End of "$Id: Makefile,v 1.1.2.6 2004/09/08 16:04:42 easysw Exp $".
+#
+# DO NOT DELETE

Deleted: branches/branch-1.3-utf8/src/xutf8/Makefile.bak

Copied: branches/branch-1.3-utf8/src/xutf8/Makefile.bak (from rev 6206, branches/branch-1.3-utf8/xutf8/Makefile.bak)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/Makefile.bak	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/Makefile.bak	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,102 @@
+#
+# "$Id: Makefile,v 1.1.2.6 2004/09/08 16:04:42 easysw Exp $"
+#
+# Xutf8 library makefile for the Fast Light Toolkit (FLTK).
+#
+# Copyright 1997-2004 by Easy Software Products.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+#
+# Please report all bugs and problems to "fltk-bugs@fltk.org".
+#
+
+include ../makeinclude
+
+
+#
+# Object files...
+#
+
+OBJS	=	case.o imKStoUCS.o is_right2left.o is_spacing.o \
+		keysym2Ucs.o ucs2fontmap.o utf8Input.o utf8Utils.o \
+		utf8Wrap.o 
+
+XUTF8	=	../lib/libfltk_xutf8$(LIBEXT)
+
+
+#
+# Make all targets...
+#
+
+all:	$(XUTF8)
+
+
+#
+# Clean all targets and object files...
+#
+
+clean:
+	$(RM) $(OBJS)
+	$(RM) $(XUTF8)
+
+
+#
+# Install everything...
+#
+
+install: $(XUTF8)
+	echo "Installing libfltk_xutf8$(LIBEXT) in $(libdir)..."
+	-$(MKDIR) $(libdir)
+	$(RM) $(libdir)/libfltk_xutf8$(LIBEXT)
+	$(CP) $(XUTF8) $(libdir)
+	$(RANLIB) $(libdir)/libfltk_xutf8$(LIBEXT)
+
+
+#
+# Uninstall everything...
+#
+
+uninstall:
+	echo "Uninstalling libfltk_xutf8$(LIBEXT) in $(libdir)..."
+	$(RM) $(libdir)/libfltk_xutf8$(LIBEXT)
+
+
+#
+# libfltk_xutf8.a
+#
+
+$(XUTF8):	$(OBJS)
+	echo Archiving $@...
+	$(RM) $@
+	$(LIBCOMMAND) $@ $(OBJS)
+	$(RANLIB) $@
+
+#
+# Make dependencies...
+#
+
+depend:	$(OBJS:.o=.c)
+	makedepend -Y -I.. -f makedepend $(OBJS:.o=.c)
+
+include makedepend
+
+$(OBJS):	../makeinclude
+
+
+#
+# End of "$Id: Makefile,v 1.1.2.6 2004/09/08 16:04:42 easysw Exp $".
+#
+# DO NOT DELETE

Deleted: branches/branch-1.3-utf8/src/xutf8/README

Copied: branches/branch-1.3-utf8/src/xutf8/README (from rev 6206, branches/branch-1.3-utf8/xutf8/README)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/README	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/README	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,66 @@
+
+
+
+supported encodings :
+---------------------
+iso10646-1
+iso8859-1 
+iso8859-2 
+iso8859-3 
+iso8859-4 
+iso8859-5 
+iso8859-6 
+iso8859-7 
+iso8859-8  
+iso8859-9 
+iso8859-10
+iso8859-11
+iso8859-13 
+iso8859-14 
+iso8859-15 
+koi8-r 
+koi8-u 
+big5-0 
+gb2312.1980-0 
+jisx0201.1976-0 
+jisx0208.1983-0 
+jisx0212.1990-0 
+ksc5601.1987-0
+symbol 
+dingbats
+
+
+TIPS:
+=====
+
+You must add "-lXutf8" to the library list in your Makefile. 
+
+When using "GNU autoconf" add these lines to your "configure.in" :
+
+dnl Test to see if libXutf8 is on this machine:
+XUTFLIB=
+AC_CHECK_LIB(Xutf8, XUtf8IsNonSpacing, \
+        AC_DEFINE(HAVE_XUTF8) XUTFLIB=" -lXutf8", ,\
+        -lX11 $X_EXTRA_LIBS)
+AC_SUBST(XUTFLIB)
+
+
+ORIGINAL FILES :
+================
+
+The directory lcUniConv is copied from the xfree project cvs system.
+(
+export CVS_RSH=ssh
+export CVSROOT=anoncvs@anoncvs.xfree86.org:/cvs
+cvs checkout xc/lib/X11/lcUniConv
+password: anoncvs
+)
+
+The file imKStoUCS.c is copied from the xfree project cvs system.
+(
+export CVS_RSH=ssh
+export CVSROOT=anoncvs@anoncvs.xfree86.org:/cvs
+cvs checkout xc/lib/X11
+password: anoncvs
+)
+

Deleted: branches/branch-1.3-utf8/src/xutf8/Ximint.h

Copied: branches/branch-1.3-utf8/src/xutf8/Ximint.h (from rev 6206, branches/branch-1.3-utf8/xutf8/Ximint.h)
===================================================================

Deleted: branches/branch-1.3-utf8/src/xutf8/Xlibint.h

Copied: branches/branch-1.3-utf8/src/xutf8/Xlibint.h (from rev 6206, branches/branch-1.3-utf8/xutf8/Xlibint.h)
===================================================================

Deleted: branches/branch-1.3-utf8/src/xutf8/case.c

Copied: branches/branch-1.3-utf8/src/xutf8/case.c (from rev 6206, branches/branch-1.3-utf8/xutf8/case.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/case.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/case.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,139 @@
+/******************************************************************************
+              Copyright 2001 by O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+
+
+        Author: Jean-Marc Lienher ( http://oksid.ch )
+
+******************************************************************************/
+
+#include "headers/case.h"
+#include <stdlib.h>
+
+
+int 
+XUtf8Tolower(
+	int ucs)
+{
+	int ret;
+
+	if (ucs <= 0x02B6) {
+		if (ucs >= 0x0041) {
+			ret = ucs_table_0041[ucs - 0x0041];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0x0556) {
+		if (ucs >= 0x0386) {
+			ret = ucs_table_0386[ucs - 0x0386];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0x10C5) {
+		if (ucs >= 0x10A0) {
+			ret = ucs_table_10A0[ucs - 0x10A0];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0x1FFC) {
+		if (ucs >= 0x1E00) {
+			ret = ucs_table_1E00[ucs - 0x1E00];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0x2133) {
+		if (ucs >= 0x2102) {
+			ret = ucs_table_2102[ucs - 0x2102];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0x24CF) {
+		if (ucs >= 0x24B6) {
+			ret = ucs_table_24B6[ucs - 0x24B6];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0x33CE) {
+		if (ucs >= 0x33CE) {
+			ret = ucs_table_33CE[ucs - 0x33CE];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	if (ucs <= 0xFF3A) {
+		if (ucs >= 0xFF21) {
+			ret = ucs_table_FF21[ucs - 0xFF21];
+			if (ret > 0) return ret;
+		}
+		return ucs;
+	}
+
+	return ucs;
+}
+
+int 
+XUtf8Toupper(
+	int ucs)
+{
+	int i;
+	static unsigned short *table = NULL;
+
+	if (!table) {
+		table = (unsigned short*) malloc(
+			sizeof(unsigned short) * 0x10000);
+		for (i = 0; i < 0x10000; i++) {
+			table[i] = (unsigned short) i;
+		}	
+		for (i = 0; i < 0x10000; i++) {
+			int l;
+			l = XUtf8Tolower(i);			
+			if (l != i) table[l] = (unsigned short) i;
+		}	
+
+	}
+	if (ucs >= 0x10000 || ucs < 0) return ucs;
+	return table[ucs];
+}
+

Copied: branches/branch-1.3-utf8/src/xutf8/headers (from rev 6206, branches/branch-1.3-utf8/xutf8/headers)

Deleted: branches/branch-1.3-utf8/src/xutf8/imKStoUCS.c

Copied: branches/branch-1.3-utf8/src/xutf8/imKStoUCS.c (from rev 6206, branches/branch-1.3-utf8/xutf8/imKStoUCS.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/imKStoUCS.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/imKStoUCS.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,320 @@
+/* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.5 2003/11/17 22:20:11 dawes Exp $ */
+
+#include "Xlibint.h"
+#include "Ximint.h"
+
+static unsigned short const keysym_to_unicode_1a1_1ff[] = {
+            0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */
+    0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */
+    0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */
+    0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */
+    0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */
+    0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */
+    0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */
+    0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */
+    0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */
+    0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */
+    0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */
+    0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9  /* 0x01f8-0x01ff */
+};
+
+static unsigned short const keysym_to_unicode_2a1_2fe[] = {
+            0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */
+    0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */
+    0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */
+    0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */
+    0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */
+    0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d          /* 0x02f8-0x02ff */
+};
+
+static unsigned short const keysym_to_unicode_3a2_3fe[] = {
+                    0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */
+    0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */
+    0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */
+    0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */
+    0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */
+    0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */
+    0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */
+    0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */
+    0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */
+    0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b          /* 0x03f8-0x03ff */
+};
+
+static unsigned short const keysym_to_unicode_4a1_4df[] = {
+            0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */
+    0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */
+    0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */
+    0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */
+    0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */
+    0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */
+    0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */
+    0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c  /* 0x04d8-0x04df */
+};
+
+static unsigned short const keysym_to_unicode_590_5fe[] = {
+    0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */
+    0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */
+	
+    0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */
+    0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */
+    0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */
+    0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */
+    0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */
+    0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */
+    0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */
+    0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */
+    0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */
+    0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */
+    0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1          /* 0x05f8-0x05fe */
+};
+
+static unsigned short keysym_to_unicode_680_6ff[] = {
+    0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */
+    0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */
+    0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */
+    0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */
+    0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */
+    0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */
+    0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */
+    0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */
+    0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */
+    0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */
+    0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */
+    0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */
+    0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */
+    0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */
+    0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */
+    0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a  /* 0x06f8-0x06ff */
+};
+
+static unsigned short const keysym_to_unicode_7a1_7f9[] = {
+            0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */
+    0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */
+    0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */
+    0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */
+    0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */
+    0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */
+    0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */
+    0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */
+    0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */
+    0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */
+    0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */
+    0x03c8, 0x03c9                                                  /* 0x07f8-0x07ff */
+};
+
+static unsigned short const keysym_to_unicode_8a4_8fe[] = {
+                                    0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */
+    0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */
+    0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */
+    0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x22a2, 0x0000, /* 0x08c8-0x08cf */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */
+    0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e8-0x08ef */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */
+    0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193          /* 0x08f8-0x08ff */
+};
+
+static unsigned short const keysym_to_unicode_9df_9f8[] = {
+                                                            0x2422, /* 0x09d8-0x09df */
+    0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */
+    0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */
+    0x2502                                                          /* 0x09f8-0x09ff */
+};
+
+static unsigned short const keysym_to_unicode_aa1_afe[] = {
+            0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */
+    0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */
+    0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */
+    0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */
+    0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */
+    0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */
+    0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */
+    0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */
+    0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */
+    0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */
+    0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */
+    0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e          /* 0x0af8-0x0aff */
+};
+
+/* none of the APL keysyms match the Unicode characters */
+
+static unsigned short const keysym_to_unicode_cdf_cfa[] = {
+                                                            0x2017, /* 0x0cd8-0x0cdf */
+    0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */
+    0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */
+    0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */
+    0x05e8, 0x05e9, 0x05ea                                          /* 0x0cf8-0x0cff */
+};
+
+static unsigned short const keysym_to_unicode_da1_df9[] = {
+            0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */
+    0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */
+    0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */
+    0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */
+    0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */
+    0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */
+    0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */
+    0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */
+    0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */
+    0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */
+    0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */
+    0x0e58, 0x0e59                                                  /* 0x0df8-0x0dff */
+};
+
+static unsigned short const keysym_to_unicode_ea0_eff[] = {
+    0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */
+    0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */
+    0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */
+    0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */
+    0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */
+    0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */
+    0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */
+    0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */
+    0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */
+    0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */
+    0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */
+    0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */
+};
+
+static unsigned short keysym_to_unicode_12a1_12fe[] = {
+            0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */
+    0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */
+    0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */
+    0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */
+    0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */
+    0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177          /* 0x12f0-0x12ff */
+};
+		
+static unsigned short const keysym_to_unicode_13bc_13be[] = {
+                                    0x0152, 0x0153, 0x0178          /* 0x13b8-0x13bf */
+};
+
+static unsigned short keysym_to_unicode_14a1_14ff[] = {
+            0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */
+    0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */
+    0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */
+    0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */
+    0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */
+    0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */
+    0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */
+    0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */
+    0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */
+    0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */
+    0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */
+    0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */
+};
+
+static unsigned short keysym_to_unicode_15d0_15f6[] = {
+    0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */
+    0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */
+    0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */
+    0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */
+    0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6          /* 0x15f0-0x15f7 */
+};
+
+static unsigned short keysym_to_unicode_16a0_16f6[] = {
+    0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */
+    0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */
+    0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */
+    0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */
+    0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */
+    0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259          /* 0x16f0-0x16f6 */
+};
+
+static unsigned short const keysym_to_unicode_1e9f_1eff[] = {
+                                                            0x0303,
+    0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */
+    0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */
+    0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */
+    0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */
+    0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */
+    0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */
+    0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */
+    0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */
+    0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */
+    0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */
+    0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */
+    0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323  /* 0x1ef8-0x1eff */
+};
+
+static unsigned short const keysym_to_unicode_20a0_20ac[] = {
+    0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */
+    0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac                          /* 0x20a8-0x20af */
+};
+
+unsigned int
+KeySymToUcs4(KeySym keysym)
+{
+    /* 'Unicode keysym' */
+    if ((keysym & 0xff000000) == 0x01000000)
+        return (keysym & 0x00ffffff);
+
+    if (keysym > 0 && keysym < 0x100)
+	return keysym;
+    else if (keysym > 0x1a0 && keysym < 0x200)
+	return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
+    else if (keysym > 0x2a0 && keysym < 0x2ff)
+	return keysym_to_unicode_2a1_2fe[keysym - 0x2a1];
+    else if (keysym > 0x3a1 && keysym < 0x3ff)
+	return keysym_to_unicode_3a2_3fe[keysym - 0x3a2];
+    else if (keysym > 0x4a0 && keysym < 0x4e0)
+	return keysym_to_unicode_4a1_4df[keysym - 0x4a1];
+    else if (keysym > 0x589 && keysym < 0x5ff)
+	return keysym_to_unicode_590_5fe[keysym - 0x590];
+    else if (keysym > 0x67f && keysym < 0x700)
+	return keysym_to_unicode_680_6ff[keysym - 0x680];
+    else if (keysym > 0x7a0 && keysym < 0x7fa)
+	return keysym_to_unicode_7a1_7f9[keysym - 0x7a1];
+    else if (keysym > 0x8a3 && keysym < 0x8ff)
+	return keysym_to_unicode_8a4_8fe[keysym - 0x8a4];
+    else if (keysym > 0x9de && keysym < 0x9f9)
+	return keysym_to_unicode_9df_9f8[keysym - 0x9df];
+    else if (keysym > 0xaa0 && keysym < 0xaff)
+	return keysym_to_unicode_aa1_afe[keysym - 0xaa1];
+    else if (keysym > 0xcde && keysym < 0xcfb)
+	return keysym_to_unicode_cdf_cfa[keysym - 0xcdf];
+    else if (keysym > 0xda0 && keysym < 0xdfa)
+	return keysym_to_unicode_da1_df9[keysym - 0xda1];
+    else if (keysym > 0xe9f && keysym < 0xf00)
+	return keysym_to_unicode_ea0_eff[keysym - 0xea0];
+    else if (keysym > 0x12a0 && keysym < 0x12ff)
+	return keysym_to_unicode_12a1_12fe[keysym - 0x12a1];
+    else if (keysym > 0x13bb && keysym < 0x13bf)
+	return keysym_to_unicode_13bc_13be[keysym - 0x13bc];
+    else if (keysym > 0x14a0 && keysym < 0x1500)
+        return keysym_to_unicode_14a1_14ff[keysym - 0x14a1];
+    else if (keysym > 0x15cf && keysym < 0x15f7)
+	return keysym_to_unicode_15d0_15f6[keysym - 0x15d0];
+    else if (keysym > 0x169f && keysym < 0x16f7)
+	return keysym_to_unicode_16a0_16f6[keysym - 0x16a0];
+    else if (keysym > 0x1e9e && keysym < 0x1f00)
+	return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
+    else if (keysym > 0x209f && keysym < 0x20ad)
+	return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
+    else 
+	return 0;
+}

Deleted: branches/branch-1.3-utf8/src/xutf8/is_right2left.c

Copied: branches/branch-1.3-utf8/src/xutf8/is_right2left.c (from rev 6206, branches/branch-1.3-utf8/xutf8/is_right2left.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/is_right2left.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/is_right2left.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,80 @@
+/******************************************************************************
+              Copyright 2000-2001 by O'ksi'D
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation, and that the name of O'ksi'D
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+O'ksi'D makes no representations about the suitability of
+this software for any purpose.  It is provided "as is" without
+express or implied warranty.
+
+O'ksi'D DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+IN NO EVENT SHALL O'ksi'D BE LIABLE FOR ANY SPECIAL, INDIRECT
+OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+OR PERFORMANCE OF THIS SOFTWARE.
+
+        Author: Jean-Marc Lienher ( http://oksid.ch )
+
+******************************************************************************/
+
+unsigned short 
+XUtf8IsRightToLeft(
+	unsigned int ucs)
+{
+
+#if 0
+	/* for debug only */
+	if (ucs <= 0x005A) {
+		if (ucs >= 0x0041) return 1;
+		return 0;
+	}
+#endif
+
+	/* HEBREW */
+	if (ucs <= 0x05F4) {
+		if (ucs >= 0x0591) return 1;
+		return 0;
+	}
+	
+	/* ARABIC */
+	if (ucs <= 0x06ED) {
+		if (ucs >= 0x060C)  return 1;
+		return 0;
+	}
+
+	if (ucs <= 0x06F9) {
+		 if (ucs >= 0x06F0) return 1;
+		return 0;
+	}
+
+	if (ucs == 0x200F) return 1;
+
+	if (ucs == 0x202B) return 1;
+
+	if (ucs == 0x202E) return 1;
+
+	if (ucs <= 0xFB4F) {
+		if (ucs >= 0xFB1E) return 1;
+		return 0;
+	}
+	
+	if (ucs <= 0xFDFB) {
+		if (ucs >= 0xFB50) return 1;
+		return 0;
+	}
+
+	if (ucs <= 0xFEFC) {
+		if (ucs >= 0xFE70) return 1;
+		return 0;
+	}
+
+	return 0;
+}
+

Deleted: branches/branch-1.3-utf8/src/xutf8/is_spacing.c

Copied: branches/branch-1.3-utf8/src/xutf8/is_spacing.c (from rev 6206, branches/branch-1.3-utf8/xutf8/is_spacing.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/is_spacing.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/is_spacing.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,87 @@
+/******************************************************************************
+              Copyright 2000-2001 by O'ksi'D
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear
+in supporting documentation, and that the name of O'ksi'D
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+O'ksi'D makes no representations about the suitability of
+this software for any purpose.  It is provided "as is" without
+express or implied warranty.
+
+O'ksi'D DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+IN NO EVENT SHALL O'ksi'D BE LIABLE FOR ANY SPECIAL, INDIRECT
+OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+OR PERFORMANCE OF THIS SOFTWARE.
+
+        Author: Jean-Marc Lienher ( http://oksid.ch )
+
+******************************************************************************/
+
+#include "headers/spacing.h"
+
+
+unsigned short 
+XUtf8IsNonSpacing(
+	unsigned int ucs)
+{
+
+	if (ucs <= 0x0361) {
+		if (ucs >= 0x0300) return ucs_table_0300[ucs - 0x0300];
+		return 0;
+	}
+
+	if (ucs <= 0x0486) {
+		if (ucs >= 0x0483) return ucs_table_0483[ucs - 0x0483];
+		return 0;
+	}
+
+	if (ucs <= 0x05C4) {
+		if (ucs >= 0x0591) return ucs_table_0591[ucs - 0x0591];
+		return 0;
+	}
+
+	if (ucs <= 0x06ED) {
+		if (ucs >= 0x064B) return ucs_table_064B[ucs - 0x064B];
+		return 0;
+	}
+
+	if (ucs <= 0x0D4D) {
+		if (ucs >= 0x0901) return ucs_table_0901[ucs - 0x0901];
+		return 0;
+	}
+
+	if (ucs <= 0x0FB9) {
+		if (ucs >= 0x0E31) return ucs_table_0E31[ucs - 0x0E31];
+		return 0;
+	}
+
+	if (ucs <= 0x20E1) {
+		if (ucs >= 0x20D0) return ucs_table_20D0[ucs - 0x20D0];
+		return 0;
+	}
+
+	if (ucs <= 0x309A) {
+		if (ucs >= 0x302A) return ucs_table_302A[ucs - 0x302A];
+		return 0;
+	}
+
+	if (ucs <= 0xFB1E) {
+		if (ucs >= 0xFB1E) return ucs_table_FB1E[ucs - 0xFB1E];
+		return 0;
+	}
+
+	if (ucs <= 0xFE23) {
+		if (ucs >= 0xFE20) return ucs_table_FE20[ucs - 0xFE20];
+		return 0;
+	}
+
+	return 0;
+}
+

Deleted: branches/branch-1.3-utf8/src/xutf8/keysym2Ucs.c

Copied: branches/branch-1.3-utf8/src/xutf8/keysym2Ucs.c (from rev 6206, branches/branch-1.3-utf8/xutf8/keysym2Ucs.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/keysym2Ucs.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/keysym2Ucs.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,47 @@
+/******************************************************************************
+              Copyright (c) 2002 by O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+
+
+******************************************************************************/
+
+#define KEYSYM2UCS_INCLUDED
+
+#include <FL/Xutf8.h>
+#include "imKStoUCS.c"
+
+
+long XKeysymToUcs(KeySym keysym)
+{
+	return (long) KeySymToUcs4(keysym);
+}
+

Copied: branches/branch-1.3-utf8/src/xutf8/lcUniConv (from rev 6206, branches/branch-1.3-utf8/xutf8/lcUniConv)

Deleted: branches/branch-1.3-utf8/src/xutf8/makedepend

Copied: branches/branch-1.3-utf8/src/xutf8/makedepend (from rev 6206, branches/branch-1.3-utf8/xutf8/makedepend)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/makedepend	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/makedepend	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,27 @@
+# DO NOT DELETE
+
+case.o: headers/case.h
+is_spacing.o: headers/spacing.h
+keysym2Ucs.o: imKStoUCS.c Xlibint.h Ximint.h
+ucs2fontmap.o: lcUniConv/big5.h lcUniConv/gb2312.h lcUniConv/iso8859_10.h
+ucs2fontmap.o: lcUniConv/iso8859_11.h lcUniConv/iso8859_13.h
+ucs2fontmap.o: lcUniConv/iso8859_14.h lcUniConv/iso8859_15.h
+ucs2fontmap.o: lcUniConv/iso8859_2.h lcUniConv/iso8859_3.h
+ucs2fontmap.o: lcUniConv/iso8859_4.h lcUniConv/iso8859_5.h
+ucs2fontmap.o: lcUniConv/iso8859_6.h lcUniConv/iso8859_7.h
+ucs2fontmap.o: lcUniConv/iso8859_8.h lcUniConv/iso8859_9.h
+ucs2fontmap.o: lcUniConv/jisx0201.h lcUniConv/jisx0208.h lcUniConv/jisx0212.h
+ucs2fontmap.o: lcUniConv/koi8_r.h lcUniConv/koi8_u.h lcUniConv/ksc5601.h
+ucs2fontmap.o: lcUniConv/cp1251.h headers/symbol_.h headers/dingbats_.h
+utf8Input.o: lcUniConv/big5.h lcUniConv/gb2312.h lcUniConv/jisx0201.h
+utf8Input.o: lcUniConv/jisx0208.h lcUniConv/jisx0212.h lcUniConv/ksc5601.h
+utf8Wrap.o: ucs2fontmap.c lcUniConv/big5.h lcUniConv/gb2312.h
+utf8Wrap.o: lcUniConv/iso8859_10.h lcUniConv/iso8859_11.h
+utf8Wrap.o: lcUniConv/iso8859_13.h lcUniConv/iso8859_14.h
+utf8Wrap.o: lcUniConv/iso8859_15.h lcUniConv/iso8859_2.h
+utf8Wrap.o: lcUniConv/iso8859_3.h lcUniConv/iso8859_4.h lcUniConv/iso8859_5.h
+utf8Wrap.o: lcUniConv/iso8859_6.h lcUniConv/iso8859_7.h lcUniConv/iso8859_8.h
+utf8Wrap.o: lcUniConv/iso8859_9.h lcUniConv/jisx0201.h lcUniConv/jisx0208.h
+utf8Wrap.o: lcUniConv/jisx0212.h lcUniConv/koi8_r.h lcUniConv/koi8_u.h
+utf8Wrap.o: lcUniConv/ksc5601.h lcUniConv/cp1251.h headers/symbol_.h
+utf8Wrap.o: headers/dingbats_.h

Deleted: branches/branch-1.3-utf8/src/xutf8/makedepend.bak

Copied: branches/branch-1.3-utf8/src/xutf8/makedepend.bak (from rev 6206, branches/branch-1.3-utf8/xutf8/makedepend.bak)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/makedepend.bak	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/makedepend.bak	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,29 @@
+# DO NOT DELETE
+
+case.o: headers/case.h
+imKStoUCS.o: Xlibint.h Ximint.h
+is_spacing.o: headers/spacing.h
+keysym2Ucs.o: Xutf8.h imKStoUCS.c Xlibint.h Ximint.h
+ucs2fontmap.o: lcUniConv/big5.h lcUniConv/gb2312.h lcUniConv/iso8859_10.h
+ucs2fontmap.o: lcUniConv/iso8859_11.h lcUniConv/iso8859_13.h
+ucs2fontmap.o: lcUniConv/iso8859_14.h lcUniConv/iso8859_15.h
+ucs2fontmap.o: lcUniConv/iso8859_2.h lcUniConv/iso8859_3.h
+ucs2fontmap.o: lcUniConv/iso8859_4.h lcUniConv/iso8859_5.h
+ucs2fontmap.o: lcUniConv/iso8859_6.h lcUniConv/iso8859_7.h
+ucs2fontmap.o: lcUniConv/iso8859_8.h lcUniConv/iso8859_9.h
+ucs2fontmap.o: lcUniConv/jisx0201.h lcUniConv/jisx0208.h lcUniConv/jisx0212.h
+ucs2fontmap.o: lcUniConv/koi8_r.h lcUniConv/koi8_u.h lcUniConv/ksc5601.h
+ucs2fontmap.o: lcUniConv/cp1251.h headers/symbol_.h headers/dingbats_.h
+utf8Input.o: Xutf8.h lcUniConv/big5.h lcUniConv/gb2312.h lcUniConv/jisx0201.h
+utf8Input.o: lcUniConv/jisx0208.h lcUniConv/jisx0212.h lcUniConv/ksc5601.h
+utf8Utils.o: Xutf8.h
+utf8Wrap.o: Xutf8.h ucs2fontmap.c lcUniConv/big5.h lcUniConv/gb2312.h
+utf8Wrap.o: lcUniConv/iso8859_10.h lcUniConv/iso8859_11.h
+utf8Wrap.o: lcUniConv/iso8859_13.h lcUniConv/iso8859_14.h
+utf8Wrap.o: lcUniConv/iso8859_15.h lcUniConv/iso8859_2.h
+utf8Wrap.o: lcUniConv/iso8859_3.h lcUniConv/iso8859_4.h lcUniConv/iso8859_5.h
+utf8Wrap.o: lcUniConv/iso8859_6.h lcUniConv/iso8859_7.h lcUniConv/iso8859_8.h
+utf8Wrap.o: lcUniConv/iso8859_9.h lcUniConv/jisx0201.h lcUniConv/jisx0208.h
+utf8Wrap.o: lcUniConv/jisx0212.h lcUniConv/koi8_r.h lcUniConv/koi8_u.h
+utf8Wrap.o: lcUniConv/ksc5601.h lcUniConv/cp1251.h headers/symbol_.h
+utf8Wrap.o: headers/dingbats_.h

Deleted: branches/branch-1.3-utf8/src/xutf8/stamp-h

Copied: branches/branch-1.3-utf8/src/xutf8/stamp-h (from rev 6206, branches/branch-1.3-utf8/xutf8/stamp-h)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/stamp-h	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/stamp-h	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1 @@
+timestamp

Deleted: branches/branch-1.3-utf8/src/xutf8/stamp-h.in

Copied: branches/branch-1.3-utf8/src/xutf8/stamp-h.in (from rev 6206, branches/branch-1.3-utf8/xutf8/stamp-h.in)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/stamp-h.in	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/stamp-h.in	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1 @@
+timestamp

Deleted: branches/branch-1.3-utf8/src/xutf8/test.c

Copied: branches/branch-1.3-utf8/src/xutf8/test.c (from rev 6206, branches/branch-1.3-utf8/xutf8/test.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/test.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/test.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,299 @@
+/******************************************************************************* *   $Id: $
+ *
+ *   UTF-8 X test program (It contains MINIMAL code to support XIM !!!)
+ *
+ *                 Copyright (c) 2000-2002  O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *   Author : Jean-Marc Lienher ( http://oksid.ch )
+ *
+ ******************************************************************************/
+
+/*
+To test it do :
+
+kinput2 -canna
+XMODIFIERS="@im=kinput2"; export XMODIFIERS
+LANG=ja_JP; export LANG
+./test
+
+	to open a conversion window press "Shift space"
+	type some keys.
+	press space.
+	select glyph with arrows keys.
+	press return.
+	press return.
+	press "Shift space" to close the window
+
+LANG=ar_AE; export LANG
+LANG=he_IL; export LANG
+export LANG=ja_JP; export XMODIFIERS="@im=kinput2"
+export LANG=ja_JP; export XMODIFIERS="@im=nicolatter"
+export LANG=ja_JP; export XMODIFIERS="@im=jmode"
+export LANG=ja_JP; export XMODIFIERS="@im=htt"
+export LANG=ko_KR; export XMODIFIERS="@im=Ami"
+export LANG=zh_TW; export XMODIFIERS="@im=xcin-zh_TW"
+export LANG=zh_TW; export XMODIFIERS="@im=xcin-zh_CN"
+export LANG=C; export XMODIFIERS="@im=interxim"
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <wchar.h>
+#include "Xutf8.h"
+#include <X11/Xlocale.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+
+char *jp_txt = "�UTF-8 e\xCC\x82=\xC3\xAA"
+		"  \357\274\270\357\274\254\357\274\246\357\274"
+		"\244\345\220\215\343\201\247\346\214\207    \345\256\232"
+		"\343\201\231\343\202\213";
+
+char *rtl_txt = "->e\xCC\x82=\xC3\xAA";
+
+XIM xim_im = NULL;
+XIC xim_ic = NULL;
+static XIMStyles* xim_styles = NULL;
+XUtf8FontStruct *fontset;
+GC gc;
+int x = 2;
+int y = 40;
+
+int main(int argc, char**argv)
+{
+	char **missing_charset_list;
+	int missing_charset_count;
+	XGCValues xgcv;
+	unsigned long mask;
+	Display* dpy;
+	int scr;
+	Window w, root;
+	XSetWindowAttributes set_attr;
+	int i;
+	XIMStyle *style;
+        static char buf[128];
+        KeySym keysym = 0;
+        Status status;
+	XWMHints wm_hints;
+    	XClassHint class_hints;
+	XIMStyle input_style = 0;
+	char **font_name_list;
+	char *def_string;
+	XFontStruct **font_struct_list;
+	char **font_encoding_list;
+	int nb_font;
+	int len = 0;
+	int no_xim = 0;
+
+	printf ("A -> %c \n", XUtf8Tolower('A'));
+    	if (!setlocale(LC_ALL, ""))
+        	puts("locale not supported by C library, locale unchanged");
+
+    	if (!XSetLocaleModifiers(""))
+        	puts("X locale modifiers not supported, using default");
+	
+	dpy = XOpenDisplay(0);
+	if (!dpy) { puts("cannot open display.\n"); exit(-1); }
+	scr = DefaultScreen(dpy);
+	root = RootWindow(dpy, scr);
+	set_attr.event_mask = KeyPressMask|FocusChangeMask;
+	set_attr.background_pixel = WhitePixel(dpy, DefaultScreen(dpy));
+	set_attr.border_pixel = BlackPixel(dpy, DefaultScreen(dpy));
+	w = XCreateWindow(dpy, root, 10,10,200,100,0, 
+		DefaultDepth(dpy, DefaultScreen(dpy)),
+		InputOutput, DefaultVisual(dpy, DefaultScreen(dpy)),
+		CWEventMask | CWBackPixel | CWBorderPixel, &set_attr);
+	if (!w) { puts("cannot creat window.\n"); exit(-1); }
+
+	class_hints.res_name = "test";
+    	class_hints.res_class = "Test";
+	wm_hints.input = True;
+    	wm_hints.flags = InputHint;
+
+    	XmbSetWMProperties(dpy, w, "test", "test", NULL, 0,
+                       NULL, &wm_hints, &class_hints);
+
+	XMapWindow(dpy, w);
+	xim_im = XOpenIM(dpy, NULL, "test", "Test");
+	if (!xim_im) { 
+		puts("cannot Open Input Manager: Try default.\n"); 
+		XSetLocaleModifiers("@im=");
+		xim_im = XOpenIM(dpy, NULL, "test", "Test");
+		if (!xim_im) { puts("Failed exiting.\n"); exit(-1); }
+	}
+	XGetIMValues (xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL);
+    	for (i = 0, style = xim_styles->supported_styles;
+         	i < xim_styles->count_styles; i++, style++)
+	{
+		if (i == 0 && *style == (XIMStatusNone|XIMPreeditNone)) {
+			printf("this is not a XIM server !!!\n");
+			no_xim = 1;
+		}
+        	printf("input style : 0x%X\n", *style);
+	}
+
+	xim_ic = XCreateIC(xim_im,
+                        XNInputStyle, 
+			(XIMPreeditNothing | XIMStatusNothing),
+                        XNClientWindow, w,
+			XNFocusWindow, w,
+                        NULL);
+	if (!xim_ic) { puts("cannot create Input Context.\n"); exit(-1);}
+    	XFree(xim_styles);
+	XSetICFocus(xim_ic);
+
+	/***************************************************************/
+	/** I don't recommand to use a font base name list similar 
+	 *  to the following one in a real application ;-) 
+	 *  You should use an iso8859-1 font, plus a single font for 
+	 *  your language. */
+	/***************************************************************/
+        fontset = XCreateUtf8FontStruct(dpy, 
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8858-3," /* not valid */
+		"-*-*-medium-r-*-*-*-*-*-*-*-*-iso8859-1,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-6,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-8,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-ksc5601.1987-0,"
+		"-*-symbol-*-*-*-*-*-*-*-*-*-*-adobe-fontspecific," 
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-2,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-koi8-1,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1983-0,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-jisx0212.1990-0,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-big5-0,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-jisx0201.1976-0,"
+		"-*-unifont-*-*-*-*-*-*-*-*-*-*-iso10646-1[0x300 0x400_0x500],"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-*-*"); 
+
+	/* THIS PART IS NOT REQUIERED */
+	nb_font = fontset->nb_font;
+
+        while (nb_font > 0) {
+                nb_font--;
+		if (fontset->fonts[nb_font]) {
+               		printf("encoding=\"\" fid=%d \n  %s\n", 
+			//	fontset->encodings[nb_font],
+                        	fontset->fonts[nb_font]->fid,
+				fontset->font_name_list[nb_font]);
+		}
+        }
+	/* END OF NOT REQUIERED PART*/
+
+	mask = (GCForeground | GCBackground);
+	xgcv.foreground = BlackPixel(dpy, DefaultScreen(dpy));
+    	xgcv.background = WhitePixel(dpy, DefaultScreen(dpy));
+
+        gc = XCreateGC(dpy, w, mask, &xgcv);
+	if (!gc) { puts("cannot create Graphic Context.\n"); exit(-1);}
+
+
+	/***************************************************************/
+	while (1) {
+		int filtered;
+	 	static XEvent xevent;
+		static XVaNestedList list1 = 0;
+		int r;
+
+               	XNextEvent(dpy, &xevent);
+		if (xevent.type == KeyPress) {
+			XKeyEvent *e = (XKeyEvent*) &xevent;
+			printf ("0x%X %d\n", e->state, e->keycode);
+		}
+		if (xevent.type == DestroyNotify) {
+			/* XIM server has crashed */
+			no_xim = 1;
+			XSetLocaleModifiers("@im=");
+			xim_im = XOpenIM(dpy, NULL, "test", "Test");
+			if (xim_im) {
+			   xim_ic = XCreateIC(xim_im,
+                        	XNInputStyle, (XIMPreeditNothing | 
+					XIMStatusNothing),
+                        	XNClientWindow, w,
+				XNFocusWindow, w,
+                        	NULL);
+   			} else {
+				xim_ic = NULL;
+			}
+			if (!xim_ic) {
+			 	puts("Crash recovery failed. exiting.\n");
+				exit(-1);
+			}
+		}
+		if (xevent.type != DestroyNotify) {
+			filtered = XFilterEvent(&xevent, 0);
+		}
+		if (xevent.type == FocusOut && xim_ic) XUnsetICFocus(xim_ic);
+		if (xevent.type == FocusIn && xim_ic) XSetICFocus(xim_ic);
+
+		if (xevent.type == KeyPress && !filtered) {
+ 			len = XUtf8LookupString(xim_ic, &xevent.xkey, 
+					buf, 127, &keysym, &status);
+
+			if (len == 1 && buf[0] == '\b') {
+				x -= XUtf8TextWidth(fontset, buf, len);
+				XUtf8DrawImageString(dpy, w, fontset, gc, 
+					x, y, buf, len);
+			} else if (len == 1 && buf[0] == '\r') {
+				y += fontset->ascent + fontset->descent;
+				x = 0;
+				XCloseIM(xim_im);
+			} else {
+				XUtf8DrawImageString(dpy, w, fontset, gc, 
+					x, y, buf, len);
+				x += XUtf8TextWidth(fontset, buf, len);
+			}
+
+
+			XUtf8DrawString(dpy, w, fontset, gc, 0, 20, 
+				jp_txt, strlen(jp_txt));
+	
+			XUtf8DrawString(dpy, w, fontset, gc, 50, 90,
+				rtl_txt, strlen(rtl_txt));
+			XUtf8DrawRtlString(dpy, w, fontset, gc, 
+				50, 90, rtl_txt, strlen(rtl_txt));
+			buf[len] = 0;
+			printf("'%s' %d %x\n", buf, keysym, keysym);
+			buf[0] = 0;
+
+                }
+		if (filtered) {
+			printf("Dead key\n");
+		}
+	}
+	XFreeUtf8FontStruct(dpy, fontset);
+	return 0;
+}
+

Deleted: branches/branch-1.3-utf8/src/xutf8/test2.c

Copied: branches/branch-1.3-utf8/src/xutf8/test2.c (from rev 6206, branches/branch-1.3-utf8/xutf8/test2.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/test2.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/test2.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,242 @@
+/******************************************************************************* *   $Id: $
+ *
+ *   UTF-8 X test program
+ *
+ *                 Copyright (c) 2002  O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *   Author : Jean-Marc Lienher ( http://oksid.ch )
+ *
+ ******************************************************************************/
+
+/*
+To test it do :
+
+kinput2 -canna
+XMODIFIERS="@im=kinput2"; export XMODIFIERS
+LANG=ja_JP; export LANG
+./test
+
+	to open a conversion window press "Shift space"
+	type some keys.
+	press space.
+	select glyph with arrows keys.
+	press return.
+	press return.
+	press "Shift space" to close the window
+
+LANG=ar_AE; export LANG
+LANG=he_IL; export LANG
+export LANG=ja_JP; export XMODIFIERS="@im=kinput2"
+export LANG=ja_JP; export XMODIFIERS="@im=nicolatter"
+export LANG=ja_JP; export XMODIFIERS="@im=jmode"
+export LANG=ja_JP; export XMODIFIERS="@im=htt"
+export LANG=ko_KR; export XMODIFIERS="@im=ami"
+export LANG=zh_TW; export XMODIFIERS="@im=xcin-zh_TW"
+export LANG=zh_TW; export XMODIFIERS="@im=xcin-zh_CN"
+export LANG=fr_FR.UTF-8; export XMODIFIERS="@im=interxim"
+
+export LD_PRELOAD="/usr/src/x11/xc/exports/lib/libX11.so /usr/src/x11/xc/exports/lib/libxlcDef.so.2 /usr/src/x11/xc/exports/lib/libxlibi18n.so.2 /usr/src/x11/xc/exports/lib/libxlocale.so.2 /usr/src/x11/xc/exports/lib/libxomGeneric.so.2 /usr/src/x11/xc/exports/lib/libximcp.so.2"
+
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <wchar.h>
+#include <X11/Xlocale.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmd.h>
+
+char *jp_txt = "�UTF-8 e\xCC\x82=\xC3\xAA"
+		"  \357\274\270\357\274\254\357\274\246\357\274"
+		"\244\345\220\215\343\201\247\346\214\207    \345\256\232"
+		"\343\201\231\343\202\213";
+
+char *rtl_txt = "->e\xCC\x82=\xC3\xAA";
+
+XIM xim_im = NULL;
+XIC xim_ic = NULL;
+static XIMStyles* xim_styles = NULL;
+XFontSet fontset;
+GC gc;
+int x = 2;
+int y = 40;
+
+int main(int argc, char**argv)
+{
+	char **missing_charset_list;
+	int missing_charset_count;
+	XGCValues xgcv;
+	unsigned long mask;
+	Display* dpy;
+	int scr;
+	Window w, root;
+	XSetWindowAttributes set_attr;
+	int i;
+	XIMStyle *style;
+        static char buf[128];
+        KeySym keysym = 0;
+        Status status;
+	XWMHints wm_hints;
+    	XClassHint class_hints;
+	XIMStyle input_style = 0;
+	char **font_name_list;
+	char *def_string;
+	XFontStruct **font_struct_list;
+	char **font_encoding_list;
+	int nb_font;
+	int len = 0;
+	int no_xim = 0;
+	char **missing_charset_list_return;
+	int missing_charset_count_return;
+	char *def_string_return;
+    	
+	if (!setlocale(LC_ALL, ""))
+        	puts("locale not supported by C library, locale unchanged");
+
+    	if (!XSetLocaleModifiers(""))
+        	puts("X locale modifiers not supported, using default");
+	
+	dpy = XOpenDisplay(0);
+	scr = DefaultScreen(dpy);
+	root = RootWindow(dpy, scr);
+	set_attr.event_mask = KeyPressMask|FocusChangeMask;
+	set_attr.background_pixel = WhitePixel(dpy, DefaultScreen(dpy));
+	set_attr.border_pixel = BlackPixel(dpy, DefaultScreen(dpy));
+	w = XCreateWindow(dpy, root, 10,10,200,100,0, 
+		DefaultDepth(dpy, DefaultScreen(dpy)),
+		InputOutput, DefaultVisual(dpy, DefaultScreen(dpy)),
+		CWEventMask | CWBackPixel | CWBorderPixel, &set_attr);
+
+	class_hints.res_name = "test";
+    	class_hints.res_class = "Test";
+	wm_hints.input = True;
+    	wm_hints.flags = InputHint;
+
+    	XmbSetWMProperties(dpy, w, "test", "test", NULL, 0,
+                       NULL, &wm_hints, &class_hints);
+
+	XMapWindow(dpy, w);
+	xim_im = XOpenIM(dpy, NULL, "test", "Test");
+	XGetIMValues (xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL);
+    	for (i = 0, style = xim_styles->supported_styles;
+         	i < xim_styles->count_styles; i++, style++)
+	{
+		if (*style == (XIMStatusNone|XIMPreeditNone)) {
+			printf("this is not a XIM server !!!\n");
+			no_xim = 1;
+		}
+        	printf("input style : 0x%X\n", *style);
+	}
+    	XFree(xim_styles);
+
+	xim_ic = XCreateIC(xim_im,
+                        XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
+                        XNClientWindow, w,
+			XNFocusWindow, w,
+                        NULL);
+	XSetICFocus(xim_ic);
+
+	/***************************************************************/
+	/** I don't recommand to use a font base name list similar 
+	 *  to the following one in a real application ;-) */
+	/***************************************************************/
+        fontset = XCreateFontSet(dpy, 
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8858-3," /* not valid */
+		"-*-*-medium-r-*-*-*-*-*-*-*-*-iso8859-1,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-6,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-8,"
+		"-*-symbol-*-*-*-*-*-*-*-*-*-*-adobe-fontspecific," 
+		"-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-2,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-koi8-1,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1983-0,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-jisx0212.1990-0,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-big5-0,"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-jisx0201.1976-0,"
+		"-*-unifont-*-*-*-*-*-*-*-*-*-*-iso10646-1[0x300 0x400_0x500],"
+		"-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
+		&missing_charset_list_return,
+		&missing_charset_count_return,
+		&def_string_return); 
+	mask = (GCForeground | GCBackground);
+	xgcv.foreground = BlackPixel(dpy, DefaultScreen(dpy));
+    	xgcv.background = WhitePixel(dpy, DefaultScreen(dpy));
+
+        gc = XCreateGC(dpy, w, mask, &xgcv);
+
+
+	/***************************************************************/
+	while (1) {
+		int filtered;
+	 	static XEvent xevent;
+		static XVaNestedList list1 = 0;
+		int r;
+
+                XNextEvent(dpy, &xevent);
+		if (xevent.type == KeyPress) {
+			XKeyEvent *e = (XKeyEvent*) &xevent;
+			printf ("0x%X %d\n", e->state, e->keycode);
+		}
+		filtered = XFilterEvent(&xevent, w);
+		if (xevent.type == FocusOut) XUnsetICFocus(xim_ic);
+		if (xevent.type == FocusIn) XSetICFocus(xim_ic);
+	
+                if (xevent.type == KeyPress && !filtered) {
+ 			len = Xutf8LookupString(xim_ic, &xevent.xkey, 
+					buf, 127, &keysym, &status);
+
+			Xutf8DrawImageString(dpy, w, fontset, gc, 
+					x, y, buf, len);
+
+
+			Xutf8DrawString(dpy, w, fontset, gc, 0, 20, 
+				jp_txt, strlen(jp_txt));
+	
+			Xutf8DrawString(dpy, w, fontset, gc, 50, 90,
+				rtl_txt, strlen(rtl_txt));
+			buf[len] = 0;
+			printf("'%s' %d\n", buf, keysym);
+			buf[0] = 0;
+			XCloseIM(xim_im);
+                }
+		if (filtered) {
+			printf("Dead key\n");
+		}
+	}
+	XFreeFontSet(dpy, fontset);
+	return 0;
+}
+

Deleted: branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c

Copied: branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c (from rev 6206, branches/branch-1.3-utf8/xutf8/ucs2fontmap.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,382 @@
+/******************************************************************************
+              Copyright (c) 2000-2002 by O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+
+        Author: Jean-Marc Lienher ( http://oksid.ch )
+
+******************************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+
+#define RET_ILSEQ -1
+#define RET_TOOFEW(x) (-10 - x)
+#define RET_TOOSMALL -2
+#define conv_t void*
+#define ucs4_t unsigned int
+typedef struct {
+	unsigned short indx;
+	unsigned short used;
+} Summary16;
+
+
+#include "lcUniConv/big5.h"
+#include "lcUniConv/gb2312.h"
+#include "lcUniConv/iso8859_10.h"
+#include "lcUniConv/iso8859_11.h"
+#include "lcUniConv/iso8859_13.h"
+#include "lcUniConv/iso8859_14.h"
+#include "lcUniConv/iso8859_15.h"
+#include "lcUniConv/iso8859_2.h"
+#include "lcUniConv/iso8859_3.h"
+#include "lcUniConv/iso8859_4.h"
+#include "lcUniConv/iso8859_5.h"
+#include "lcUniConv/iso8859_6.h"
+#include "lcUniConv/iso8859_7.h"
+#include "lcUniConv/iso8859_8.h"
+#include "lcUniConv/iso8859_9.h"
+#include "lcUniConv/jisx0201.h"
+#include "lcUniConv/jisx0208.h"
+#include "lcUniConv/jisx0212.h"
+#include "lcUniConv/koi8_r.h"
+#include "lcUniConv/koi8_u.h"
+#include "lcUniConv/ksc5601.h"
+#include "lcUniConv/cp1251.h"
+#include "headers/symbol_.h"
+#include "headers/dingbats_.h"
+  
+   /*************** conv_gen.c ************/
+//const
+int ucs2fontmap(char *s, unsigned int ucs, int enc)
+{
+  switch(enc) {
+  case 0:	//iso10646-1
+    s[0] = (char) ((ucs & 0xFF00) >> 8);
+    s[1] = (char) (ucs & 0xFF);
+    return 0;
+    break;
+  case 1:	//iso8859-1
+    if (ucs <= 0x00FF) {
+      if (ucs >= 0x0001) {
+        s[0] = 0;
+        s[1] = (char) (ucs & 0xFF);
+        return 1;
+      }
+    }
+    break;
+  case 2:	//iso8859-2
+    if (ucs <= 0x00a0) {
+      s[0] = 0;
+      s[1] = (char) ucs;
+      return 2;
+    } else if (ucs < 0x0180) {
+      if (ucs >= 0x00a0) {
+	s[0] = 0;
+	s[1] = (char)  iso8859_2_page00[ucs-0x00a0];
+        if (s[1]) return 2;
+      }
+    } else if (ucs < 0x02e0) {
+      if (ucs >= 0x02c0) {
+        s[0] = 0;
+        s[1] = (char) iso8859_2_page02[ucs-0x02c0];
+        if (s[1]) return 2;
+      }	
+    }
+    break;
+  case 3:	//iso8859-3
+    if (iso8859_3_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 3;
+    } 
+    break;
+  case 4:	//iso8859-4
+    if (iso8859_4_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 4;
+    } 
+    break;
+  case 5:	//iso8859-5
+    if (iso8859_5_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 5;
+    } 
+    break;
+  case 6:	//iso8859-6
+    if (iso8859_6_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 6;
+    } 
+    break;
+  case 7:	//iso8859-7
+    if (iso8859_7_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 7;
+    } 
+    break;
+  case 8:	//iso8859-8
+    if (iso8859_8_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 8;
+    } 
+    break;
+  case 9:	//iso8859-9
+    if (iso8859_9_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 9;
+    } 
+    break;
+  case 10:	//iso8859-10
+    if (iso8859_10_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 10;
+    } 
+    break;
+  case 25:	//iso8859-11
+    if (iso8859_11_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 25;
+    } 
+    break;
+  case 11:	//iso8859-13
+    if (iso8859_13_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 11;
+    } 
+    break;
+  case 12:	//iso8859-14
+    if (iso8859_14_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 12;
+    } 
+    break;
+  case 13:	//iso8859-15
+    if (iso8859_15_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 13;
+    } 
+    break;
+  case 14:	//koi8-r
+    if (koi8_r_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 14;
+    } 
+    break;
+  case 15:	//big5
+    if (big5_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 15;
+    } 
+    break;
+  case 16:	//ksc5601.1987-0
+    if (ksc5601_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 16;
+    } 
+    break;
+  case 17:	//gb2312.1980-0
+    if (gb2312_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 17;
+    } 
+    break;
+  case 18:	//jisx0201.1976-0
+    if (jisx0201_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 18;
+    } 
+    break;
+  case 19:	//jisx0208.1983-0
+    if (jisx0208_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 19;
+    } 
+    break;
+  case 20:	//jisx0212.1990-0
+    if (jisx0212_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 20;
+    } 
+    break;
+  case 21:	//symbol
+    if (ucs <= 0x00F7) {
+      if (ucs >= 0x0020) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_0020[ucs - 0x0020];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0x0192) {
+      if (ucs >= 0x0192) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_0192[ucs - 0x0192];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0x03D6) {
+      if (ucs >= 0x0391) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_0391[ucs - 0x0391];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0x232A) {
+      if (ucs >= 0x2022) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_2022[ucs - 0x2022];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0x25CA) {
+      if (ucs >= 0x25CA) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_25CA[ucs - 0x25CA];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0x2666) {
+      if (ucs >= 0x2660) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_2660[ucs - 0x2660];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0xF6DB) {
+      if (ucs >= 0xF6D9) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_F6D9[ucs - 0xF6D9];
+        if (s[1]) return 21;
+      }
+    } else if (ucs <= 0xF8FE) {
+      if (ucs >= 0xF8E5) {
+        s[0] = 0;
+        s[1] = unicode_to_symbol_1b_F8E5[ucs - 0xF8E5];
+        if (s[1]) return 21;
+      }
+    }
+    break;
+  case 22:	//dingbats
+    if (ucs <= 0x00A0) {
+      if (ucs >= 0x0020) {
+        s[0] = 0;
+        s[1] = unicode_to_dingbats_1b_0020[ucs - 0x0020];
+        if (s[1]) return 22;
+      }
+    } else if (ucs <= 0x2195) {
+      if (ucs >= 0x2192) {
+        s[0] = 0;
+        s[1] = unicode_to_dingbats_1b_2192[ucs - 0x2192];
+        if (s[1]) return 22;
+      }
+    } else if (ucs <= 0x2469) {
+      if (ucs >= 0x2460) {
+        s[0] = 0;
+        s[1] = unicode_to_dingbats_1b_2460[ucs - 0x2460];
+        if (s[1]) return 22;
+      }
+    } else if (ucs <= 0x2666) {
+      if (ucs >= 0x25A0) {
+        s[0] = 0;
+        s[1] = unicode_to_dingbats_1b_25A0[ucs - 0x25A0];
+        if (s[1]) return 22;
+      }
+    } else if (ucs <= 0x27BE) {
+      if (ucs >= 0x2701) {
+        s[0] = 0;
+        s[1] = unicode_to_dingbats_1b_2701[ucs - 0x2701];
+        if (s[1]) return 22;
+      }
+    } else if (ucs <= 0xF8E4) {
+      if (ucs >= 0xF8D7) {
+        s[0] = 0;
+        s[1] = unicode_to_dingbats_1b_F8D7[ucs - 0xF8D7];
+        if (s[1]) return 22;
+      }
+    }
+    break;
+  case 23:	//koi8-u
+    if (koi8_u_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 23;
+    } 
+    break;
+  case 24:	//microsoft-cp1251
+    if (cp1251_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
+      return 24;
+    } 
+    break;
+  default:
+    break;
+  };
+  return -1;
+};
+
+//const
+int encoding_number(const char *enc)
+{
+  if (!enc || !strncmp(enc, "iso10646-1", 10)) {
+    return 0;
+  } else if (!strcmp(enc, "iso8859-1")) {
+    return 1;
+  } else if (!strcmp(enc, "iso8859-2")) {
+    return 2;
+  } else if (!strcmp(enc, "iso8859-3")) {
+    return 3;
+  } else if (!strcmp(enc, "iso8859-4")) {
+    return 4;
+  } else if (!strcmp(enc, "iso8859-5")) {
+    return 5;
+  } else if (!strcmp(enc, "iso8859-6")) {
+    return 6;
+  } else if (!strcmp(enc, "iso8859-7")) {
+    return 7;
+  } else if (!strcmp(enc, "iso8859-8")) {
+    return 8;
+  } else if (!strcmp(enc, "iso8859-9")) {
+    return 9;
+  } else if (!strcmp(enc, "iso8859-10")) {
+    return 10;
+  } else if (!strcmp(enc, "iso8859-13")) {
+    return 11;
+  } else if (!strcmp(enc, "iso8859-14")) {
+    return 12;
+  } else if (!strcmp(enc, "iso8859-15")) {
+    return 13;
+  } else if (!strcmp(enc, "koi8-r")) {
+    return 14;
+  } else if (!strcmp(enc, "big5-0") || !strcmp(enc, "big5.eten-0") ||
+    !strcmp(enc, "big5p-0")) 
+  {
+    return 15;
+  } else if (!strcmp(enc, "ksc5601.1987-0")) {
+    return 16;
+  } else if (!strcmp(enc, "gb2312.1980-0") || !strcmp(enc, "gb2312.80-0") || 
+     !strcmp(enc, "gb2312.80&gb8565.88") ||  !strcmp(enc, "gb2312.80-0")) 
+  {
+    return 17;
+  } else if (!strcmp(enc, "jisx0201.1976-0")) {
+    return 18;
+  } else if (!strcmp(enc, "jisx0208.1983-0") || !strcmp(enc, "jisx0208.1990-0")
+    || !strcmp(enc, "jisx0208.1978-0")) 
+  {
+    return 19;
+  } else if (!strcmp(enc, "jisx0212.1990-0")) {
+    return 20;
+  } else if (!strcmp(enc, "symbol")) {
+    return 21;
+  } else if (!strcmp(enc, "dingbats") || !strcmp(enc, "zapfdingbats") || 
+    !strcmp(enc, "zapf dingbats") || !strcmp(enc, "itc zapf dingbats")) 
+  {
+    return 22;
+  } else if (!strcmp(enc, "koi8-u")) {
+    return 23;
+  } else if (!strcmp(enc, "microsoft-cp1251")) {
+    return 24;
+  } else if (!strcmp(enc, "iso8859-11")) {
+    return 25;
+  };
+  return -1;
+};
+

Deleted: branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c.mini

Copied: branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c.mini (from rev 6206, branches/branch-1.3-utf8/xutf8/ucs2fontmap.c.mini)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c.mini	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/ucs2fontmap.c.mini	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,55 @@
+/******************************************************************************
+              Copyright 2000 by O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+
+        Author: Jean-Marc Lienher ( http://oksid.ch )
+
+******************************************************************************/
+
+int ucs2fontmap(char *s, unsigned long ucs, int enc)
+{
+    s[0] = (char) ((ucs & 0xFF00) >> 8);
+    s[1] = (char) (ucs & 0xFF);
+    return 0;
+}
+
+
+int encoding_number(const char *enc)
+{
+  return 0;
+}
+
+const char *encoding_name(int num)
+{
+    return "iso10646-1";
+};
+

Deleted: branches/branch-1.3-utf8/src/xutf8/utf8Input.c

Copied: branches/branch-1.3-utf8/src/xutf8/utf8Input.c (from rev 6206, branches/branch-1.3-utf8/xutf8/utf8Input.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/utf8Input.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/utf8Input.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,443 @@
+/******************************************************************************
+              Copyright (c) 2000-2002 by O'ksi'D
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+
+******************************************************************************/
+
+#include "../config.h"
+#include <FL/Xutf8.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+#include <stdlib.h>
+
+#if HAVE_LIBC_ICONV
+#include <iconv.h>
+#endif
+/*
+  I haven't found much doc on the web about EUC encodings, so I've used
+  GNU libiconv source code as a reference.
+  http://clisp.cons.org/~haible/packages-libiconv.html
+*/
+
+#define RET_ILSEQ -1
+#define RET_TOOFEW(x) (-10 - x)
+#define RET_TOOSMALL -2
+#define conv_t void*
+#define ucs4_t unsigned int
+typedef struct {
+        unsigned short indx;
+        unsigned short used;
+} Summary16;
+
+#include "lcUniConv/big5.h"
+#include "lcUniConv/gb2312.h"
+#include "lcUniConv/jisx0201.h"
+#include "lcUniConv/jisx0208.h"
+#include "lcUniConv/jisx0212.h"
+#include "lcUniConv/ksc5601.h"
+
+int 
+XConvertEucTwToUtf8(
+	char*		buffer_return,
+	int		len)
+{
+ /* FIXME */
+#if HAVE_LIBC_ICONV
+	iconv_t cd;
+	int cdl;
+#else
+	int i = 0;
+#endif
+	int l = 0;
+	char *buf, *b;
+
+	if (len < 1) return 0;
+	b = buf = (char*) malloc((unsigned)len);
+	memcpy(buf, buffer_return, (unsigned) len);
+
+#if HAVE_LIBC_ICONV
+	l = cdl = len;
+	cd = iconv_open("EUC-TW", "UTF-8");
+	iconv(cd, &b, &len, &buffer_return, &cdl);
+	iconv_close(cd);
+	l -= cdl;	
+#else
+	while (i < len) {
+		unsigned int ucs;
+		unsigned char c; 
+		c = (unsigned char) buf[i];
+		if (c < 0x80) {
+			ucs = c;	
+			i++;
+		} else if (c >= 0xa1 && c < 0xff && len - i > 1 ) {
+			unsigned char b[2];
+			b[0] = (unsigned char) c - 0x80;
+			b[1] = (unsigned char) buf[i + 1] - 0x80;
+			ucs = ' '; i += 2;
+		} else if (c == 0x8e &&  len - i > 3) {
+			unsigned char b[2];
+			unsigned char c1 =  buf[i + 1];
+			unsigned char c2 =  buf[i + 2];
+			unsigned char c3 =  buf[i + 3];
+			b[0] = (unsigned char)  buf[i + 2] - 0x80;
+			b[1] = (unsigned char)  buf[i + 3] - 0x80;
+			if (c1 >= 0xa1 && c1 <= 0xb0) {
+				if (c2 >= 0xa1 && c2 < 0xff && c3 >= 0xa1 &&
+					c3 < 0xff)
+				{
+					ucs = ' '; i += 4;
+				} else {
+					ucs = '?'; i++;
+				}
+			} else {
+				ucs = '?'; i++;
+			}
+		} else {
+			ucs = '?';
+			i++;
+		}
+		l += XConvertUcsToUtf8(ucs, buffer_return + l);
+	}
+#endif
+	free(buf);
+	return l;
+}
+
+int 
+XConvertEucKrToUtf8(
+	char*		buffer_return,
+	int		len)
+{
+	int i = 0, l = 0;
+	char *buf;
+
+	if (len < 1) return 0;
+
+	buf = (char*) malloc((unsigned)len);
+	memcpy(buf, buffer_return, (unsigned)len);
+
+	while (i < len) {
+		unsigned int ucs;
+		unsigned char c, c1;
+		c = (unsigned char) buf[i];
+		if (c < 0x80) {
+			ucs = c;	
+			i++;
+		} else if (c >= 0xA1 && c < 0xFF && len - i > 1) {
+			c1 = (unsigned char) buf[i + 1];
+			if (c1 >= 0xa1 && c1 < 0xff) {
+				unsigned char b[2];
+				b[0] = c - 0x80;
+				b[1] = c1 - 0x80;
+				if (ksc5601_mbtowc(NULL, &ucs, b, 2) < 1) {
+					ucs = '?';
+				}
+			} else {
+				ucs = '?';
+			}
+			i += 2;
+		} else {
+			ucs = '?';
+			i++;
+		}
+		l += XConvertUcsToUtf8(ucs, buffer_return + l);
+	}
+	free(buf);
+	return l;
+}
+
+int 
+XConvertBig5ToUtf8(
+	char*		buffer_return,
+	int		len)
+{
+	int i = 0, l = 0;
+	char *buf;
+
+	if (len < 1) return 0;
+	buf = (char*) malloc((unsigned)len);
+	memcpy(buf, buffer_return, (unsigned)len);
+
+	if (len == 1) {
+		l += XConvertUcsToUtf8((unsigned int)buf[i], buffer_return + l);
+	}
+	while (i + 1 < len) {
+		unsigned int ucs;
+		unsigned char b[2];
+		b[0] = (unsigned char) buf[i];
+		b[1] = (unsigned char) buf[i + 1];
+		if (big5_mbtowc(NULL, &ucs, b, 2) == 2) {
+			i += 2;
+		} else {
+			ucs = '?';
+			i++;
+		}
+		l += XConvertUcsToUtf8(ucs, buffer_return + l);
+	}
+	free(buf);
+	return l;
+}
+
+int 
+XConvertGb2312ToUtf8(
+	char*		buffer_return,
+	int		len)
+{
+	int i = 0, l = 0;
+	char *buf;
+
+	if (len < 1) return 0;
+	buf = (char*) malloc((unsigned)len);
+	memcpy(buf, buffer_return, (unsigned)len);
+
+	if (len == 1) {
+		l += XConvertUcsToUtf8((unsigned int)buf[i], buffer_return + l);
+	}
+	while (i + 1 < len) {
+		unsigned int ucs;
+		unsigned char b[2];
+		b[0] = (unsigned char) buf[i];
+		b[1] = (unsigned char) buf[i + 1];
+		if (gb2312_mbtowc(NULL, &ucs, b, 2) == 2) {
+			i += 2;
+		} else {
+			ucs = '?';
+			i++;
+		}
+		l += XConvertUcsToUtf8(ucs, buffer_return + l);
+	}
+	free(buf);
+	return l;
+}
+
+int 
+XConvertEucCnToUtf8(
+	char*		buffer_return,
+	int		len)
+{
+	int i = 0, l = 0;
+	char *buf;
+
+	if (len < 1) return 0;
+	buf = (char*) malloc((unsigned)len);
+	memcpy(buf, buffer_return, (unsigned)len);
+
+	while (i < len) {
+		unsigned int ucs;
+		unsigned char c, c1;
+		c = (unsigned char) buf[i];
+		if (c < 0x80) {
+			ucs = c;	
+			i++;
+		} else if (c >= 0xA1 && c < 0xFF && len - i > 1) {
+			c1 = (unsigned char) buf[i + 1];
+			if (c1 >= 0xa1 && c1 < 0xff) {	
+				unsigned char b[2];
+				b[0] = (unsigned char) c;
+				b[1] = (unsigned char) c1;
+				if (gb2312_mbtowc(NULL, &ucs, b, 2) < 1) {
+					 ucs = '?';
+				}	
+			} else {
+				ucs = '?';
+			}
+			i += 2;
+		} else {
+			ucs = '?';
+			i++;
+		}
+		l += XConvertUcsToUtf8(ucs, buffer_return + l);
+	}
+	free(buf);
+	return l;
+}
+
+int 
+XConvertEucJpToUtf8(
+	char*		buffer_return,
+	int		len)
+{
+	int i = 0, l = 0;
+	char *buf;
+
+	if (len < 1) return 0;
+	buf = (char*) malloc((unsigned)len);
+	memcpy(buf, buffer_return, (unsigned)len);
+
+	while (i < len) {
+		unsigned int ucs;
+		unsigned char c, c1;
+		c = (unsigned char) buf[i];
+		if (c < 0x80) {
+			ucs = c;	
+			i++;
+		} else if (c >= 0xA1 && c < 0xFF && len - i > 1) {
+			c1 = (unsigned char) buf[i + 1];		
+			if (c < 0xF5 && c1 >= 0xa1) {
+				unsigned char b[2];
+				b[0] = c - 0x80;
+				b[1] = c1 - 0x80;
+				if (jisx0208_mbtowc(NULL, &ucs, b, 2) < 1) { 
+					ucs = '?';
+				}
+			} else if (c1 >= 0xA1 && c1 < 0xFF) {
+				ucs = 0xE000 + 94 * (c - 0xF5) + (c1 - 0xA1);
+			} else {
+				ucs = '?';
+			}
+			i += 2;
+		} else if (c == 0x8E && len - i > 1) {
+			c1 = (unsigned char) buf[i + 1];		
+			if (c1 >= 0xa1 && c1 <= 0xe0) {
+				if (jisx0201_mbtowc(NULL, &ucs, &c1, 1) != 1) {
+					ucs = '?';
+				}
+			} else {
+				ucs = '?';
+			}
+			i += 2;
+		} else if (c == 0x8F && len - i > 2) {
+			c = (unsigned char) buf[i + 1];		
+			c1 = (unsigned char) buf[i + 2];	
+			if (c >= 0xa1 && c < 0xff) {
+				if (c < 0xf5 && c1 >= 0xa1 && c1 < 0xff) {
+					unsigned char b[2];
+					b[0] = c - 0x80;
+					b[1] = c1 - 0x80;
+					if (jisx0212_mbtowc(NULL, &ucs, b, 2) 
+						< 1) 
+					{
+						ucs = '?';
+					}
+				} else {
+					ucs = '?';
+				}
+			} else {
+				if (c1 >= 0xa1 && c1 < 0xff) {
+					ucs = 0xe3ac + 94 * (c - 0xF5) + 
+						(c1 - 0xA1);
+				} else {
+					ucs = '?';
+				}
+			}
+			i += 3;
+		} else {
+			ucs = '?';
+			i++;
+		}
+		l += XConvertUcsToUtf8(ucs, buffer_return + l);
+	}
+	free(buf);
+	return l;
+}
+
+int
+XConvertEucToUtf8(
+	const char*	locale,
+	char*		buffer_return, 
+	int		len, 
+	int		bytes_buffer)
+{
+	if (!locale/* || strstr(locale, "UTF") || strstr(locale, "utf")*/) {
+		return len;
+	}
+
+	if (strstr(locale, "ja")) {	
+		return XConvertEucJpToUtf8(buffer_return, len);
+	} else if (strstr(locale, "Big5") || strstr(locale, "big5")) { // BIG5
+		return XConvertBig5ToUtf8(buffer_return, len);
+	} else if (strstr(locale, "zh") || strstr(locale, "chinese-")) {
+		if (strstr(locale, "TW") || strstr(locale, "chinese-t")) {
+			if (strstr(locale, "EUC") || strstr(locale, "euc") ||
+				strstr(locale, "chinese-t")) 
+			{
+				return XConvertEucTwToUtf8(buffer_return, len);
+			}
+			return XConvertBig5ToUtf8(buffer_return, len);
+		}
+		if (strstr(locale, "EUC") || strstr(locale, "euc")) {
+			return XConvertEucCnToUtf8(buffer_return, len);
+		}
+		return XConvertGb2312ToUtf8(buffer_return, len);
+	} else if (strstr(locale, "ko")) { 
+		return XConvertEucKrToUtf8(buffer_return, len);
+	}
+	return len;
+}
+
+
+int
+XUtf8LookupString(
+    XIC                 ic,
+    XKeyPressedEvent*   event,
+    char*               buffer_return,
+    int                 bytes_buffer,
+    KeySym*             keysym,
+    Status*             status_return)
+{
+        long ucs = -1;
+        int len;
+        len = XmbLookupString(ic, event, buffer_return, bytes_buffer / 5,
+                         keysym, status_return);
+	if (*status_return == XBufferOverflow) {
+		return len * 5;
+	}
+	if (*keysym > 0 && *keysym < 0x100 && len == 1) {
+		if (*keysym < 0x80) {
+			ucs = (unsigned char)buffer_return[0];
+		} else {
+			ucs = *keysym;
+		}
+	} else  if (((*keysym >= 0x100 && *keysym <= 0xf000) ||
+                              (*keysym & 0xff000000U) == 0x01000000))
+        {
+                ucs = XKeysymToUcs(*keysym);
+        } else {
+                ucs = -2;
+        }
+
+        if (ucs > 0) {
+                len = XConvertUcsToUtf8((unsigned)ucs, (char *)buffer_return);
+        } else if (len > 0) {
+		XIM im;
+		if (!ic) return 0;
+		im = XIMOfIC(ic);
+		if (!im) return 0;
+		len = XConvertEucToUtf8(XLocaleOfIM(im), 
+			buffer_return, len, bytes_buffer);	
+	}
+        return len;
+}
+
+

Deleted: branches/branch-1.3-utf8/src/xutf8/utf8Utils.c

Copied: branches/branch-1.3-utf8/src/xutf8/utf8Utils.c (from rev 6206, branches/branch-1.3-utf8/xutf8/utf8Utils.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/utf8Utils.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/utf8Utils.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,255 @@
+/*
+ * "$Id:  $"
+ *
+ * Unicode to UTF-8 conversion functions.
+ *
+ *      Copyright (c) 2000,2001 by O'ksi'D.
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *  Author: Jean-Marc Lienher ( http://oksid.ch )
+ */
+
+#include <FL/Xutf8.h>
+
+/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/
+
+/* 
+ * Converts the first char of the UTF-8 string to an Unicode value 
+ * Returns the byte length of the converted UTF-8 char 
+ * Returns -1 if the UTF-8 string is not valid 
+ */
+int
+XConvertUtf8ToUcs(
+        const unsigned char     *buf,
+        int                     len,
+        unsigned int          	*ucs)
+{
+      if (buf[0] & 0x80) {
+	if (buf[0] & 0x40) {
+	  if (buf[0] & 0x20) {
+	    if (buf[0] & 0x10) {
+	      if (buf[0] & 0x08) {
+		if (buf[0] & 0x04) {
+		  if (buf[0] & 0x02) {
+			/* bad UTF-8 string */
+		  } else {
+			/* 0x04000000 - 0x7FFFFFFF */
+		  }	
+		} else if (len > 4 
+				&& (buf[1] & 0xC0) == 0x80
+				&& (buf[2] & 0xC0) == 0x80
+				&& (buf[3] & 0xC0) == 0x80
+				&& (buf[4] & 0xC0) == 0x80) 
+		{
+		  /* 0x00200000 - 0x03FFFFFF */
+                  *ucs =  ((buf[0] & ~0xF8) << 24) +
+                          ((buf[1] & ~0x80) << 18) +
+                          ((buf[2] & ~0x80) << 12) +
+                          ((buf[3] & ~0x80) << 6) +
+                           (buf[4] & ~0x80);
+		  if (*ucs > 0x001FFFFF && *ucs < 0x01000000) return 5;
+		}
+              } else if (len > 3 
+				&& (buf[1] & 0xC0) == 0x80
+				&& (buf[2] & 0xC0) == 0x80
+				&& (buf[3] & 0xC0) == 0x80) 
+	      {
+		/* 0x00010000 - 0x001FFFFF */
+                *ucs =  ((buf[0] & ~0xF0) << 18) +
+                        ((buf[1] & ~0x80) << 12) +
+                        ((buf[2] & ~0x80) << 6) +
+                         (buf[3] & ~0x80);
+	        if (*ucs > 0x0000FFFF) return 4;
+              }
+	    } else if (len > 2 && 
+			(buf[1] & 0xC0) == 0x80 && 
+			(buf[2] & 0xC0) == 0x80) 
+	    {
+	      /* 0x00000800 - 0x0000FFFF */
+              *ucs =  ((buf[0] & ~0xE0) << 12) +
+               	      ((buf[1] & ~0x80) << 6) +
+                       (buf[2] & ~0x80);
+              if (*ucs > 0x000007FF) return 3;
+	    }	
+	  } else if (len > 1 && (buf[1] & 0xC0) == 0x80) {
+	    /* 0x00000080 - 0x000007FF */
+	    *ucs = ((buf[0] & ~0xC0) << 6) +
+		    (buf[1] & ~0x80);
+	    if (*ucs > 0x0000007F) return 2;
+	  }
+	}
+      } else if (len > 0) {
+	/* 0x00000000 - 0x0000007F */
+	*ucs = buf[0];
+	return 1;
+      } 
+
+      *ucs = (unsigned int) '?'; /* bad utf-8 string */
+      return -1;
+}
+
+/* 
+ * Converts an Unicode value to an UTF-8 string 
+ * NOTE : the buffer (buf) must be at least 5 bytes long !!!  
+ */
+int 
+XConvertUcsToUtf8(
+	unsigned int 	ucs, 
+	char 		*buf)
+{
+	if (ucs < 0x000080) {
+		buf[0] = ucs;
+		return 1;
+	} else if (ucs < 0x000800) {
+		buf[0] = 0xC0 | (ucs >> 6);
+		buf[1] = 0x80 | (ucs & 0x3F);
+		return 2;
+	} else if (ucs < 0x010000) { 
+		buf[0] = 0xE0 | (ucs >> 12);
+		buf[1] = 0x80 | ((ucs >> 6) & 0x3F);
+		buf[2] = 0x80 | (ucs & 0x3F);
+		return 3;
+	} else if (ucs < 0x00200000) {
+		buf[0] = 0xF0 | (ucs >> 18);
+		buf[1] = 0x80 | ((ucs >> 12) & 0x3F);
+		buf[2] = 0x80 | ((ucs >> 6) & 0x3F);
+		buf[3] = 0x80 | (ucs & 0x3F);
+		return 4;
+	} else if (ucs < 0x01000000) {
+		buf[0] = 0xF8 | (ucs >> 24);
+		buf[1] = 0x80 | ((ucs >> 18) & 0x3F);
+		buf[2] = 0x80 | ((ucs >> 12) & 0x3F);
+		buf[3] = 0x80 | ((ucs >> 6) & 0x3F);
+		buf[4] = 0x80 | (ucs & 0x3F);
+		return 5;
+	}
+	buf[0] = '?';
+	return -1;
+}
+
+/* 
+ * returns the byte length of the first UTF-8 char 
+ * (returns -1 if not valid) 
+ */
+int
+XUtf8CharByteLen(
+        const unsigned char     *buf,
+        int                     len)
+{
+	unsigned int ucs;
+	return XConvertUtf8ToUcs(buf, len, &ucs);
+}
+
+/*
+ * returns the quantity of Unicode chars in the UTF-8 string 
+ */
+int 
+XCountUtf8Char(
+	const unsigned char 	*buf, 
+	int 			len)
+{
+	int i = 0;
+	int nbc = 0;
+	while (i < len) {
+		int cl = XUtf8CharByteLen(buf + i, len - i);
+		if (cl < 1) cl = 1;
+		nbc++;
+		i += cl;
+	}
+	return nbc;
+}
+
+/* 
+ * Same as XConvertUtf8ToUcs but no sanity check is done.
+ */
+int
+XFastConvertUtf8ToUcs(
+        const unsigned char     *buf,
+        int                     len,
+        unsigned int          	*ucs)
+{
+      if (buf[0] & 0x80) {
+	if (buf[0] & 0x40) {
+	  if (buf[0] & 0x20) {
+	    if (buf[0] & 0x10) {
+	      if (buf[0] & 0x08) {
+		if (buf[0] & 0x04) {
+		  if (buf[0] & 0x02) {
+			/* bad UTF-8 string */
+		  } else {
+			/* 0x04000000 - 0x7FFFFFFF */
+		  }	
+		} else if (len > 4) {
+		  /* 0x00200000 - 0x03FFFFFF */
+                  *ucs =  ((buf[0] & ~0xF8) << 24) +
+                          ((buf[1] & ~0x80) << 18) +
+                          ((buf[2] & ~0x80) << 12) +
+                          ((buf[3] & ~0x80) << 6) +
+                           (buf[4] & ~0x80);
+		  return 5;
+		}
+              } else if (len > 3) {
+		/* 0x00010000 - 0x001FFFFF */
+                *ucs =  ((buf[0] & ~0xF0) << 18) +
+                        ((buf[1] & ~0x80) << 12) +
+                        ((buf[2] & ~0x80) << 6) +
+                         (buf[3] & ~0x80);
+	        return 4;
+              }
+	    } else if (len > 2) {
+	      /* 0x00000800 - 0x0000FFFF */
+              *ucs =  ((buf[0] & ~0xE0) << 12) +
+               	      ((buf[1] & ~0x80) << 6) +
+                       (buf[2] & ~0x80);
+              return 3;
+	    }	
+	  } else if (len > 1) {
+	    /* 0x00000080 - 0x000007FF */
+	    *ucs = ((buf[0] & ~0xC0) << 6) +
+		    (buf[1] & ~0x80);
+	    return 2;
+	  }
+	}
+      } else if (len > 0) {
+	/* 0x00000000 - 0x0000007F */
+	*ucs = buf[0];
+	return 1;
+      } 
+
+      *ucs = (unsigned int) '?'; /* bad utf-8 string */
+      return -1;
+}
+
+/*
+ * End of "$Id: $".
+ */
+

Deleted: branches/branch-1.3-utf8/src/xutf8/utf8Wrap.c

Copied: branches/branch-1.3-utf8/src/xutf8/utf8Wrap.c (from rev 6206, branches/branch-1.3-utf8/xutf8/utf8Wrap.c)
===================================================================
--- branches/branch-1.3-utf8/src/xutf8/utf8Wrap.c	                        (rev 0)
+++ branches/branch-1.3-utf8/src/xutf8/utf8Wrap.c	2008-09-10 19:19:56 UTC (rev 6207)
@@ -0,0 +1,932 @@
+/*
+ * "$Id:  $"
+ *
+ * X11 UTF-8 text drawing functions.
+ *
+ *      Copyright (c) 2000-2002 by O'ksi'D.
+ *                      All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *      Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *      Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ *      Neither the name of O'ksi'D nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *  Author: Jean-Marc Lienher ( http://oksid.ch )
+ */
+
+
+#include <FL/Xutf8.h>
+#include <X11/Xlib.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+/* External auto generated functions : */
+#include "ucs2fontmap.c"
+/* 
+ * extern int ucs2fontmap(char *s, unsigned int ucs, int enc);
+ * extern int encoding_number(const char *enc);
+ * extern const char *encoding_name(int num);
+ */
+
+/*********************************************************************/
+/** extract a list of font from the base font name list             **/
+/*********************************************************************/
+static int 
+get_font_list(
+	const char	*base_font_name_list, 
+	char 		***flist)
+{
+	const char *ptr;
+	const char *p;
+	int nb;
+	int nb_name;
+	
+	ptr = base_font_name_list;
+	p = NULL;
+	nb = 0;
+	nb_name = 1;
+
+	while (*ptr) {
+		if (*ptr == ',') nb_name++;
+		ptr++;
+	}
+
+	*flist = (char **) malloc(sizeof(char*) * nb_name);
+	ptr = base_font_name_list;
+
+	while (*ptr) {
+		int l = 0, i = 0;
+	
+		while(isspace(*ptr)) ptr++;
+		p = ptr;
+		while (*ptr && *ptr != ',') { ptr++; l++; }
+		if (l > 2) {
+			(*flist)[nb] = (char*) malloc((unsigned)l + 2);
+			while (p != ptr) { ((*flist)[nb])[i] = *p; i++; p++; }
+			(*flist)[nb][i] = '\0';
+			nb++;
+		}
+		if (*ptr) ptr++;
+	}
+	if (nb < 1) {
+		free(*flist);
+		*flist = (char**)NULL;
+	}
+	return nb;	
+}
+
+/*********************************************************************/
+/** get the font name used as encoding for "fontspecific" encoding  **/
+/** (mainly used for adobe-symbol and adobe-zapfdingbats)	    **/
+/*********************************************************************/
+static int 
+font_spec_enc(
+	char *font)
+{
+	int ret;
+	char *enc;
+	char *end;
+
+	enc = font;
+	while (*enc != '-') enc++; 
+	enc++;
+	while (*enc != '-') enc++;
+	enc++;
+	end = enc;
+	while (*end != '-') end++;
+	*end = '\0';
+	
+	ret = encoding_number(enc);
+	*end = '-';
+
+	return ret;
+}
+
+
+/*********************************************************************/
+/** get the sub range of a iso10646-1 font			    **/
+/*********************************************************************/
+static void
+get_range(
+	const char	*enc,
+	int 		*min,
+	int		*max)
+{
+	const char *ptr = enc;
+	const char *ptr1;
+
+	if (!enc) return;
+
+	while (*ptr && *ptr != '-') ptr++;
+	if (!*ptr) return;
+	while (*ptr && *ptr != '[') ptr++;
+	if (!*ptr) return;
+	*min = 0xFFFF;
+	*max = 0;
+	while (*ptr && *ptr != ']') {
+		int val;
+		ptr++;
+		ptr1 = ptr;
+		while (*ptr && *ptr != ']' && *ptr != ' ' && *ptr != '_') ptr++;
+		val = strtol(ptr1, NULL, 0);
+		if (val < *min) *min = val;
+		if (val > *max) *max = val;
+	}	
+}
+
+/*********************************************************************/
+/** get the internal encoding number of each fonts 		    **/
+/*********************************************************************/
+static int *
+get_encodings(
+	char	**font_name_list, 
+	int 	*ranges,
+	int 	nb_font)
+{
+	int *font_encoding_list;
+	int i;
+	i = 0;
+
+	font_encoding_list = (int *) malloc(sizeof(int) * nb_font);
+	while (i < nb_font) {
+		char *ptr;
+		int ec;
+		ptr = font_name_list[i];
+		ec = 0;
+		font_encoding_list[i] = -1;
+		ranges[i * 2] = 0;
+		ranges[i * 2 + 1] = 0xFFFF;
+		
+		if (ptr && strstr(ptr, "fontspecific")) {
+			font_encoding_list[i] = font_spec_enc(ptr);
+			ptr = NULL;
+		}
+		while (ptr && *ptr) {
+			if (*ptr == '-') {
+				ec++;
+				if (ec == 13) {
+					font_encoding_list[i] = 
+						encoding_number(ptr + 1);
+					if (font_encoding_list[i] == 0) {
+						get_range(ptr + 1, 
+							ranges + i * 2,
+							ranges + i * 2 + 1);
+					}
+					break;
+				}
+			}	
+			ptr++;
+		}
+		if (font_encoding_list[i] < 0) font_encoding_list[i] = 1;
+		i++;
+	}
+	return font_encoding_list;
+}
+
+/*********************************************************************/
+/** find the first font which matches the name and load it.	    **/
+/*********************************************************************/
+XFontStruct *
+find_best_font(
+	Display         *dpy,
+	char		**name)
+{
+	char **list;
+	int cnt;
+	XFontStruct *s;
+
+	list = XListFonts(dpy, *name, 1, &cnt);
+	if (cnt && list) {
+		free(*name);
+		*name = strdup(list[0]);
+		s = XLoadQueryFont(dpy, *name);
+		XFreeFontNames(list);
+		return s;
+	}
+	return NULL;
+}
+
+/*********************************************************************/
+/** load all fonts 						    **/
+/*********************************************************************/
+static void 
+load_fonts(
+	Display 		*dpy, 
+	XUtf8FontStruct	*font_set) 
+{
+	int i;
+	char **list;
+
+	i = 0;
+	list = NULL;
+
+	font_set->fonts = (XFontStruct**) 
+		malloc(sizeof(XFontStruct*) * font_set->nb_font);
+	
+	font_set->ranges = (int*) 
+		malloc(sizeof(int) *  font_set->nb_font * 2);
+
+	font_set->descent = 0;
+	font_set->ascent = 0;
+	font_set->fid = 0;
+
+	while (i < font_set->nb_font) {
+		XFontStruct *fnt;
+
+		fnt = font_set->fonts[i] = 
+			find_best_font(dpy, &(font_set->font_name_list[i]));
+		if (fnt) {
+			font_set->fid = fnt->fid;
+			if (fnt->ascent > font_set->ascent) {
+				font_set->ascent = fnt->ascent;
+			}
+			if (fnt->descent > font_set->descent) {
+				font_set->descent = fnt->descent;
+			}
+		} else {
+			free(font_set->font_name_list[i]);
+			font_set->font_name_list[i] = NULL;
+		}
+		i++;
+	}
+
+	font_set->encodings = 
+		get_encodings(font_set->font_name_list, 
+			font_set->ranges, font_set->nb_font);
+
+	/* unload fonts with same encoding */
+	for (i = 0; i < font_set->nb_font; i++) {
+		if (font_set->font_name_list[i]) {
+			int j;
+			for (j = 0; j < i; j++) {
+				if (font_set->font_name_list[j] &&
+					font_set->encodings[j] ==
+					font_set->encodings[i] &&
+					font_set->ranges[2*j] ==
+					font_set->ranges[2*i] &&
+					font_set->ranges[(2*j)+1] &&
+					font_set->ranges[(2*i)+1]) 
+				{
+	                       		XFreeFont(dpy, font_set->fonts[i]);
+                        		free(font_set->font_name_list[i]);
+					font_set->font_name_list[i] = NULL;
+					font_set->fonts[i] = 0;
+				}
+			}
+		}
+	} 
+}
+
+/*********************************************************************/
+/** Creates an array of XFontStruct acording to the comma separated  **/
+/** list of fonts. XLoad all fonts.				    **/
+/*********************************************************************/
+XUtf8FontStruct *
+XCreateUtf8FontStruct (
+    	Display        	*dpy,
+    	const char   	*base_font_name_list)
+{
+	XUtf8FontStruct *font_set;
+	
+	font_set = (XUtf8FontStruct*) 
+		malloc(sizeof(XUtf8FontStruct));
+
+ 	if (!font_set) {
+		return NULL;
+        }
+
+	font_set->nb_font = get_font_list(base_font_name_list, 
+					&font_set->font_name_list);
+
+	if (font_set->nb_font < 1) {
+		free(font_set);
+		return NULL;
+	}
+
+	load_fonts(dpy, font_set);
+
+	return font_set;	
+}
+
+
+/*****************************************************************************/
+/** draw a Right To Left UTF-8 string using multiple fonts as needed.	    **/
+/*****************************************************************************/
+void 
+XUtf8DrawRtlString(
+	Display 	*display, 
+	Drawable 	d,
+        XUtf8FontStruct 	*font_set, 
+	GC 		gc, 
+	int 		x, 
+	int 		y, 
+	const char	*string,
+        int 		num_bytes)
+{
+	int 		*encodings; /* encodings array */
+	XFontStruct 	**fonts; /* fonts array */
+	XChar2b 	buf[128]; /* drawing buffer */
+	XChar2b		*ptr;	/* pointer to the drawing buffer */
+	int 		fnum; /* index of the current font in the fonts array*/
+	int 		i; /* current byte in the XChar2b buffer */
+	int 		first; /* first valid font index */
+	int 		last_fnum; /* font index of the previous char */
+	int 		nb_font;  /* quantity of fonts in the font array */
+	char 		glyph[2]; /* byte1 and byte1 value of the UTF-8 char */
+	int		*ranges; /* sub range of iso10646 */
+
+	nb_font = font_set->nb_font;
+
+	if (nb_font < 1) {
+		/* there is no font in the font_set :-( */
+		return;
+	}
+	
+	ranges = font_set->ranges;
+	fonts = font_set->fonts;
+	encodings = font_set->encodings;
+	i = 0;
+	fnum = 0;
+	ptr = buf + 128;
+	
+	while(fnum < nb_font && !fonts[fnum]) fnum++;
+	if (fnum >= nb_font) {
+		/* there is no valid font for the X server */
+		return;
+	}
+
+	first = fnum;
+	last_fnum = fnum;
+
+	while (num_bytes > 0) {
+		int 		ulen; /* byte length of the UTF-8 char */
+		unsigned int 	ucs;  /* Unicode value of the UTF-8 char */
+		unsigned int	no_spc; /* Spacing char equivalent of a 
+					   non-spacing char */
+
+		if (i > 120) {
+			/*** draw the buffer **/
+			XSetFont(display, gc, fonts[fnum]->fid);
+			x -= XTextWidth16(fonts[fnum], ptr, i);
+			XDrawString16(display, d, gc, x, y, ptr, i);
+			i = 0;
+			ptr = buf + 128;
+		}
+
+		ulen = XFastConvertUtf8ToUcs((unsigned char*)string, 
+				num_bytes, &ucs); 
+
+		if (ulen < 1) ulen = 1; 
+
+		no_spc = XUtf8IsNonSpacing(ucs);
+		if (no_spc) ucs = no_spc; 
+
+		/* 
+		 * find the first encoding which can be used to 	
+		 * draw the glyph 				
+		 */
+		fnum = first;
+		while (fnum < nb_font) {
+			if (fonts[fnum] && 
+				ucs2fontmap(glyph, ucs, encodings[fnum]) >= 0) 
+			{
+				if (encodings[fnum] != 0 || 
+					(ucs >= ranges[fnum * 2] &&
+					ucs <= ranges[fnum * 2 + 1]))
+				{
+					break;
+				}
+			}
+			fnum++;
+		}
+		if (fnum == nb_font) {
+			/** the char is not valid in all encodings ->
+			  * draw it using the first font :-( **/
+			fnum = first;
+			ucs2fontmap(glyph, '?', encodings[fnum]);
+		}
+
+		if (last_fnum != fnum || no_spc) {
+			XSetFont(display, gc, fonts[last_fnum]->fid);
+			x -= XTextWidth16(fonts[last_fnum], ptr, i);
+			XDrawString16(display, d, gc, x, y, ptr, i);
+			i = 0;
+			ptr = buf + 127;
+			(*ptr).byte1 = glyph[0];
+			(*ptr).byte2 = glyph[1];
+			if (no_spc) {
+				x += XTextWidth16(fonts[fnum], ptr, 1);
+			}
+		} else {
+			ptr--;
+			(*ptr).byte1 = glyph[0];
+			(*ptr).byte2 = glyph[1];
+		}
+		last_fnum = fnum;
+		i++;
+		string += ulen;
+		num_bytes -= ulen;
+	}
+
+	if (i < 1) return;
+
+	XSetFont(display, gc, fonts[fnum]->fid);
+	x -= XTextWidth16(fonts[last_fnum], ptr, i);
+	XDrawString16(display, d, gc, x, y, ptr, i);
+}
+
+
+/*****************************************************************************/
+/** draw an UTF-8 string using multiple fonts as needed.		    **/
+/*****************************************************************************/
+void 
+XUtf8DrawString(
+	Display 	*display, 
+	Drawable 	d,
+        XUtf8FontStruct 	*font_set, 
+	GC 		gc, 
+	int 		x, 
+	int 		y, 
+	const char	*string,
+        int 		num_bytes)
+{
+	int 		*encodings; /* encodings array */
+	XFontStruct 	**fonts; /* fonts array */
+	XChar2b 	buf[128]; /* drawing buffer */
+	int 		fnum; /* index of the current font in the fonts array*/
+	int 		i; /* current byte in the XChar2b buffer */
+	int 		first; /* first valid font index */
+	int 		last_fnum; /* font index of the previous char */
+	int 		nb_font;  /* quantity of fonts in the font array */
+	char 		glyph[2]; /* byte1 and byte1 value of the UTF-8 char */
+	int		*ranges; /* sub range of iso10646 */
+
+	nb_font = font_set->nb_font;
+
+	if (nb_font < 1) {
+		/* there is no font in the font_set :-( */
+		return;
+	}
+	ranges = font_set->ranges;
+	fonts = font_set->fonts;
+	encodings = font_set->encodings;
+	i = 0;
+	fnum = 0;
+	
+	while(fnum < nb_font && !fonts[fnum]) fnum++;
+	if (fnum >= nb_font) {
+		/* there is no valid font for the X server */
+		return;
+	}
+
+	first = fnum;
+	last_fnum = fnum;
+
+	while (num_bytes > 0) {
+		int 		ulen; /* byte length of the UTF-8 char */
+		unsigned int 	ucs;  /* Unicode value of the UTF-8 char */
+		unsigned int	no_spc; /* Spacing char equivalent of a 
+					   non-spacing char */
+
+		if (i > 120) {
+			/*** draw the buffer **/
+			XSetFont(display, gc, fonts[fnum]->fid);
+			XDrawString16(display, d, gc, x, y, buf, i);
+			x += XTextWidth16(fonts[fnum], buf, i);
+			i = 0;
+		}
+
+		ulen = XFastConvertUtf8ToUcs((unsigned char*)string, 
+				num_bytes, &ucs); 
+
+		if (ulen < 1) ulen = 1; 
+
+		no_spc = XUtf8IsNonSpacing(ucs);
+		if (no_spc) ucs = no_spc; 
+
+		/* 
+		 * find the first encoding which can be used to 	
+		 * draw the glyph 				
+		 */
+		fnum = first;
+		while (fnum < nb_font) {
+			if (fonts[fnum] && 
+				ucs2fontmap(glyph, ucs, encodings[fnum]) >= 0) 
+			{
+				if (encodings[fnum] != 0 || 
+					(ucs >= ranges[fnum * 2] &&
+					ucs <= ranges[fnum * 2 + 1]))
+				{
+					break;
+				}
+			}
+			fnum++;
+		}
+		if (fnum == nb_font) {
+			/** the char is not valid in all encodings ->
+			  * draw it using the first font :-( **/
+			fnum = first;
+			ucs2fontmap(glyph, '?', encodings[fnum]);
+		}
+
+		if (last_fnum != fnum || no_spc) {
+			XSetFont(display, gc, fonts[last_fnum]->fid);
+			XDrawString16(display, d, gc, x, y, buf, i);
+			x += XTextWidth16(fonts[last_fnum], buf, i);
+			i = 0;
+			(*buf).byte1 = glyph[0];
+			(*buf).byte2 = glyph[1];
+			if (no_spc) {
+				x -= XTextWidth16(fonts[fnum], buf, 1);
+			}
+		} else {
+			(*(buf + i)).byte1 = glyph[0];
+			(*(buf + i)).byte2 = glyph[1];
+		}
+		last_fnum = fnum;
+		i++;
+		string += ulen;
+		num_bytes -= ulen;
+	}
+
+	XSetFont(display, gc, fonts[fnum]->fid);
+	XDrawString16(display, d, gc, x, y, buf, i);
+}
+
+
+
+/*****************************************************************************/
+/** returns the pixel width of a UTF-8 string				    **/
+/*****************************************************************************/
+int  
+XUtf8TextWidth(
+        XUtf8FontStruct 	*font_set, 
+	const char 	*string,
+        int 		num_bytes)
+{
+	int		x;
+	int 		*encodings; /* encodings array */
+	XFontStruct 	**fonts; /* fonts array */
+	XChar2b 	buf[128]; /* drawing buffer */
+	int 		fnum; /* index of the current font in the fonts array*/
+	int 		i; /* current byte in the XChar2b buffer */
+	int 		first; /* first valid font index */
+	int 		last_fnum; /* font index of the previous char */
+	int 		nb_font;  /* quantity of fonts in the font array */
+	char 		glyph[2]; /* byte1 and byte1 value of the UTF-8 char */
+	int		*ranges; /* sub range of iso10646 */
+
+	nb_font = font_set->nb_font;
+	x = 0;
+
+	if (nb_font < 1) {
+		/* there is no font in the font_set :-( */
+		return x;
+	}
+
+	ranges = font_set->ranges;
+	fonts = font_set->fonts;
+	encodings = font_set->encodings;
+	i = 0;
+	fnum = 0;
+	
+	while(fnum < nb_font && !fonts[fnum]) fnum++;
+	if (fnum >= nb_font) {
+		/* there is no valid font for the X server */
+		return x;
+	}
+
+	first = fnum;
+	last_fnum = fnum;
+
+	while (num_bytes > 0) {
+		int 		ulen; /* byte length of the UTF-8 char */
+		unsigned int 	ucs;  /* Unicode value of the UTF-8 char */
+		unsigned int	no_spc; /* Spacing char equivalent of a 
+					   non-spacing char */
+
+		if (i > 120) {
+			/*** measure the buffer **/
+			x += XTextWidth16(fonts[fnum], buf, i);
+			i = 0;
+		}
+
+		ulen = XFastConvertUtf8ToUcs((unsigned char*)string, 
+				num_bytes, &ucs); 
+
+		if (ulen < 1) ulen = 1; 
+
+		no_spc = XUtf8IsNonSpacing(ucs);
+		if (no_spc) {
+			ucs = no_spc;
+		}
+
+		/* 
+		 * find the first encoding which can be used to 	
+		 * draw the glyph 				
+		 */
+		fnum = first;
+		while (fnum < nb_font) {
+			if (fonts[fnum] && 
+				ucs2fontmap(glyph, ucs, encodings[fnum]) >= 0) 
+			{
+				if (encodings[fnum] != 0 || 
+					(ucs >= ranges[fnum * 2] &&
+					ucs <= ranges[fnum * 2 + 1]))
+				{
+					break;
+				}
+			}
+			fnum++;
+		}
+		if (fnum == nb_font) {
+			/** the char is not valid in all encodings ->
+			  * draw it using the first font :-( **/
+			fnum = first;
+			ucs2fontmap(glyph, '?', encodings[fnum]);
+		}
+
+		if (last_fnum != fnum || no_spc) {
+			x += XTextWidth16(fonts[last_fnum], buf, i);
+			i = 0;
+			(*buf).byte1 = glyph[0];
+			(*buf).byte2 = glyph[1];
+			if (no_spc) {
+				/* go back to draw the non-spacing char over
+				 *  the previous char */
+				x -= XTextWidth16(fonts[fnum], buf, 1);
+			}
+		} else {
+			(*(buf + i)).byte1 = glyph[0];
+			(*(buf + i)).byte2 = glyph[1];
+		}
+		last_fnum = fnum;
+		i++;
+		string += ulen;
+		num_bytes -= ulen;
+	}
+
+	x += XTextWidth16(fonts[last_fnum], buf, i);
+
+	return x;
+}
+
+/*****************************************************************************/
+/**  get the X font and glyph ID of a UCS char                              **/
+/*****************************************************************************/
+int
+XGetUtf8FontAndGlyph(
+        XUtf8FontStruct  *font_set,
+        unsigned int            ucs,
+	XFontStruct 	**fnt,
+	unsigned short	*id)
+{
+        int             x;
+        int             *encodings; /* encodings array */
+        XFontStruct     **fonts; /* fonts array */
+        int             fnum; /* index of the current font in the fonts array*/
+        int             i; /* current byte in the XChar2b buffer */
+        int             first; /* first valid font index */
+        int             last_fnum; /* font index of the previous char */
+        int             nb_font;  /* quantity of fonts in the font array */
+	char 		glyph[2]; /* byte1 and byte1 value of the UTF-8 char */
+        int             *ranges; /* sub range of iso10646 */
+
+        nb_font = font_set->nb_font;
+        x = 0;
+
+        if (nb_font < 1) {
+                /* there is no font in the font_set :-( */
+                return -1;
+        }
+
+        ranges = font_set->ranges;
+        fonts = font_set->fonts;
+        encodings = font_set->encodings;
+        i = 0;
+        fnum = 0;
+
+        while(fnum < nb_font && !fonts[fnum]) fnum++;
+        if (fnum >= nb_font) {
+                /* there is no valid font for the X server */
+                return -1;
+        }
+
+        first = fnum;
+        last_fnum = fnum;
+
+        /* 
+         * find the first encoding which can be used to         
+         * draw the glyph                               
+         */
+        fnum = first;
+        while (fnum < nb_font) {
+                if (fonts[fnum] &&
+                        ucs2fontmap(glyph, ucs, encodings[fnum]) >= 0)
+                {
+                        if (encodings[fnum] != 0 || (ucs >= ranges[fnum * 2] &&
+                                ucs <= ranges[fnum * 2 + 1]))
+                        {
+                                break;
+                        }
+                }
+                fnum++;
+        }
+        if (fnum == nb_font) {
+                /** the char is not valid in all encodings ->
+                  * draw it using the first font :-( **/
+                fnum = first;
+                ucs2fontmap(glyph, '?', encodings[fnum]);
+        }
+
+        *id = ((unsigned char)glyph[0] << 8) | (unsigned char)glyph[1] ;
+	*fnt = fonts[fnum];
+        return 0;
+}
+
+/*****************************************************************************/
+/** returns the pixel width of a UCS char				    **/
+/*****************************************************************************/
+int
+XUtf8UcsWidth(
+        XUtf8FontStruct  *font_set,
+        unsigned int            ucs)
+{
+	int		x;
+	int 		*encodings; /* encodings array */
+	XFontStruct 	**fonts; /* fonts array */
+	XChar2b 	buf[8]; /* drawing buffer */
+	int 		fnum; /* index of the current font in the fonts array*/
+	int 		i; /* current byte in the XChar2b buffer */
+	int 		first; /* first valid font index */
+	int 		last_fnum; /* font index of the previous char */
+	int 		nb_font;  /* quantity of fonts in the font array */
+	char 		glyph[2]; /* byte1 and byte1 value of the UTF-8 char */
+	int		*ranges; /* sub range of iso10646 */
+
+	nb_font = font_set->nb_font;
+	x = 0;
+
+	if (nb_font < 1) {
+		/* there is no font in the font_set :-( */
+		return x;
+	}
+
+	ranges = font_set->ranges;
+	fonts = font_set->fonts;
+	encodings = font_set->encodings;
+	i = 0;
+	fnum = 0;
+	
+	while(fnum < nb_font && !fonts[fnum]) fnum++;
+	if (fnum >= nb_font) {
+		/* there is no valid font for the X server */
+		return x;
+	}
+
+	first = fnum;
+	last_fnum = fnum;
+
+
+	ucs = XUtf8IsNonSpacing(ucs);
+
+	/* 
+	 * find the first encoding which can be used to 	
+	 * draw the glyph 				
+	 */
+	fnum = first;
+	while (fnum < nb_font) {
+		if (fonts[fnum] && 
+			ucs2fontmap(glyph, ucs, encodings[fnum]) >= 0) 
+		{
+			if (encodings[fnum] != 0 || (ucs >= ranges[fnum * 2] &&
+				ucs <= ranges[fnum * 2 + 1]))
+			{
+				break;
+			}
+		}
+		fnum++;
+	}
+	if (fnum == nb_font) {
+		/** the char is not valid in all encodings ->
+		  * draw it using the first font :-( **/
+		fnum = first;
+		ucs2fontmap(glyph, '?', encodings[fnum]);
+	}
+
+	(*buf).byte1 = glyph[0];
+	(*buf).byte2 = glyph[1];
+
+	x += XTextWidth16(fonts[fnum], buf, 1);
+
+	return x;
+}
+
+/*****************************************************************************/
+/** draw an UTF-8 string and clear the background.	 		    **/
+/*****************************************************************************/
+void
+XUtf8DrawImageString(
+        Display         *display,
+        Drawable        d,
+        XUtf8FontStruct         *font_set,
+        GC              gc,
+        int             x,
+        int             y,
+        const char      *string,
+        int             num_bytes)
+{
+	/* FIXME: must be improved ! */
+	int w;
+	int fill_style;
+	unsigned long foreground;
+	unsigned long background;
+	int function;
+	XGCValues xgcv;
+
+	w = XUtf8TextWidth(font_set, string, num_bytes);
+	
+	XGetGCValues(display, gc, 
+		GCFunction|GCForeground|GCBackground|GCFillStyle, &xgcv);
+	
+	function = xgcv.function;
+	fill_style = xgcv.fill_style;
+	foreground = xgcv.foreground;
+	background = xgcv.background;
+
+	xgcv.function = GXcopy;
+	xgcv.foreground = background;
+	xgcv.background = foreground;
+	xgcv.fill_style = FillSolid;
+
+	XChangeGC(display, gc,
+		GCFunction|GCForeground|GCBackground|GCFillStyle, &xgcv);
+
+	XFillRectangle(display, d, gc, x, y - font_set->ascent, 
+		(unsigned)w, (unsigned)(font_set->ascent + font_set->descent));
+
+	xgcv.function = function;
+	xgcv.foreground = foreground;
+	xgcv.background = background;
+	xgcv.fill_style = fill_style;
+
+	XChangeGC(display, gc,
+		GCFunction|GCForeground|GCBackground|GCFillStyle, &xgcv);
+
+	XUtf8DrawString(display, d, font_set, gc, x, y, string, num_bytes);
+}
+
+/*****************************************************************************/
+/** free the XFontSet and others things created by XCreateUtf8FontSet       **/
+/*****************************************************************************/
+void 
+XFreeUtf8FontStruct(
+	Display 	*dpy, 
+	XUtf8FontStruct *font_set)
+{
+	int i;
+	i = 0;
+	while (i < font_set->nb_font) {
+		if (font_set->fonts[i]) {
+			XFreeFont(dpy, font_set->fonts[i]);
+			free(font_set->font_name_list[i]);
+		}
+		i++;
+	}
+	free(font_set->ranges);
+	free(font_set->font_name_list);
+	free(font_set->fonts);
+	free(font_set->encodings);
+	free(font_set);
+}
+
+/*
+ *  End of "$Id: $".
+ */
+

Copied: branches/branch-1.3-utf8/src/xutf8/utils (from rev 6206, branches/branch-1.3-utf8/xutf8/utils)

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.