Re: need to use other character sets




Ove Kaaven <ovek@arcticnet.no> writes:

> OK, I'm working on the wxWindows C++ GUI toolkit, and I'm in the process
> of adding Unicode support to it, since an application I'm making needs to
> deal with special native characters not in iso-8859-1 (to be precise, I'm 
> mostly messing with the not-widely-available iso-8859-16).
> 
> And I need to have it working ASAP (a few weeks).

Getting wxWindows/GTK+ to work with all of unicode under X 
in a few weeks is just completely unrealistic. I'm hoping
to have GTK+ working on a sizeable subset of unicode
by the end of the summer. ;-)

However, getting wxWindows/GTK+ to work for the iso-8859-16
subset of Unicode is more reasonable.

The first thing you need to do is to get a functioning 
iso-8859-16 locale working on your system, both for libc
and for X. There isn't much documentation on this, but
you should be able to work from similar examples.

(Somebody may well have done this ... I'd ask around)

You'll also need to have a iso-8859-16 font installed 
on your computer.

> OK, now I've heard that GTK+ 1.2 does not support Unicode.
> (I don't quite *understand* why I can't just to wcstombs() it or something
> like that and have gtk convert it back to Unicode and get an Unicode font
> from my font server, but anyway...)
> 
> But I was told that I could use a fontset (and set LANG env var to the
> right character set)
> ...well, ok, um, how do I set a fontset anyway?

Once you have the C library and X set up to handle iso-8859-16
at least minimally, the next step is to get it working
with GTK+.

This should be pretty trivial. I don't know what the appropriate
language code for iso-8859-16 is, but say it is "sm"
(iso-8859-16, for those who don't have these things memorized
covers the Sami language). All you need to do is create
a file:

 ~/.gtkrc.sm

that includes something like:

style "default-sami" {
       fontset = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,\
                  -my-font-.....-iso8859-16"

class "GtkWidget" style "default-sami"

Then set your environment variable "LANG" to "sm". (or "sm_NO")

Finally, you need to handle the conversion from Unicode to
iso-8859-16. This should, at this point, be pretty easy.
Your routine would basically just take the input string
and convert any codes in iso-8859-16 to that 8-bit mapping,
and ignore the remainder (or convert them to some default
character)

> (And by the way, what characters codes do I subsequently give to xmodmap
> to map my keyboard to use the special native characters? Do I fake
> iso-8859-1 for that, or...?)

There are various ways to do it, but the cleanest thing
to do is to modifiy the X11 compose settings to generate
the appropriate characters. For instance, the standard
compose settings can be (on my system) found in 
/usr/lib/X11/locale/iso8859-1/Compose, and includes lines
like: 

 <dead_cedilla> <C>                      : "\307"        Ccedilla

So you could create an equivalent file for iso-8859-16 and
then put it in 

 /usr/lib/X11/locale/compose.dir

Good luck, and let us know if you have more questions.

                                        Owen



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