Re: Displaying 2-byte chars in a GtkEntry
- From: Owen Taylor <otaylor gtk org>
- To: "Damon Chaplin" <DAChaplin email msn com>
- Cc: "GTK List" <gtk-list redhat com>
- Subject: Re: Displaying 2-byte chars in a GtkEntry
- Date: 08 Jun 1998 11:17:52 -0400
"Damon Chaplin" <DAChaplin@email.msn.com> writes:
> I asked this a while back but noone replied. It might be useful for
> the GtkFontSelection widget.
>
>
> Is there a way to display characters from Chinese/Japanese/Korean etc.
> fonts in a GtkEntry?
>
> The XFontStruct has these fields to specify the character values. Can
> I use them somehow? And how can I tell which chars actually exist?
>
> unsigned min_char_or_byte2;/* first character */
> unsigned max_char_or_byte2;/* last character */
> unsigned min_byte1; /* first row that exists */
> unsigned max_byte1; /* last row that exists */
If your LANG environment variable is set appropriately, if you've
called gtk_set_locale() before gtk_init(), if you are using an
appropriate fontset, and (if your C library doesn't have CJK support
built in) if you've configured GTK as:
./configure --with-locale=ja_JP
(The actual locale doesn't really matter for this - it is used by GTK
in a test to see whether it should use X's locale support or not,
but the runtime setting value of LANG is used to determine
the actual language used)
Then, you can just use the locale-dependent encoding to display
the strings.
I don't suppose the above answer makes much sense unless you've
actually tried to set up CJK on your system...
The general picture is that GtkEntry works well with CJK text
for real uses, but is not meant for the casual display of a
few characters on a westerner's screen.
If you want non-editable text, then you can draw random characters
fairly easily - for a 16 bit font, the guchar * passed into
gdk_draw_string is interpreted as a gushort * and GDK calls
XDrawString16.
The information in the XFontStruct is not exported into GDK,
though you can get at it with GDK_FONT_XFONT() from gdkx.h
(Which returns the XFontStruct * cast to gpointer) - this
seems most useful if you wanted to do something like have a
button to pop up a xfd equivalent.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]