Re: Character translation in GtkText
- From: Owen Taylor <otaylor redhat com>
- To: Michael Vance <briareos lokigames com>
- Cc: Gtk-List <gtk-list redhat com>
- Subject: Re: Character translation in GtkText
- Date: 06 Jul 1999 16:47:38 -0400
Michael Vance <briareos@lokigames.com> writes:
> Hello,
>
> I need to display international characters such as diaresis (umlaut) u in a
> GtkText widget. However, GtkText seems to translate these characters as a
> function of internationalization. I'm wondering how to turn off this
> internationalization so that these characters are displayed properly.
>
> Any help is appreciated.
If I understand correctly, what you are referring to is that
strings are typically interpreted in GTK+ according to
locale. So, if you have some high ascii characters, they
might be interpreted as latin-1, but (depending on the
user's locale) could also be intepreted as Japanese or
latin-2.
This interpretation of high ascii characters according to
the locale only happens if the font being used is a
_fontset_ instead of a simple font. (A fontset is a list of
fonts for different encodings) Simple 8-bit fontsjust
indexed directly by the 8-bit values in the string.
So, to get the effect you want, you have to make sure that
the font you are using in the Text widget is just a
font, not a fontset.
The easy way to do this is to load up the font you want
by hand:
font = gdk_font_load ("-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso8859-1");
And then specify this font explicitely when inserting
into the Text widget.
gtk_text_insert (GTK_TEXT (widget), font, NULL, NULL, string, length);
Regards,
Owen
P.S. - for some background on fontsets, locales, etc, you
can see:
http://developer.gnome.org/doc/whitepapers/gtki18n/index.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]