Difference between revisions of "Chinese Japanese and Korean"

From Wiki
Jump to navigation Jump to search
m (fix pragma links & typos)
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
< [[Fonts]] | [[Encodings and Regimes]] >
+
* old introduction [[Uptodate]] by Pragma: [http://www.pragma-ade.nl/general/uptodate/up-007-s.pdf screen] and [http://www.pragma-ade.nl/general/uptodate/up-007-p.pdf paper] version
 +
* manual by Pragma: [[manual:mchinese.pdf|Chinese in ConTeXt]] (Old 2001)
  
* old introduction [[Uptodate]] by Pragma: [http://www.pragma-ade.com/general/uptodate/up-007-s.pdf screen] and [http://www.pragma-ade.com/general/uptodate/up-007-p.pdf paper] version
+
=Chinese in ConTeXt=
* manual by Pragma: [http://www.pragma-ade.com/general/manuals/mchinese.pdf Chinese in ConTeXt]
 
  
=Chinese in ConTeXt (ConTeXt 2005.12.19 and newer)=
+
Get inspirated with importing Chinese fonts with this [https://github.com/BruXy/ConTeXt-Chinese script].
  
If you have [[Context 2005.12.19]], you only have to get the fonts.
+
# You need some Chinese (TrueType) fonts; you may want to get for example Microsoft Truetype fonts:
 +
## [http://archive1.village.virginia.edu/spw4s/fonts/STSONG.TTF STSong],
 +
## [http://archive1.village.virginia.edu/spw4s/fonts/STZHONGS.TTF STZhongsong],
 +
## [http://archive1.village.virginia.edu/spw4s/fonts/STXIHEI.TTF STXihei],
 +
## [http://archive1.village.virginia.edu/spw4s/fonts/STKAITI.TTF STKaiti],
 +
## [http://archive1.village.virginia.edu/spw4s/fonts/STFANGSO.TTF STFangsong].
 +
# Example of some basic document with enabled Chinese:
  
# You need some Chinese (TrueType) fonts; you may want to get [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htfs.ttf FangSong], [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/hthei.ttf HeiTi], [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htkai.ttf KaiTi] and [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htsong.ttf SongTi]. Put those e.g. into $TEXMF/fonts/truetype/chinese/.
 
# Use Hans Hagen's experimental [http://www.physik.fu-berlin.de/~tburnus/ttf2uni.rb ttf2uni.rb] script to create .map, .tfm and .enc files. You can then put the files e.g. to $TEXMF/fonts/tfm/chinese/ (*.tfm files), $TEXMF/fonts/enc/chinese/ (*.enc files, they are basically the same for all fonts) and to $TEXMF/fonts/map/chinese/.
 
# You may now need to update the hash TeX uses to find the files; using teTeX this is done by running <tt>texhash</tt>.
 
# How you can run your Hello World program:
 
 
<texcode>
 
<texcode>
 +
\mainlanguage[cn]
 +
\language[cn]
 
\enableregime[utf]
 
\enableregime[utf]
\usemodule[chi-00]
+
\setscript[hanzi] % hyphenation
 +
 
 +
% Enable fonts
 +
\usetypescriptfile[mscore]
 +
\setupbodyfont [mschinese,12pt]
 +
\usebodyfont  [mschinese-light,12pt]
 +
\definebodyfontenvironment[24pt]
 +
\definebodyfontenvironment[18pt]
 +
 
 +
\setuppagenumber [numberconversion=cn]
 +
\definestructureconversionset[chinese][numbers][cn]
 +
\setupheads [sectionconversionset=chinese]
 +
 
 +
\define[2]\ChineseChapter{第#1章 #2}
 +
\setuphead[chapter][command=\ChineseChapter,style={\bf\switchtobodyfont[24pt]}]
 +
\setuphead[section][style={\bf\switchtobodyfont[18pt]}]
 +
 
 +
 
 +
\setuppagenumbering[state=start,
 +
    alternative=singlesided,
 +
    location={footer, center},
 +
    style={\bf\switchtobodyfont[11pt]}
 +
]
 +
 
 
\starttext
 
\starttext
  你好!
+
\chapter{华文字体系列}
 +
 +
在微软提供的 Office 套装中附带了一定数量的中文字体,这些字体是常州华文印刷新技术有限公司制造的。
 +
 
 +
\startitemize
 +
\item \type{\it}: {\it 华文仿宋}
 +
\item \type{\rm}: {\rm 华文仿宋}
 +
\item \type{\bf}: {\bf 华文中宋}
 +
\item \type{\ss}: {\ss 华文细黑}
 +
\item \type{\tfxx}: {\tfxx 华文仿宋}
 +
\item \type{\tfx}: {\tfx 华文仿宋}
 +
\item \type{\tf}: {\tf 华文仿宋}
 +
\item \type{\tfa}: {\tfa 华文仿宋}
 +
\item \type{\tfb}: {\tfb  华文仿宋}
 +
\item \type{\tfc}: {\tfc 华文仿宋}
 +
\item \type{\tfd}: {\tfd 华文仿宋}
 +
\stopitemize
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
  
If you only want to access a few Chinese characters, you should use <code>\input font-chi.tex</code> instead of <code>\usemodule[chinese]</code> as the latter changes also the default language and some of the numberation/section settings (see [http://source.contextgarden.net/tex/context/base/s-chi-00.tex s-chi-00.tex]).
+
=Font setup for Korean=
 +
 
 +
Example by Wolfgang (2017-12-06):
 +
 
 +
You need fonts which contain hangul characters (don’t forget to set a math font because it is used for the symbols in enumerations) and you have to enable linebreaking for Korean with the {{cmd|setscript}} command.
  
If you want to typset vertical text, use <tt>\startvertical ... \stopvertical</tt>, if you want to use Chinese numbers, you can use e.g. <tt>\startitemize[c]</tt>; possible options are <tt>c</tt> or <tt>cn</tt> for normal Chinese numbers (一, 二, 三, 四, 五, 六 etc.), <tt>cc</tt> for the capitalized (or financial) Chinese numbers (壹, 贰, 叁 etc.), <tt>ec</tt> for an extended version which uses 廿 and 卅 (instead of 二十 and 三十), and <tt>ac</tt> for using the Chinese numbers zero (零, 〇) to nine (九) in the same way one does with the Arabic digits 0 to 9.
+
<texcode>
 +
\definefallbackfamily [mainface] [rm] [Nanum Myeongjo] [preset=range:korean]
 +
\definefontfamily    [mainface] [rm] [DejaVu Serif]
  
 +
\definefallbackfamily [mainface] [ss] [Nanum Gothic] [preset=range:korean]
 +
\definefontfamily    [mainface] [ss] [DejaVu Sans]
  
//added by Xiao Jianfeng
+
\definefallbackfamily [mainface] [tt] [Nanum Gothic Coding] [features=none,preset=range:korean]
 +
\definefontfamily    [mainface] [tt] [DejaVu Sans Mono] [features=none]
  
As far as I know, it is wrong to use "零" with "一,二,....,十".
+
\definefontfamily    [mainface] [mm] [DejaVu Math]
Following is the corresponding relationships between lower case and upper case Chinese numbers and arabic numbers.
 
  
Chinese lower:〇,一,二,三,四,五,六,七,八,九,十,百,千
+
\setupbodyfont[mainface]
  
Chinese upper:零,壹,贰,叁,肆,伍,陆,柒,捌,玖,拾,佰,仟
+
\setscript[hangul]
  
Arabic      :0, 1, 2,3, 4,5, 6, 7,8, 9,10,100,1000
+
\starttext
  
"零" is a upper case Chinese number, so it should not be mixed with other lower case Chinese numbers. Although in China, it is sometimes wrongly used.
+
이 FAQ 은 자주 반복되는 질문과 그에 대한 대답을 간단명료한 양식으로
 +
모아 엮어졌습니다.
  
The reason why numbers in Chinese has lower case and upper case in Chinese is for accounting safety. Lower case numbers are simple to  write and far more often used in daily life, while upper case numbers are almost exclusively used in accouting.  
+
{\ss 이 FAQ 은 자주 반복되는 질문과 그에 대한 대답을 간단명료한 양식으로
 +
모아 엮어졌습니다.}
  
We can see that every upper case Chinese number are very different from the others, hence cannot be easily modified to the other . But the lower case Chinese number or Arabic numbers are sometime easily to be modified. For example, "一", "二" and "三" are similar so one can easily modify a "一" to "二" or "三".And one can also modify "1" to "7" or "11", or one can modify "6" to "8".
+
\starttyping
 +
이 FAQ 은 자주 반복되는 질문과 그에 대한 대답을 간단명료한 양식으로
 +
모아 엮어졌습니다.
 +
\stoptyping
 +
 
 +
\stoptext
 +
</texcode>
  
In China, numbers must be written in both Chinese upper case and Arabic form together in accounting.
+
== See also ==
 +
* [[CJK fonts]]
  
 
[[Category:Fonts]]
 
[[Category:Fonts]]
[[Category:International]]
+
[[Category:Languages]]

Revision as of 08:20, 1 July 2022

Chinese in ConTeXt

Get inspirated with importing Chinese fonts with this script.

  1. You need some Chinese (TrueType) fonts; you may want to get for example Microsoft Truetype fonts:
    1. STSong,
    2. STZhongsong,
    3. STXihei,
    4. STKaiti,
    5. STFangsong.
  2. Example of some basic document with enabled Chinese:
\mainlanguage[cn]
\language[cn]
\enableregime[utf]
\setscript[hanzi] % hyphenation

% Enable fonts
\usetypescriptfile[mscore]
\setupbodyfont [mschinese,12pt]
\usebodyfont   [mschinese-light,12pt]
\definebodyfontenvironment[24pt]
\definebodyfontenvironment[18pt]

\setuppagenumber [numberconversion=cn]
\definestructureconversionset[chinese][numbers][cn]
\setupheads [sectionconversionset=chinese]

\define[2]\ChineseChapter{#1章 #2}
\setuphead[chapter][command=\ChineseChapter,style={\bf\switchtobodyfont[24pt]}]
\setuphead[section][style={\bf\switchtobodyfont[18pt]}]


\setuppagenumbering[state=start,
    alternative=singlesided,
    location={footer, center},
    style={\bf\switchtobodyfont[11pt]}
]

\starttext
\chapter{华文字体系列}
 
在微软提供的 Office 套装中附带了一定数量的中文字体,这些字体是常州华文印刷新技术有限公司制造的。

\startitemize
\item \type{\it}: {\it 华文仿宋}
\item \type{\rm}: {\rm 华文仿宋}
\item \type{\bf}: {\bf 华文中宋}
\item \type{\ss}: {\ss 华文细黑}
\item \type{\tfxx}: {\tfxx 华文仿宋}
\item \type{\tfx}: {\tfx 华文仿宋}
\item \type{\tf}: {\tf 华文仿宋}
\item \type{\tfa}: {\tfa 华文仿宋}
\item \type{\tfb}: {\tfb  华文仿宋}
\item \type{\tfc}: {\tfc 华文仿宋}
\item \type{\tfd}: {\tfd 华文仿宋}
\stopitemize
\stoptext

Font setup for Korean

Example by Wolfgang (2017-12-06):

You need fonts which contain hangul characters (don’t forget to set a math font because it is used for the symbols in enumerations) and you have to enable linebreaking for Korean with the \setscript command.

\definefallbackfamily [mainface] [rm] [Nanum Myeongjo] [preset=range:korean]
\definefontfamily     [mainface] [rm] [DejaVu Serif]

\definefallbackfamily [mainface] [ss] [Nanum Gothic] [preset=range:korean]
\definefontfamily     [mainface] [ss] [DejaVu Sans]

\definefallbackfamily [mainface] [tt] [Nanum Gothic Coding] [features=none,preset=range:korean]
\definefontfamily     [mainface] [tt] [DejaVu Sans Mono] [features=none]

\definefontfamily     [mainface] [mm] [DejaVu Math]

\setupbodyfont[mainface]

\setscript[hangul]

\starttext

이 FAQ 은 자주 반복되는 질문과 그에 대한 대답을 간단명료한 양식으로
모아 엮어졌습니다.

{\ss 이 FAQ 은 자주 반복되는 질문과 그에 대한 대답을 간단명료한 양식으로
모아 엮어졌습니다.}

\starttyping
이 FAQ 은 자주 반복되는 질문과 그에 대한 대답을 간단명료한 양식으로
모아 엮어졌습니다.
\stoptyping

\stoptext

See also