Re: multi-lingual support under Unix


Subject: Re: multi-lingual support under Unix
From: Vlad Harchev (hvv@hippo.ru)
Date: Wed Jan 03 2001 - 10:41:39 CST


On Sun, 31 Dec 2000, Tomas Frydrych wrote:

>
> > > What we will need is some kind of keyboard switching mechanism
> > > that would allow to translate keyboard input into appropriate
> > > unicode values based on a language/keyboard the user chooses.
> > > Whether this should be done using calls to the system/Xserver, or
> > > whether we should build it all into AbiWord I am not entirely sure,
> > > but even building from scratch should not be too complicated (I will
> > > look into this).
> >
> > User has just to configure X server properly - no special means from AW
> > needed.
> >
> Can I pick your brains on this? What I need is to be able to
> transparently switch the keyboard from say English to Russian in a
> middle of the sentence, type couple of words, and then switch
> back to English; I have not got a clue how I can accomplish this
> under X.

 xmodmap could be used for this (but this is ideologically incorrect way of
doing things, so I didn't study it) or you have to configure X keyboard
extension (XKB) in your X server and setting appropriate locale (setting $LANG
to value you need).

 For russian:
X server configuration, XFree86-3.x, in Section "Keyboard":
Uncomment string like "# XkbDisable",
Add the following lines in the same session,
---------
    XkbModel "pc104"
    XkbLayout "ru"
    XkbOptions "grp:ctrl_shift_toggle"
---------

 And set $LANG to "ru_RU.KOI8-R". After that your should be able to switch
between russian and english layout by pressing "Left Ctrl"-"Left Shift".

 After that starting "xev" in xterm and pressing button with 'q' on it when in
russian layout should produce something like the following in that xterm
window:

KeyPress event, serial 23, synthetic NO, window 0x3800001,
    root 0x25, subw 0x3800002, time 3581803673, (58,33), root:(607,53),
    state 0x2000, keycode 24 (keysym 0x6ca, Cyrillic_shorti), same_screen YES,
    XLookupString gives 0 characters: ""

The key phrase is "Cyrillic_shorti" - it should be present. This means that
KeySym with value "Cyrillic_shorti" is received from X server. XLib then uses
XLookupString or other function to translate that symbol code to the character
(or string) of the current locale - so locale should be properly set (by
setting $LANG) for this conversion to succeed (otherwise most toolkits will
ignore that symbol) (I don't know why 'XLookupString gives 0 characters: ""'
is in the 'xev' dump - I can type russian in any app of any reasonable
toolkit).

 I recommend you to use some GUI configuration tool of some user-friendly
linux distro (or some interactive program) to configure your X server and
locale (to figure correct value for $LANG) for a layout you want. As for
interactive programs, check xf86config (text-mode, series of questions),
XF86Setup and Xconfigurator (but make sure you back up your current config
file).

> > Printing TTF fonts is not a problem under Unix at all. If ghostscript is
> > used, than AW can include a TTF font in the .ps being generated (Postscript
> > standard describes all details), or even don't include font body if that font
> > is registered in Ghostscript Fontmap (that's more preferred apporach). The
> > later is how CJK text is printed under unix on non-gnome build.
> >
> > So, there are no printing-specific and font-specific problems at all
> > (including printing of TTFs). All of them can be solved in a couple of days.
> >
> I am not sure we mean the same thing when we speak of TTF
> fonts; I have in mind ttf fonts that live in on the Windows side of my
> computer and are used by my Windows applications. So far, I have
> not been able to find any Linux wordprocessor that could actually
> print documents using these; if we could AW able to do this, it
> would be really great.

 Are you trying to say that you don't know how to make your X server
displaying TTF fonts (this is the way I understand you) or what? Once you made
your X server displaying TTF fonts, you can use them in AW (just add a path to
them to your fontpath in .AbiWord configuration file). To make your X server
displayng ttf fonts, see Font Howto (you have to use xfstt - special font
server that supports TTF fonts).

 As for printing, TTF fonts are used for printing CJK by AW on unix. You have
to have TTF fonts registered in Fontmap of your Ghostscript
(/usr/share/ghostscript/VERSION/Fontmap) and apply patches and compile GS
yourself to support ttf. Then you'll be able to print TTF fonts (but your
first should make them displayable in AW of course).

> with regards
>
> Tomas
>

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Wed Jan 03 2001 - 11:25:46 CST