Difference between revisions of "Chinese Japanese and Korean"

From Wiki
Jump to navigation Jump to search
m (fix pragma links & typos)
m (set main language in Korean)
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
* 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
+
=Setup for Japanese=
* manual by Pragma: [[manual:mchinese.pdf|Chinese in ConTeXt]] (Old 2001)
+
 
 +
<texcode>
 +
% 2024-02 Otared Kavian, Jeong Dal et al.
 +
\mainlanguage[ja]
 +
 
 +
\definefontfamily[JapaneseFont][rm][Noto Serif JP]
 +
  [  it={style:regular,features:{*,slanted}},
 +
      sl={style:regular,features:{*,slanted}},
 +
      bi={style:bold,features:{*,slanted}},force=yes]
 +
 
 +
\definefontfamily[JapaneseFont][ss][Noto Serif JP]
 +
  [  it={style:regular,features:{*,slanted}},
 +
      sl={style:regular,features:{*,slanted}},
 +
      bi={style:bold,features:{*,slanted}},force=yes]
 +
 
 +
\definefontfamily[JapaneseFont][tt][Noto Serif JP]
 +
  [   it={style:regular,features:{*,slanted}},
 +
      sl={style:regular,features:{*,slanted}},
 +
      bi={style:bold,features:{*,slanted}},force=yes]
 +
 
 +
\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math]
 +
%\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math]
 +
%\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]
 +
 
 +
%%%%
 +
 
 +
\setupbodyfont[JapaneseFont,12pt]
 +
\setupruby[location=top,voffset=-2ex]
 +
\setupwhitespace[big]
 +
\setscript[nihongo]
 +
 
 +
\starttext
 +
\ruby{早}{はや}く。
 +
いきましょう。
 +
\stoptext
 +
</texcode>
  
=Chinese in ConTeXt=
+
=Setup for Chinese=
  
 
Get inspirated with importing Chinese fonts with this [https://github.com/BruXy/ConTeXt-Chinese script].
 
Get inspirated with importing Chinese fonts with this [https://github.com/BruXy/ConTeXt-Chinese script].
Line 17: Line 52:
 
\mainlanguage[cn]
 
\mainlanguage[cn]
 
\language[cn]
 
\language[cn]
\enableregime[utf]
 
 
\setscript[hanzi] % hyphenation
 
\setscript[hanzi] % hyphenation
  
Line 34: Line 68:
 
\setuphead[chapter][command=\ChineseChapter,style={\bf\switchtobodyfont[24pt]}]
 
\setuphead[chapter][command=\ChineseChapter,style={\bf\switchtobodyfont[24pt]}]
 
\setuphead[section][style={\bf\switchtobodyfont[18pt]}]
 
\setuphead[section][style={\bf\switchtobodyfont[18pt]}]
 
  
 
\setuppagenumbering[state=start,
 
\setuppagenumbering[state=start,
Line 63: Line 96:
 
</texcode>
 
</texcode>
  
=Font setup for Korean=
+
=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.
 
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.
  
 
<texcode>
 
<texcode>
 +
% Wolfgang Schuster 2017-12-06
 +
\mainlanguage[kr]
 +
 
\definefallbackfamily [mainface] [rm] [Nanum Myeongjo] [preset=range:korean]
 
\definefallbackfamily [mainface] [rm] [Nanum Myeongjo] [preset=range:korean]
 
\definefontfamily    [mainface] [rm] [DejaVu Serif]
 
\definefontfamily    [mainface] [rm] [DejaVu Serif]
Line 100: Line 134:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
=Outdated=
 +
 +
* 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)
  
 
== See also ==
 
== See also ==

Revision as of 17:36, 28 February 2024

Setup for Japanese

% 2024-02 Otared Kavian, Jeong Dal et al.
\mainlanguage[ja]

\definefontfamily[JapaneseFont][rm][Noto Serif JP]
  [   it={style:regular,features:{*,slanted}},
      sl={style:regular,features:{*,slanted}},
      bi={style:bold,features:{*,slanted}},force=yes]

\definefontfamily[JapaneseFont][ss][Noto Serif JP]
  [   it={style:regular,features:{*,slanted}},
      sl={style:regular,features:{*,slanted}},
      bi={style:bold,features:{*,slanted}},force=yes]

\definefontfamily[JapaneseFont][tt][Noto Serif JP]
  [   it={style:regular,features:{*,slanted}},
      sl={style:regular,features:{*,slanted}},
      bi={style:bold,features:{*,slanted}},force=yes]

\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math]
%\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math]
%\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]

%%%%

\setupbodyfont[JapaneseFont,12pt]
\setupruby[location=top,voffset=-2ex]
\setupwhitespace[big]
\setscript[nihongo]

\starttext
\ruby{}{はや}く。
いきましょう。
\stoptext

Setup for Chinese

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]
\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

Setup for Korean

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.

% Wolfgang Schuster 2017-12-06
\mainlanguage[kr]

\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

Outdated

See also