[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Arphic font, Unicode, fontset and various



On Fri, Dec 07, 2001 at 08:45:06PM +0800, hashao@chinese.com wrote:
> On Mon, Dec 03, 2001 at 07:56:19PM -0500, try_email_me@yahoo.ca wrote:
> > 	Don't know if it is a FAQ.  But just can't get any comprehensive
> > answer to my question.  I just bought unifont Y2K from Arphic (some
> > unicode, some big and some gb fonts.  Now I want to change everything to
> > Unicode.  What do I need to change.  Right now I have
> > LC_CTYPE=zh_TW.big5 and using xtt module (X4.1) and using gnome.
> 
> Nothing, you just need a unicode input :). Anyone really need
> a unicode input method? like utf-8? xcin and chinput does not
> support utf-8 yet.
> 

After spend a whole day on chinput,
I just realize you can use chinput to input UTF-8. No
change required. Damn! waste my time.

\Question{

How to input UTF-8 with Chinput and Xcin?

 }
\contributor{ha shao}{hashao@chinese.com}{2001/12/09} 

Just set your LC_CTYPE to UTF-8 and Chinput will handle
the rest. :) It let the X to do the conversion (hints:
COMPOUND_TEXT).

LC_CTYPE=zh_CN.UTF-8
or
LC_CTYPE=zh_TW.UTF-8

Test with gedit, set gedit's font to:
-default-song-medium-r-normal-*-*-160-*-*-p-*-gb2312.1980-0,-*-ja-18-*-iso10646-1,-*-*

And now you can input your UTF-8.

XCIN too!
With the attached patch, xcin will do the same thing. Cool, huh?

-- 
Best regard
hashao
diff -ur xcin-2.5.2.99.pre2.orig/src/xim.c xcin-2.5.2.99.pre2/src/xim.c
--- xcin-2.5.2.99.pre2.orig/src/xim.c	Tue Nov 27 23:42:03 2001
+++ xcin-2.5.2.99.pre2/src/xim.c	Sun Dec  9 19:52:09 2001
@@ -1033,11 +1033,26 @@
     XIMEncodings encodings;
     Window mainwin;
     locale_t *locale;
+    char* imlocale;
     int i;
 
     transport_type = TRANSPORT_X;
     xccore = core;
     locale = &(xccore->xcin_rc.locale);
+    
+    {
+	char *pdot;
+	int plen;
+	int llen;
+	pdot = strchr(locale->lc_ctype, '.');
+	plen = pdot - locale->lc_ctype;
+	llen = strlen(locale->lc_ctype);
+	imlocale = (char*)xcin_malloc(sizeof(char)*(plen+llen+1), 1);
+	sprintf(imlocale, "%s,", locale->lc_ctype);
+	strncat(imlocale, locale->lc_ctype, plen);
+    }
+	    
+
 /*
     if (transport_type == TRANSPORT_LOCAL) {
         char hostname[64];
@@ -1075,7 +1090,7 @@
                    IMServerWindow,    mainwin,
                    IMModifiers,       "Xi18n",
                    IMServerName,      xim_name,
-                   IMLocale,          locale->lc_ctype,
+                   IMLocale,          imlocale,
                    IMServerTransport, transport,
                    IMInputStyles,     &(xccore->input_styles),
                    IMEncodingList,    &encodings,
@@ -1083,6 +1098,7 @@
                    IMFilterEventMask, KeyPressMask,
                    IMOnKeysList,      &on_keys,
                    NULL);
+    free(imlocale);
     if (ims == 0)
 	perr(XCINMSG_ERROR,
 		N_("IMOpenIM() with name \"%s\" transport \"%s\" failed.\n"),

Reply to: