[Top][All Lists]

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

Re: Language Setup Document (Re: Text drawing bug - gaps after 16th char

From: Kazunobu Kuriyama
Subject: Re: Language Setup Document (Re: Text drawing bug - gaps after 16th character ...)
Date: Fri, 04 Jul 2003 18:56:46 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.0.0) Gecko/20020614

Yen-Ju Chen wrote:

I attach a quick patch for LanguageSetup.gsdoc in response to your suggestion. Since I'm not familiar with gsdoc tag, some tags may need to be corrected.

Thank you for your reply.  Actually there was something wrong with the tags.
autogsdoc complained of it.  I prefer a plain text file to a broken gsdoc.

2. Put the document in Documentation/User instead of Documentation/Developer so that the user can find it naturally. I think the contents itself is irrelevant to development.
  Also, you can't expect all the users identify themselves as developer.

 This is not under my control. :)

Are you suggesting a kind of rejection? Is there someone who is in charge of it other
than the author?

5. Delete the explanation for XIM. If an input method in use doesn't work, it's a bug of the input method, not that of GNUstep. The user never fix it by tweaking

 There are two possibility that XIM doesn't work.
 One is that XIM is broken. Another is that
 GNUstep doesn't know the encoding of XIM.
 In the later case, whatever you type will be appended with
 the encoding string by the Xwindow.
That's the way how XIM server and client know the encoding of each other.
 I add some more text to make it clear.

Is this really XIM's responsibility? Unless you try to talk with the XIM protocol directly (are you really suggesting others do this?), there' s no choise other than using char/w_char/utf8 strings returned by XmbLookupString(), XwcLookupString, and
Xutf8LookupString(), respectively.  Doesn't NSString take responsibility for
conversion? Moreover, contrary to the explanation of your article, the XIM I use works fine even though it doesn't use either UTF8 or Big5 for encoding. I've never touched XIMInputServer.m for the purpose the article suggests.

 The document is written by the suggestion of Adam Fedor.
 By the time, the support for i18n just starts to work.
 Since I have no idea whether it works for other non-western languages,
 I wrote it as my personal experience rather than an official document.

I think your computer understands none of Chinese characters even today.
It is simply doing mappings as it is told. It should be irrelevant to which
language is used.

I think it's high time to make the document official.

 That's why I always use Traditional Chinese (Big5 encoding) as example
because that's the one I know to work.

I didn't blame you for that. I'm talking about the contents.

The part of Xlib probably is out of date. I never touch Xlib backend since then

It's absolutely out of date. Rather, that part of the article is quite harmful becuase
the current implementation of the xlib backend doesn't support i18n at all.

If you find my claims resonable, I'd like you to read the attached file.
If you find it useful for you, I'm willing to cooperate with you.

- KK

How to set up GNUstep for East Asian languages

Yen-Ju Chen

2003-07-04 Versions 2.0 beta

1. Introduction

This brief article illustrates how to set up your GNUstep for the East
Asian languages known as CJK (Chinese, Japanese, and Korean) in literature.
We assume that you already know how to set up your X Window System
for your language environment such as locale, fonts, and input methods.
We also assume that you selected 'art' as the backend of GNUstep's GUI.

Like other computer software made outside the region, GNUstep requires
some adjustment to use those languages.  The adjustment consists of
the following steps:

1. Prepare one or more true type font files which contain characters
   of your native language, and organize them in a certain way so that
   the art backend can use them.
2. Set the environmental variable GNUSTEP_STRING_ENCODING to an appropriate
   value for the language in use.
3. Set the NSGlobalDomain variables such as NSFont, NSFontSize, and NSUserFont,
   to name a few, to appropriate values using the GNUstep's
   utility 'defaults'.

Now we explain each step in detail.

2. Fonts

The art backend expects necessary true type font files to be found in the
specified directories, which are usually $GNUSTEP_USER_ROOT/Library/Fonts
and $GNUSTEP_SYSTEM_ROOT/Library/Fonts.  You need to organize font files
in a certain way (see below) so that the art backend can recognize them.

For example, suppose you have a hypothetical true type font file called
MyFont.ttf and want to allow all other users to use it.  Then, as root,

    # cd $GNUSTEP_SYSTEM_ROOT/Library/Fonts
    # mkdir MyFont.nfont
    # cd MyFont.nfont

With your favorite editor, create a file whose contents is as follows:

    Faces = (
            PostScriptName = "MyFont";
            Name = "Regular";
            Files = ("MyFont.ttf");

Then save it as FontInfo.plist (the format above is known as property list in
GNUstep, which explains why the extension is 'plist').  This small file system
you've created just now is referred to as .nfont package.

The FontInfo.plist above is just a bare-bones version.  For further details,
we strongly recommend the reader to read nfont_packages.txt found at


If you want to use the font file personally, replace GNUSTEP_SYSTEM_ROOT with
GNUSTEP_USER_ROOT in the instruction above.

3. Encoding

As default, GNUstep assumes that a character is encoded in ISO8859-1 unless
the escape character \u precedes it (This exception applies to other encodings).
Hence, if you want to use the characters of your native language with GNUstep,
you have to tell it which encoding you use.  This can be done by setting the
environmental variable GNUSTEP_STRING_ENCODING to an appropriate value.

The possible values for GNUSTEP_STRING_ENCODING are as follows:

  NSJapaneseEUCStringEncoding           // Japanese
  NSISOLatin1StringEncoding             // ISO-8859-1; West European
  NSShiftJISStringEncoding              // Japanese
  NSISOLatin2StringEncoding             // ISO-8859-2; East European
  NSWindowsCP1252StringEncoding         // WinLatin1
  NSWindowsCP1253StringEncoding         // Greek
  NSWindowsCP1254StringEncoding         // Turkish
  NSWindowsCP1250StringEncoding         // WinLatin2
  NSISO2022JPStringEncoding             // Japanese

// GNUstep additions
  NSKOI8RStringEncoding                 // Russian/Cyrillic
  NSISOLatin3StringEncoding             // ISO-8859-3; South European
  NSISOLatin4StringEncoding             // ISO-8859-4; North European
  NSISOCyrillicStringEncoding           // ISO-8859-5
  NSISOArabicStringEncoding             // ISO-8859-6
  NSISOGreekStringEncoding              // ISO-8859-7
  NSISOHebrewStringEncoding             // ISO-8859-8
  NSISOLatin5StringEncoding             // ISO-8859-9; Turkish
  NSISOLatin6StringEncoding             // ISO-8859-10; Nordic
  NSISOThaiStringEncoding               // ISO-8859-11
  NSISOLatin7StringEncoding             // ISO-8859-13
  NSISOLatin8StringEncoding             // ISO-8859-14
  NSISOLatin9StringEncoding             // ISO-8859-15; Replaces ISOLatin1
  NSUTF7StringEncoding                  // RFC 2152
  NSGSM0338StringEncoding               // GSM (mobile phone) default alphabet
  NSBIG5StringEncoding                  // Traditional chinese

Of these values, choose an appropriate one for your purpose and set the
environmental variable to it.  For example, for sh or bash,

    $ export GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding

or, for csh,

    % setenv GNUSTEP_STRING_ENCODING NSBIG5StringEncoding

4. User Default Values

Now that you specify the encoding, you have to determine which fonts you
use to display the characters of your native language.

Becuase the fonts used in GNUstep GUI are initially set to those that are
appropriate for European languages, you have to overwrite them to display
the characters correctly.

At least, you need to change the user default value NSFont.  For example,
suppose you have an .nfont package called MyFont and want to use it to display
the characters.  To do this, use the GNUstep's utility 'defaults' as follows:

    $ defaults write NSGlobalDomain NSFont MyFont

Depending on situation, you may also need to set NSUserFont to MyFont.

In GNUstep, a pair of a key and a value such as (NSFont, MyFont) is called
a dictionary.

To confirm the value, use

    $ defaults read

If you want to remove the assignment entirely to revert to the original
default value, use

    $ defaults delete NSGlobalDomain NSFont

For further details about the user default values, the reader can refer to
the documents DefaultsSummary.html and NSFont.html shipped with the GNUstep

5. Examples

5.1. Chinese

(Yen-Ju Chen gives an example here.)

5.2. Japanese

(Kazunobu Kuriyama gives an example here.)

5.3. Korean

(Waiting for someone who contributes it.)

6. Concluding Remarks

Although this article has focused on the CJK languages, most part of it
is also applicable to other languages if GNUstep supports the enconding
you need.  

If you find a way to set up GNUstep with your native language other than
CJK, please consider to contribute it to the GNUstep community to share
your invaluable experience with others.  We'll greatly appreciate it.
Comments or suggestions are also welcome.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]