Ah, it's a mistake I make all the time.  When I said "en" it should
have been "us".  The setxkbmap command is actually:

setxkbmap -rules xfree86 -model pc104 -layout us,ar

possibly with -option grp:menu_toggle if that's what you want.  This
is why you were getting "Error loading keyboard description": there is
no "en" layout.  Anyway, try this out.  If it still doesn't work, let
me know.  Note that most likely, you do not want to be typing these
things in a terminal... something like a GtkEntry, however, will
certainly produce proper text.

The other thing to do, of course, is tell GTK that you want to use a
font that supports Arabic.  You do something like this:

{
  PangoFontDescription *font;
  GtkEntry *entry;
  font = pango_font_description_from_string("Code2000");
  entry = gtk_entry_new();
  gtk_widget_modify_font(entry, font);
}

Just a note, I've noticed that other Unicode X fonts (such as, for
example, whatever GTK uses by default) seem to support Arabic as well;
you may want to try them also.  This might just be me, since I've
install a hajillion extra fonts on my system....

Anyway, the above bits *should* do it for you.  To summarize, use
setxkbmap (I can't speak for any KDE-controlpanel-setting-thingy) to
make sure your keyboard does what you want, and use
PangoFontDescription to make sure you have are using a font that can
handle.

Salaam,
  Adam.

On 6/8/05, Gaurav Jain <[EMAIL PROTECTED]> wrote:
> Hello Alem,
> 
> Thanks for the detailed response.  I installed the CODE2000 unicode
> font that you mentioned according to the rules given at
> http://eyegene.ophthy.med.umich.edu/unicode/index.html#kdefontinst.
>  ( using the mkfontscale and mkfontdir commands, and then adding the
> path to /etc/X11/XF86Config).
> 
> I then tried to exeute the setxkbmap command that you mentioned, but
> it failed with the error: "Error loading new keyboard description".
> 
> I'm using KDE session, so I also tried setting the Keyboard Layout
> from the "Control Center > Regional & Accessibility > Keyboard Layout"
> to Arabic.  However, if I do that, whatever I type on the terminal is
> not shown on the screen (it looks like an empty space), and it doesn't
> even show the square blocks that you mentioned.
> 
> Have I missed some step here?
> Thanks again,
> Gaurav
> 
> On 6/9/05, Alem Dain <[EMAIL PROTECTED]> wrote:
> > Hmmm, with almost no work at all, I managed to type right-to-left in
> > Arabic (not that I know a word of it...)
> >
> > For the purpose of input, no locale information is necessary.  All you
> > need is the appropriate keyboard mapping loaded in X, as well an an
> > Arabic-capable unicode font; Pango knows how to render right-to-left
> > text.
> >
> > More interesting than the version of Linux you are running are the
> > versions of GTK and Pango.  As for the keyboard map, I'm not familiar
> > with the inner workings of xmodmap; I recommend XKB.  You use this
> > program to dynamically change the keyboard mapping as though you had
> > edited XF86Config.
> >
> > So what I did was functionally equivalent to:
> >
> > setxkbmap -rules xfree86 -model pc104 -layout en,ar -option grp:menu_toggle
> >
> > Just a quick explanation may be required here.  Most likely you will
> > leave the "rules" and "model" option alone; if you have something
> > other than a standard keyboard (with the extra Windows keys) you will
> > want to change that.  Unfortunately, I'm not sure where you find a
> > list of other models.  Anyway, the important ones is "layout".  It
> > specifies that the first one should be english (basic), and the
> > second, arabic (basic).  You can have up to for.  I like to use the
> > Menu key to toggle, hence the "-option grp:menu_toggle" bit.
> >
> > What I in fact did was ran a little GTK program I've written that does
> > all these things for me, as well as displaying the current keyboard
> > layout... whee :)  Source code can be provided, fixed bugs would be
> > most appreciated :)
> >
> > ....
> >
> > Now, you also need an Arabic capable Unicode font.  If you are typing
> > characters appropriately, but lack the font, you'll see little squares
> > with four digits in them, representing the otherwise unrepresentable
> > unicode character.  What Unicode font supports Arabic?  I use James
> > Kass's Code2000 (just google for it).  It's free, and it also supports
> > Tengwar (again, whee).  I'm sure there are thousands of other fonts
> > that have Arabic, tho.  In fact, in might come with ... whatever X
> > comes with.
> >
> > Hope this helps,
> > Adam.
> >
> > On 6/8/05, Gaurav Jain <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > >
> > > I need to enter Right-To-Left language characters (such as Arabic and
> > > Hebrew) in a GtkEntry widget.  I'm using Red Hat Linux 9.0 and have
> > > logged in the Arabic language session.  I then set the locale to
> > > "ar_SA.utf8".  Then I run my small GTK program which has a GtkEntry
> > > widget.
> > >
> > > But I'm stuck at this point where I need an input method to enter the
> > > arabic characters.  Could somebody help?
> > >
> > > (I tried using xmodmap to load an arabic keyboard mapping, but then
> > > nothing happened.  I also need to know where I can get arabic fonts
> > > from, if required).
> > >
> > > Thanks,
> > > Gaurav
> > > _______________________________________________
> > > gtk-app-devel-list mailing list
> > > gtk-app-devel-list@gnome.org
> > > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> > >
> >
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to