diff --git a/ChangeLog b/ChangeLog index fa768e654..a38347a07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-07-21 Kazunobu Kuriyama + + * Documentation/Gui/LanguageSetup.gsdoc: Update. + 2003-07-21 Andrew Ruder * Source/NSBundleAdditions.m: Fix memory leaks. @@ -63,7 +67,7 @@ 2003-07-16 Adam Fedor * Documentation/Gui/LanguageSetup.gsdoc: Updated with changes from - Yen-Ju Chen and (Kazunobu Kuriyama. + Yen-Ju Chen and (Kazunobu Kuriyama.) 2003-07-16 Fred Kiefer diff --git a/Documentation/Gui/LanguageSetup.gsdoc b/Documentation/Gui/LanguageSetup.gsdoc index 301918367..a1191bbb9 100644 --- a/Documentation/Gui/LanguageSetup.gsdoc +++ b/Documentation/Gui/LanguageSetup.gsdoc @@ -1,209 +1,388 @@ - + - - Using Traditional Chinese and Other Languages - - - - - - $Revision$ - $Date$ - - - - Using Traditional Chinese and Other Languages -

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. -

+ + How to Set Up GNUstep for the East Asian Languages + + + kazuanobu.kuriyama@nifty.com + + + + + yjchenx@hotmail.com + + + 2.0 + 2003-07-21 + + This article illustrates how to set up GNUstep for the East + Asian languages with some working examples. It also includes + some useful information applicable to other non-European languages. + + 2003 Free Software Foundation, Inc. + + + + 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: +

+ + + 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. + + + Set the environmental variable GNUSTEP_STRING_ENCODING to an + appropriate value for the language in use. + + + 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 and give some working examples. +

+
+ + 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 are 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 + the file nfont_packages.txt found at + http://wiki.gnustep.org/index.php/nfont%20packages. +

+

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

+
+ + Encoding -

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

- - - 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. - - - Set the environmental variable GNUSTEP_STRING_ENCODING to an - appropriate value for the language in use. - - - Set the NSGlobalDomain variables such as NSFont, NSFontSize, - and NSUserFont, to name a few, to appropriate values using the - GNUstep's utility 'defaults'. - - +

+ GNUstep assumes as default that every 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: +

+ + NSASCIIStringEncoding + NSNEXTSTEPStringEncoding + NSJapaneseEUCStringEncoding // Japanese + NSUTF8StringEncoding + NSISOLatin1StringEncoding // ISO-8859-1; West European + NSSymbolStringEncoding + NSNonLossyASCIIStringEncoding + NSShiftJISStringEncoding // Japanese + NSISOLatin2StringEncoding // ISO-8859-2; East European + NSUnicodeStringEncoding + NSWindowsCP1251StringEncoding + NSWindowsCP1252StringEncoding // WinLatin1 + NSWindowsCP1253StringEncoding // Greek + NSWindowsCP1254StringEncoding // Turkish + NSWindowsCP1250StringEncoding // WinLatin2 + NSISO2022JPStringEncoding // Japanese + NSMacOSRomanStringEncoding + NSProprietaryStringEncoding -

Now we explain each step in detail.

- -
- Fonts - -

The art backend expects font files to be found in the - specified directories, such as - $GNUSTEP_USER_ROOT/Library/Fonts and - $GNUSTEP_SYSTEM_ROOT/Library/Fonts. You need to - organize font files in a certain way so that the art - backend can recognize them.

- -

- Check out these documents about installation and usage of nfonts: - - back-art Installation, - nfont - package.

-
- - -
- Encoding - -

- By 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. -

- -

Some possible values for GNUSTEP_STRING_ENCODING are as follows:

- - NSJapaneseEUCStringEncoding // Japanese - NSUTF8StringEncoding - NSISOLatin1StringEncoding // ISO-8859-1; West European - NSShiftJISStringEncoding // Japanese - NSISOLatin2StringEncoding // ISO-8859-2; East European - NSUnicodeStringEncoding - NSWindowsCP1251StringEncoding - NSWindowsCP1252StringEncoding // WinLatin1 - NSWindowsCP1253StringEncoding // Greek - NSWindowsCP1254StringEncoding // Turkish - NSWindowsCP1250StringEncoding // WinLatin2 - NSISO2022JPStringEncoding // Japanese - NSMacOSRomanStringEncoding - 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 - NSGB2312StringEncoding - 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 - -
- - -
- 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" - defaults write NSGlobalDomain NSFontSize 16 - - -

- Depending on situation, you may also need to set NSUserFont to - the same font. For further details about the user default values, the - reader can refer to the documents DefaultsSummary.html and - NSFont.html shipped with the GNUstep packages. -

-
- -
- Examples - - - Chinese - - - export GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding - - - defaults write NSGlobalDomain NSFont "Ar Pl Kaitim Big5" - defaults write NSGlobalDomain NSFontSize 16 - - - - - Japanese - - - - - Korean - - -
- - -
- 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. -

-
- -
- + // 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 + NSGB2312StringEncoding + 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 + +
+ + User Default Values +

+ Now that you've specified the encoding, you have to determine which fonts + you use to display the characters of your native language. +

+

+ Becuase the fonts used with 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 a hypothetical .nfont package + called MyFont and want to use it to display the characters. + To do this, use the GNUstep's utility defaultsas follows: +

+ + $ defaults write NSGlobalDomain NSFont MyFont + +

+ Depending on a 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 referred to as 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 core library package. +

+
+ + Examples +

+ In the following examples, we assume that the reader has already set up the + X Window System properly for her/his language environment. In particular, + the locale the reader wants to use must be supported by both the C + starndard library and the X library of the system in use. Before trying some + of the examples, make sure the environmental variables governing encoding are set + to appropriate values. Such variables include LC_ALL, + LC_CTYPE, and LANG. +

+
+ + Chinese + + + + Traditional Chinese + + + + Environmental Variables: + + + GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding + LC_CTYPE=zh_TW.Big5 + + + + + .nfont package: + +

+ MingTi.nfont (using Arphic font as example) +

+
+ + + MingTi.nfont/FontInfo.plist: + + + { + Face = ( + { + PostScriptName = "MingTi"; + Name = "Regular"; + Files = ("bsmi00lp.ttf") + } + ); + } + + + + + User Defaults: + + + $ defaults write NSGlobalDomain NSFont MingTi + + +
+
+
+ + Japanese + + + + Environmental Variables: + + + GNUSTEP_STRING_ENCODING=NSJapaneseEUCStringEncoding + LANG=ja_JP + + + + + .nfont package: + +

+ If you are using Windows with Japanese (and have valid owership of it), you + may have msgothic.ttc or msmincho.ttc in the Windows machine. If this is + the case, you can use them to make your own .nfont packages. We'll give an + example below when msgothic.ttc is used. +

+

+ First, make a directory for an .nfont package you are going to make: +

+ + $ cd $GNUSTEP_USER_ROOT/Library/Fonts (or $GNUSTEP_SYSTEM_ROOT/Library/Fonts) + $ mkdir 'MS Gothic.nfont' + $ cd 'MS Gothic' + +

+ Make a copy of the font file in the directory, say, assuming the Windows' + partition /dev/hda1 is to be mounted at /mnt/win98: +

+ + $ mount -t vfat /dev/hda1 /mnt/win98 + $ cp /mnt/win98/windows/fonts/msgothic.ttc . + +

+ And write a FontInfo.plist (see below). +

+
+ + + MS Gothic.nfont/FontInfo.plist: + + + { + Faces = ( + { + PostScriptName = "MS Gothic"; + Name = "Regular"; + Files = ("msgothic.ttc") + } + ); + } + + + + + User Defaults: + + + $ defaults write NSGlobalDomain NSFont 'MS Gothic' + $ defaults write NSGlobalDomain NSUserFont 'MS Gothic' + + +

+ + CAVEAT: If you use the font files mentioned above, you must use them within + your own right. The instruction given above never changes any rights and + duties you have to use these fonts. + +

+
+
+ + Korean + +

+ (If someone could contribute some stuff here, we would appreciate it.) +

+
+
+ + + 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 for 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. +

+
+
- -