git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17283 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-07-22 02:52:26 +00:00
parent 5152c169d4
commit 3da6c2aecd
2 changed files with 388 additions and 205 deletions

View file

@ -1,3 +1,7 @@
2003-07-21 Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
* Documentation/Gui/LanguageSetup.gsdoc: Update.
2003-07-21 Andrew Ruder <aeruder@ksu.edu> 2003-07-21 Andrew Ruder <aeruder@ksu.edu>
* Source/NSBundleAdditions.m: Fix memory leaks. * Source/NSBundleAdditions.m: Fix memory leaks.
@ -63,7 +67,7 @@
2003-07-16 Adam Fedor <fedor@gnu.org> 2003-07-16 Adam Fedor <fedor@gnu.org>
* Documentation/Gui/LanguageSetup.gsdoc: Updated with changes from * 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 <FredKiefer@gmx.de> 2003-07-16 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -1,209 +1,388 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.7//EN" "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" > <!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.0//EN" "http://www.gnustep.org/gsdoc-1_0_0.xml" >
<gsdoc base="LanguageSetup"> <gsdoc base="LanguageSetup">
<head> <head>
<title>Using Traditional Chinese and Other Languages</title> <title>How to Set Up GNUstep for the East Asian Languages</title>
<author name="Yen-Ju Chen"> <author name="Kazunobu Kuriyama">
<url url="http://www.gnustep.org/developers/whoiswho.html"/> <email address="kazunobu.kuriyama@nifty.com">
</author> kazuanobu.kuriyama@nifty.com
<author name="Kazunobu Kuriyama"> </email>
</author> </author>
<version>$Revision$</version> <author name="Yen-Ju Chen">
<date>$Date$</date> <email address="yjchenx@hotmail.com">
</head> yjchenx@hotmail.com
<body> </email>
<chapter> </author>
<heading>Using Traditional Chinese and Other Languages</heading> <version>2.0</version>
<p>This brief article illustrates how to set up your GNUstep for <date>2003-07-21</date>
the East Asian languages known as CJK (Chinese, Japanese, and <abstract>
Korean) in literature. We assume that you already know how to This article illustrates how to set up GNUstep for the East
set up your X Window System for your language environment such Asian languages with some working examples. It also includes
as locale, fonts, and input methods. We also assume that you some useful information applicable to other non-European languages.
selected 'art' as the backend of GNUstep's GUI. </abstract>
</p> <copy>2003 Free Software Foundation, Inc.</copy>
</head>
<body>
<chapter>
<heading>Introduction</heading>
<p>
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.
</p>
<p>
Like other computer software made outside the region, GNUstep requires
some adjustment to use those languages. The adjustment consists of
the following steps:
</p>
<enum>
<item>
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.
</item>
<item>
Set the environmental variable <code>GNUSTEP_STRING_ENCODING</code> to an
appropriate value for the language in use.
</item>
<item>
Set the <code>NSGlobalDomain</code> variables such as <code>NSFont</code>,
<code>NSFontSize</code>, and <code>NSUserFont</code>, to name a few, to
appropriate values using the GNUstep's utility <code>defaults</code>.
</item>
</enum>
<p>
Now we explain each step in detail and give some working examples.
</p>
</chapter>
<chapter>
<heading>Fonts</heading>
<p>
The art backend expects necessary true type font files to be found in the
specified directories, which are usually
<code>$GNUSTEP_USER_ROOT/Library/Fonts</code>
and
<code>$GNUSTEP_SYSTEM_ROOT/Library/Fonts</code>.
You need to organize font files in a certain way (see below) so that the
art backend can recognize them.
</p>
<p>
For example, suppose you have a hypothetical true type font file called
<code>MyFont.ttf</code> and want to allow all other users to use it.
Then, as root,
</p>
<example>
# cd $GNUSTEP_SYSTEM_ROOT/Library/Fonts
# mkdir MyFont.nfont
# cd MyFont.nfont
</example>
<p>
With your favorite editor, create a file whose contents are as follows:
</p>
<example>
{
Faces = (
{
PostScriptName = "MyFont";
Name = "Regular";
Files = ("MyFont.ttf");
}
);
}
</example>
<p>
Then save it as <code>FontInfo.plist</code> (the format above is known as
property list in GNUstep, which explains why the extension is
<code>plist</code>). This small file system you've created just now is
referred to as <code>.nfont</code> package.
</p>
<p>
The <code>FontInfo.plist</code> above is just a bare-bones version. For
further details, we strongly recommend the reader to read
the file <code>nfont_packages.txt</code> found at
<code>http://wiki.gnustep.org/index.php/nfont%20packages</code>.
</p>
<p>
If you want to use the font file privately, replace
<code>GNUSTEP_SYSTEM_ROOT</code> with
<code>GNUSTEP_USER_ROOT</code> in the instruction above.
</p>
</chapter>
<chapter>
<heading>Encoding</heading>
<p>Like other computer software made outside the region, GNUstep <p>
requires some adjustment to use those languages. The adjustment GNUstep assumes as default that every character is encoded in <code>ISO8859-1</code> unless
consists of the following steps: the escape character \u precedes it (This exception applies to other
</p> encodings). Hence, if you want to use the characters of your native
<enum> language with GNUstep, you have to tell it which encoding you use. This
<item> can be done by setting the environmental variable
Prepare one or more true type font files which contain characters <code>GNUSTEP_STRING_ENCODING</code> to an appropriate value.
of your native language, and organize them in a certain way so that </p>
the art backend can use them. <p>
</item> The possible values for <code>GNUSTEP_STRING_ENCODING</code> are as follows:
<item> </p>
Set the environmental variable GNUSTEP_STRING_ENCODING to an <example>
appropriate value for the language in use. NSASCIIStringEncoding
</item> NSNEXTSTEPStringEncoding
<item> NSJapaneseEUCStringEncoding // Japanese
Set the NSGlobalDomain variables such as NSFont, NSFontSize, NSUTF8StringEncoding
and NSUserFont, to name a few, to appropriate values using the NSISOLatin1StringEncoding // ISO-8859-1; West European
GNUstep's utility 'defaults'. NSSymbolStringEncoding
</item> NSNonLossyASCIIStringEncoding
</enum> NSShiftJISStringEncoding // Japanese
NSISOLatin2StringEncoding // ISO-8859-2; East European
NSUnicodeStringEncoding
NSWindowsCP1251StringEncoding
NSWindowsCP1252StringEncoding // WinLatin1
NSWindowsCP1253StringEncoding // Greek
NSWindowsCP1254StringEncoding // Turkish
NSWindowsCP1250StringEncoding // WinLatin2
NSISO2022JPStringEncoding // Japanese
NSMacOSRomanStringEncoding
NSProprietaryStringEncoding
<p>Now we explain each step in detail.</p> // GNUstep additions
NSKOI8RStringEncoding // Russian/Cyrillic
<section> NSISOLatin3StringEncoding // ISO-8859-3; South European
<heading>Fonts</heading> NSISOLatin4StringEncoding // ISO-8859-4; North European
NSISOCyrillicStringEncoding // ISO-8859-5
<p>The art backend expects font files to be found in the NSISOArabicStringEncoding // ISO-8859-6
specified directories, such as NSISOGreekStringEncoding // ISO-8859-7
<file>$GNUSTEP_USER_ROOT/Library/Fonts</file> and NSISOHebrewStringEncoding // ISO-8859-8
<file>$GNUSTEP_SYSTEM_ROOT/Library/Fonts</file>. You need to NSISOLatin5StringEncoding // ISO-8859-9; Turkish
organize font files in a certain way so that the art NSISOLatin6StringEncoding // ISO-8859-10; Nordic
backend can recognize them.</p> NSISOThaiStringEncoding // ISO-8859-11
NSISOLatin7StringEncoding // ISO-8859-13
<p> NSISOLatin8StringEncoding // ISO-8859-14
Check out these documents about installation and usage of nfonts: NSISOLatin9StringEncoding // ISO-8859-15; Replaces ISOLatin1
<uref url="http://wiki.gnustep.org/index.php/back-art%20Installation"> NSGB2312StringEncoding
back-art Installation</uref>, NSUTF7StringEncoding // RFC 2152
<uref url= NSGSM0338StringEncoding // GSM (mobile phone) default alphabet
"http://wiki.gnustep.org/index.php/nfont%20packages">nfont NSBIG5StringEncoding // Traditional chinese
package</uref>.</p> </example>
</section> <p>
Of these values, choose an appropriate one for your purpose and set the
environmental variable to it. For example, for sh or bash,
<section> </p>
<heading>Encoding</heading> <example>
$ export GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding
<p> </example>
By default, GNUstep assumes that a character is encoded in <p>
ISO8859-1 unless the escape character \u precedes it (This or, for csh,
exception applies to other encodings). Hence, if you want to </p>
use the characters of your native language with GNUstep, you <example>
have to tell it which encoding you use. This can be done by % setenv GNUSTEP_STRING_ENCODING NSBIG5StringEncoding
setting the environmental variable GNUSTEP_STRING_ENCODING to an </example>
appropriate value. </chapter>
</p> <chapter>
<heading>User Default Values</heading>
<p>Some possible values for GNUSTEP_STRING_ENCODING are as follows:</p> <p>
<list> Now that you've specified the encoding, you have to determine which fonts
<item>NSJapaneseEUCStringEncoding // Japanese</item> you use to display the characters of your native language.
<item>NSUTF8StringEncoding</item> </p>
<item>NSISOLatin1StringEncoding // ISO-8859-1; West European</item> <p>
<item>NSShiftJISStringEncoding // Japanese</item> Becuase the fonts used with GNUstep GUI are initially set to those that are
<item>NSISOLatin2StringEncoding // ISO-8859-2; East European</item> appropriate for European languages, you have to overwrite them to display
<item>NSUnicodeStringEncoding</item> the characters correctly.
<item>NSWindowsCP1251StringEncoding</item> </p>
<item>NSWindowsCP1252StringEncoding // WinLatin1</item> <p>
<item>NSWindowsCP1253StringEncoding // Greek</item> At least, you need to change the user default value <code>NSFont</code>.
<item>NSWindowsCP1254StringEncoding // Turkish</item> For example, suppose you have a hypothetical <code>.nfont</code> package
<item>NSWindowsCP1250StringEncoding // WinLatin2</item> called <code>MyFont</code> and want to use it to display the characters.
<item>NSISO2022JPStringEncoding // Japanese</item> To do this, use the GNUstep's utility <code>defaults</code>as follows:
<item>NSMacOSRomanStringEncoding</item> </p>
<item>NSKOI8RStringEncoding // Russian/Cyrillic</item> <example>
<item>NSISOLatin3StringEncoding // ISO-8859-3; South European</item> $ defaults write NSGlobalDomain NSFont MyFont
<item>NSISOLatin4StringEncoding // ISO-8859-4; North European</item> </example>
<item>NSISOCyrillicStringEncoding // ISO-8859-5</item> <p>
<item>NSISOArabicStringEncoding // ISO-8859-6</item> Depending on a situation, you may also need to set <code>NSUserFont</code>
<item>NSISOGreekStringEncoding // ISO-8859-7</item> to <code>MyFont</code>. (In GNUstep, a pair of a key and a value such as
<item>NSISOHebrewStringEncoding // ISO-8859-8</item> <code>(NSFont, MyFont)</code> is referred to as a dictionary.)
<item>NSISOLatin5StringEncoding // ISO-8859-9; Turkish</item> </p>
<item>NSISOLatin6StringEncoding // ISO-8859-10; Nordic</item> <p>
<item>NSISOThaiStringEncoding // ISO-8859-11</item> To confirm the value, use
<item>NSISOLatin7StringEncoding // ISO-8859-13</item> </p>
<item>NSISOLatin8StringEncoding // ISO-8859-14</item> <example>
<item>NSISOLatin9StringEncoding // ISO-8859-15; Replaces ISOLatin1</item> $ defaults read
<item>NSGB2312StringEncoding</item> </example>
<item>NSUTF7StringEncoding // RFC 2152</item> <p>
<item>NSGSM0338StringEncoding // GSM (mobile phone) default alphabet</item> If you want to remove the assignment entirely to revert to the original
<item>NSBIG5StringEncoding // Traditional chinese</item> default value, use
</list> </p>
<example>
<p> $ defaults delete NSGlobalDomain NSFont
Of these values, choose an appropriate one for your purpose and </example>
set the environmental variable to it. For example, for sh or <p>
bash, For further details about the user default values, the reader can refer to
</p> the documents <code>DefaultsSummary.html</code> and <code>NSFont.html</code>
<example> shipped with the GNUstep core library package.
export GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding </p>
</example> </chapter>
<chapter>
<p>or, for csh,</p> <heading>Examples</heading>
<example> <p>
setenv GNUSTEP_STRING_ENCODING NSBIG5StringEncoding In the following examples, we assume that the reader has already set up the
</example> X Window System properly for her/his language environment. In particular,
</section> 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
<section> to appropriate values. Such variables include <code>LC_ALL</code>,
<heading>User Default Values</heading> <code>LC_CTYPE</code>, and <code>LANG</code>.
</p>
<p> <section>
Now that you specify the encoding, you have to determine which fonts you <heading>
use to display the characters of your native language.</p> Chinese
</heading>
<p>Becuase the fonts used in GNUstep GUI are initially set to <subsect>
those that are appropriate for European languages, you have to <heading>
overwrite them to display the characters correctly. Traditional Chinese
</p> </heading>
<subsubsect>
<p>At least, you need to change the user default value NSFont. <heading>
For example, suppose you have an .nfont package called MyFont Environmental Variables:
and want to use it to display the characters. To do this, use </heading>
the GNUstep's utility 'defaults' as follows: <example>
</p> GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding
<example> LC_CTYPE=zh_TW.Big5
defaults write NSGlobalDomain NSFont "MyFont" </example>
defaults write NSGlobalDomain NSFontSize 16 </subsubsect>
</example> <subsubsect>
<heading>
<p> .nfont package:
Depending on situation, you may also need to set NSUserFont to </heading>
the same font. For further details about the user default values, the <p>
reader can refer to the documents DefaultsSummary.html and MingTi.nfont (using Arphic font as example)
NSFont.html shipped with the GNUstep packages. </p>
</p> </subsubsect>
</section> <subsubsect>
<heading>
<section> MingTi.nfont/FontInfo.plist:
<heading>Examples</heading> </heading>
<example>
<subsect> {
<heading>Chinese</heading> Face = (
{
<example> PostScriptName = "MingTi";
export GNUSTEP_STRING_ENCODING=NSBIG5StringEncoding Name = "Regular";
</example> Files = ("bsmi00lp.ttf")
<example> }
defaults write NSGlobalDomain NSFont "Ar Pl Kaitim Big5" );
defaults write NSGlobalDomain NSFontSize 16 }
</example> </example>
</subsect> </subsubsect>
<subsubsect>
<subsect> <heading>
<heading>Japanese</heading> User Defaults:
</heading>
</subsect> <example>
$ defaults write NSGlobalDomain NSFont MingTi
<subsect> </example>
<heading>Korean</heading> </subsubsect>
</subsect>
</subsect> </section>
</section> <section>
<heading>
Japanese
<section> </heading>
<heading>Concluding Remarks</heading> <subsect>
<heading>
<p> Environmental Variables:
Although this article has focused on the CJK languages, most part of it </heading>
is also applicable to other languages if GNUstep supports the enconding <example>
you need. GNUSTEP_STRING_ENCODING=NSJapaneseEUCStringEncoding
</p> LANG=ja_JP
</example>
<p> </subsect>
If you find a way to set up GNUstep with your native language <subsect>
other than CJK, please consider to contribute it to the GNUstep <heading>
community to share your invaluable experience with others. We'll .nfont package:
greatly appreciate it. Comments or suggestions are also welcome. </heading>
</p> <p>
</section> 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
</chapter> the case, you can use them to make your own .nfont packages. We'll give an
</body> example below when msgothic.ttc is used.
</p>
<p>
First, make a directory for an .nfont package you are going to make:
</p>
<example>
$ cd $GNUSTEP_USER_ROOT/Library/Fonts (or $GNUSTEP_SYSTEM_ROOT/Library/Fonts)
$ mkdir 'MS Gothic.nfont'
$ cd 'MS Gothic'
</example>
<p>
Make a copy of the font file in the directory, say, assuming the Windows'
partition /dev/hda1 is to be mounted at /mnt/win98:
</p>
<example>
$ mount -t vfat /dev/hda1 /mnt/win98
$ cp /mnt/win98/windows/fonts/msgothic.ttc .
</example>
<p>
And write a <code>FontInfo.plist</code> (see below).
</p>
</subsect>
<subsect>
<heading>
MS Gothic.nfont/FontInfo.plist:
</heading>
<example>
{
Faces = (
{
PostScriptName = "MS Gothic";
Name = "Regular";
Files = ("msgothic.ttc")
}
);
}
</example>
</subsect>
<subsect>
<heading>
User Defaults:
</heading>
<example>
$ defaults write NSGlobalDomain NSFont 'MS Gothic'
$ defaults write NSGlobalDomain NSUserFont 'MS Gothic'
</example>
</subsect>
<p>
<em>
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.
</em>
</p>
</section>
<section>
<heading>
Korean
</heading>
<p>
(If someone could contribute some stuff here, we would appreciate it.)
</p>
</section>
</chapter>
<chapter>
<heading>
Concluding Remarks
</heading>
<p>
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.
</p>
<p>
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.
</p>
</chapter>
</body>
</gsdoc> </gsdoc>