Difference between revisions of "Chinese Japanese and Korean"

From Wiki
Jump to navigation Jump to search
m (category added)
m (Explanation of the paperSize variable used in lua)
 
(38 intermediate revisions by 15 users not shown)
Line 1: Line 1:
< [[Fonts]] | [[Encodings and Regimes]] >
+
=Setup for Japanese=
  
* 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
+
<texcode>
* manual by Pragma: [http://www.pragma-ade.com/general/manuals/mchinese.pdf Chinese in ConTeXt]
+
% 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]
  
Xiao Jianfeng wrote in a mail to the mailing list on 2005-06-06:
+
\definefontfamily[JapaneseFont][ss][Noto Serif JP]
 +
  [  it={style:regular,features:{*,slanted}},
 +
      sl={style:regular,features:{*,slanted}},
 +
      bi={style:bold,features:{*,slanted}},force=yes]
  
Here is my way of Chinese setup in ConTeXt. I hope this can be of any help to some newbies like me who have problems in processing Chinese.
+
\definefontfamily[JapaneseFont][tt][Noto Serif JP]
 +
  [  it={style:regular,features:{*,slanted}},
 +
      sl={style:regular,features:{*,slanted}},
 +
      bi={style:bold,features:{*,slanted}},force=yes]
  
# Get the truetype fonts <tt>htfs.ttf, hthei.ttf, htkai.ttf</tt> and <tt>htsong.ttf</tt> from ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/
+
\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math]
# Get corresponding tfm files <tt>gbfs.zip, gbhei.zip, gbkai.zip</tt> and <tt>gbsong.zip</tt> from ftp://ftp.ctex.org/pub/tex/fonts/truetype/for_pdftex/tfm/
+
%\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math]
# Get the enc file <tt>Gbk.zip</tt> from ftp://ftp.ctex.org/pub/tex/fonts/truetype/for_pdftex/enc_map/
+
%\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]
# Get the map file <tt>map.zip</tt> from ftp://ftp.ctex.org/pub/tex/fonts/truetype/for_pdftex/enc_map/
+
 
# Put the ttf font files you got in step 1 to <tt>texmf-fonts/fonts/truetype/chinese</tt>
+
%%%%
# Unzip the files you got in step 2 and you get four corresponding directories (which contain tfm files), then put them  in <tt>texmf-fonts/fonts/tfm/chinese</tt>
+
 
# Unzip <tt>Gbk.zip</tt>, you will get a directory named <tt>Gbk</tt> which contains many enc files. Put the directory to <tt>texmf-fonts/fonts/enc/chinese</tt>
+
\setupbodyfont[JapaneseFont,12pt]
# Unzip <tt>map.zip</tt>, you will get many map files, you need just the <tt>gbk.map</tt>. You need to edit <tt>gbk.map</tt>, delete entries of gbli* at the end of the file (lines 505-629). ((sample deleted)). Then, put the modified <tt>gbk.map</tt> to <tt>texmf-fonts/fonts/map/chinese</tt>. Note that newer pdfetex don't read [[pdftex.cfg]] so better use <cmd>loadmapfile[gbk]</cmd> in your document.
+
\setupruby[location=top,voffset=-2ex]
# Your document should be compilable now. ((Attached is a test file from Lutz, so you can test your ConTeXt.))
+
\setupwhitespace[big]
# I haven't tried to compile Traditional Chinese documents. Maybe just get corresponding files for Traditional Chinese and put there to the right location will work. I'm not sure.
+
\setscript[nihongo]
 +
 
 +
\starttext
 +
\ruby{早}{はや}く。
 +
いきましょう。
 +
\stoptext
 +
</texcode>
 +
 
 +
==Meeting the JIS X 4051 Requirements for Japanese Text Layout==
 +
The actual standard was revised in 2004 and the latest version is JIS X 4051:2004. You can read it in Japanese here: https://kikakurui.com/x4/X4051-2004-02.html
 +
 
 +
The W3C technical note "Requirements for Japanese Text Layout", published on 4 June 2009, is based on JIS X 4051. This is also available in English: https://www.w3.org/TR/jlreq/
 +
 
 +
Following code is a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
 +
* solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment
 +
* aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard)
 +
* positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4
 +
* positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24
 +
* inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1
 +
* emphasis with sesame dot or bullet
 +
* itemization https://www.w3.org/TR/jlreq/#fig2_5_6
 +
* indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7
 +
* tab setting https://www.w3.org/TR/jlreq/#fig2_6_1
 +
* furiwake https://www.w3.org/TR/jlreq/#fig2_7_2
 +
* jidori https://www.w3.org/TR/jlreq/#fig2_7_4
 +
* math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62
 +
* tategaki (writing vertically)
 +
 
 +
When you read the lua code in the first <code>\directlua{}</code>, you should realize that the dimensions of almost all layout elements are depending on the value of my lua variable "paperSize".
 +
Thanks to defining the paper size first in lua, I can apply calculations of numeric values.
 +
 
 +
The value of paperSize is later passed on to <code>\setuppapersize</code> via <code>\setuppapersize[\directlua{tex.print(paperSize)}]</code>
 +
 
 +
<texcode>
 +
%Visual Debugging, to be commented out later:
 +
%\showframe %shows the layout elements
 +
%\showgrid %shows the line numbering
 +
%\showmakeup[penalty] %shows characters for which specific breaking line rules apply
 +
%\showmakeup[glyph] %shows the box of each character
 +
 
 +
%Define the elements of Kihon-hanmen.  
 +
%Line length should be multiples of the character size.
 +
%Following dimensions are taken from JIS X 4051, annex 3, cases Y-1 to Y-4. Just change value (A4, A5, B5, B6) for paperSize to switch between the cases.
 +
\directlua{
 +
unit = "pt"
 +
 
 +
paperSize = "B5"
 +
 
 +
characterSizeNumeric = 9
 +
if paperSize == "A4" or paperSize == "A5" or paperSize == "B5" then
 +
  characterSizeNumeric = 9
 +
elseif paperSize == "B6" then
 +
  characterSizeNumeric = 8
 +
end
 +
characterSize = tostring(characterSizeNumeric) .. unit
 +
 
 +
characterCountPerColumn = 25
 +
if paperSize == "A4" then
 +
  characterCountPerColumn = 25
 +
elseif paperSize == "B5" then
 +
  characterCountPerColumn = 22
 +
elseif paperSize == "A5" or paperSize == "B6" then
 +
  characterCountPerColumn = 34
 +
end
 +
 
 +
columnCount = 2
 +
if paperSize == "A4" or paperSize == "B5" then
 +
  columnCount = 2
 +
elseif paperSize == "A5" or paperSize == "B6" then
 +
  columnCount = 1
 +
end
 +
 
 +
lineCount = 46
 +
if paperSize == "A4" then
 +
  lineCount = 46
 +
elseif paperSize == "B5" then
 +
  lineCount = 40
 +
elseif paperSize == "A5" then
 +
  lineCount = 29
 +
elseif paperSize == "B6" then
 +
  lineCount = 27
 +
end
 +
 
 +
lineSpacingNumeric = 6
 +
if paperSize == "A4" or paperSize == "B5" then
 +
  lineSpacingNumeric = 6
 +
elseif paperSize == "A5" or paperSize == "B5" then
 +
  lineSpacingNumeric = 7
 +
end
 +
 
 +
columnGapNumeric = 18
 +
columnGap = tostring(columnGapNumeric) .. unit
 +
 
 +
headerFooterHeightNumeric = characterSizeNumeric
 +
headerFooterHeight = tostring(headerFooterHeightNumeric) .. unit
 +
 
 +
headerFooterDistanceNumeric = characterSizeNumeric
 +
headerFooterDistance = tostring(headerFooterDistanceNumeric) .. unit
 +
 
 +
lineFeedNumeric = characterSizeNumeric + lineSpacingNumeric
 +
lineFeed = tostring(lineFeedNumeric) .. unit
 +
 
 +
lineWidthNumeric = characterSizeNumeric * characterCountPerColumn
 +
 
 +
kihonHanmenWidthNumeric = columnCount * lineWidthNumeric + (columnCount - 1) * columnGapNumeric
 +
kihonHanmenWidth = tostring(kihonHanmenWidthNumeric) .. unit
 +
 
 +
backSpaceNumeric = (597.5079 - kihonHanmenWidthNumeric) / 2
 +
if paperSize == "A4" then
 +
  backSpaceNumeric = (597.5079 - kihonHanmenWidthNumeric) / 2
 +
elseif paperSize == "B5" then
 +
  backSpaceNumeric = (500.7685 - kihonHanmenWidthNumeric) / 2
 +
elseif paperSize == "A5" then
 +
  backSpaceNumeric = (421.1008 - kihonHanmenWidthNumeric) / 2
 +
elseif paperSize == "B6" then
 +
  backSpaceNumeric = (355.6594 - kihonHanmenWidthNumeric) / 2
 +
end
 +
backSpace = tostring(backSpaceNumeric) .. unit
 +
 
 +
kihonHanmenHeightNumeric = lineCount * characterSizeNumeric + (lineCount - 1) * lineSpacingNumeric
 +
kihonHanmenHeight = tostring(kihonHanmenHeightNumeric) .. unit
 +
 
 +
makeUpHeightNumeric = kihonHanmenHeightNumeric + 2 * headerFooterHeightNumeric + 2 * headerFooterDistanceNumeric
 +
makeUpHeight = tostring(makeUpHeightNumeric) .. unit
 +
 
 +
topMarginNumericMm = 29
 +
topMarginNumeric = 2.8346 * topMarginNumericMm
 +
topSpaceNumeric = topMarginNumeric - headerFooterHeightNumeric - headerFooterDistanceNumeric
 +
if paperSize == "A4" then
 +
  topMarginNumericMm = 29
 +
  topMarginNumeric = 2.8346 * topMarginNumericMm
 +
  topSpaceNumeric = topMarginNumeric - headerFooterHeightNumeric - headerFooterDistanceNumeric
 +
elseif paperSize == "B5" then
 +
  topSpaceNumeric = (711.3189 - kihonHanmenHeightNumeric - 2 * (headerFooterDistanceNumeric + headerFooterHeightNumeric))/2
 +
elseif paperSize == "A5" then
 +
  topMarginNumericMm = 25
 +
  topMarginNumeric = 2.8346 * topMarginNumericMm
 +
  topSpaceNumeric = topMarginNumeric - headerFooterHeightNumeric - headerFooterDistanceNumeric
 +
elseif paperSize == "B6" then
 +
  topSpaceNumeric = (500.7685 - kihonHanmenHeightNumeric - 2 * (headerFooterDistanceNumeric + headerFooterHeightNumeric))/2
 +
end
 +
topSpace = tostring(topSpaceNumeric) .. unit
 +
}
 +
 
 +
\setuppapersize[\directlua{tex.print(paperSize)}]
 +
 
 +
\setuppagenumbering
 +
  [alternative=doublesided,
 +
  location=none]
 +
 
 +
\setuphead
 +
  [title,subject]
 +
  [align=middle]
 +
 
 +
\startsetups [header:rightpage]
 +
 
 +
  \startframed [
 +
      frame=off,
 +
      strut=no,
 +
      height=\headerheight,
 +
      offset=none,
 +
      align=low,
 +
      roffset=1em,
 +
  ]
 +
 
 +
    \getmarking[subject]
 +
 
 +
  \stopframed
 +
 
 +
\stopsetups
 +
 
 +
\startsetups [header:leftpage]
 +
 
 +
  \startframed [
 +
      frame=off,
 +
      strut=no,
 +
      height=\headerheight,
 +
      offset=none,
 +
      align=low,
 +
      loffset=1em,
 +
  ]
 +
 
 +
    \getmarking[title]
 +
 
 +
  \stopframed
 +
 
 +
\stopsetups
 +
 
 +
\startsetups [footer:rightpage]
 +
 
 +
  \startframed [
 +
      frame=off,
 +
      strut=no,
 +
      height=\headerheight,
 +
      offset=none,
 +
      align=low,
 +
      roffset=1em,
 +
  ]
 +
 
 +
    \prefixedpagenumber
 +
 
 +
  \stopframed
 +
 
 +
\stopsetups
 +
 
 +
\startsetups [footer:leftpage]
 +
 
 +
  \startframed [
 +
      frame=off,
 +
      strut=no,
 +
      height=\headerheight,
 +
      offset=none,
 +
      align=low,
 +
      loffset=1em,
 +
  ]
 +
 
 +
    \prefixedpagenumber
 +
 
 +
  \stopframed
 +
 
 +
\stopsetups
 +
 
 +
\setupheadertexts
 +
  [] [\directsetup{header:rightpage}]
 +
  [\directsetup{header:leftpage}] []
 +
 
 +
\setupfootertexts
 +
  [] [\directsetup{footer:rightpage}]
 +
  [\directsetup{footer:leftpage}] []
 +
 
 +
\setupheader
 +
  [strut=no]
 +
 
 +
\setupfooter
 +
  [strut=no]
 +
 
 +
\setuplayout[
 +
  topspace=\directlua{tex.print(topSpace)},
 +
  header=\directlua{tex.print(headerFooterHeight)},
 +
  headerdistance=\directlua{tex.print(headerFooterDistance)},
 +
  footer=\directlua{tex.print(headerFooterHeight)},
 +
  footerdistance=\directlua{tex.print(headerFooterDistance)},
 +
  width=\directlua{tex.print(kihonHanmenWidth)},
 +
  height=\directlua{tex.print(makeUpHeight)},
 +
  backspace=\directlua{tex.print(backSpace)},
 +
]
 +
 
 +
 
 +
\definebodyfontenvironment[\directlua{tex.print(characterSize)}]
 +
 
 +
\setupinterlinespace
 +
  [line=\directlua{tex.print(lineFeed)},
 +
  height=0.56, %Necessary for aligning the lines to the Kihon-hanmen. Aligning is still not perfect yet, needs to be improved.
 +
  depth=0.44, %Necessary for aligning the lines to the Kihon-hanmen. Aligning is still not perfect yet, needs to be improved.
 +
  ]
 +
 
 +
\definepagecolumns[mycolumns]
 +
[
 +
  n=\directlua{tex.print(columnCount)},
 +
  distance=\directlua{tex.print(columnGap)},
 +
  %frame=on, %to be commented out later
 +
  framecolor=blue,
 +
  rulethickness=.1pt,
 +
]
 +
 
 +
\definefontfeature [default] [default] [protrusion=pure] %needed for protrusion of full stops and commas.
 +
 
 +
%%% Noto Fonts
 +
 
 +
\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]
 +
 
 +
 
 +
\setupbodyfont[JapaneseFont,\directlua{tex.print(characterSize)}]
 +
\setupalign [hanging] %needed for protrusion of full stops and commas
 +
\setupruby[location=top,voffset=-1.9ex]
 +
\mainlanguage[ja]
 +
\language[ja]
 +
\setscript[nihongo] %this loads the line breaking rules defined under scrp-cjk.lua
 +
 
 +
%\setupruby
 +
%  [style={\switchtobodyfont[6pt]}]
 +
 
 +
%Line head indent at the beginning of paragraphs is applied to all paragraphs. Nearly all books and magazines make use of this method.
 +
\setupindenting[yes, 1em]
 +
 
 +
\starttext
 +
 
 +
\startmycolumns
 +
\starttitle [title={ス位心}]
 +
 
 +
\startsubject [title={ワソ多}]
 +
 
 +
%The text has no meaning and is imitating some Japanese lorum ipsum.
 +
打構セト読役いゆお及層\ruby{僕}{ぼく}はもう大コモクカ軟毎ホアヲト極書た球87本野ぎレべ襲画売ぎ関負ら断紀チラネキ質、紋キタ資私トゃふん。江コキトサ狂毎現ンづ応通サシ続36島性84界ぼゆゃが実書ちぽふず辞躍【事シ世図二ハス盛堀\ruby{早}{はや}く人わレをう第紙きかイの浅69乳キメタ事争つょお\ruby{休}{やす}みなさい社以ヨナム法例やほにル済療にしいむ。子け記多ゅくよ正役モ母憲ト\ruby{寝}{ね}る。ぞ説帝け務賞ク付打ワナ内桁ぼでクフ因倒おふフ印気地レタケマ冬4雇各裁微ひるぼ。
 +
 
 +
事ーやずお両遇ほがお職喜じきちそ経岡ウナオケ型児てきろ置実イハ隊留社びか車斉ムマ数今せぴさし都{聞最へぼう康自コミニク月言ム検代捕ぶねやう。6本うげがぎ無多シワソ多転のづが加分がど臣次オモエヱ務教すそ必組テタレソhello, nice to meet you極渡げフ資聞ぽへトづ禁昔キイウニ食度地ヱ考性ユエ内生ヱセ音94党と経陸咲幼勤りだフ。83男融録ょもな氷社くにルべ害変でおけう変世7超キ減安リヌ株崎5転理済ほだをな黒府 $a+b=b+a$ コワスソ地賢堂衛イぶにし。
 +
 
 +
広げがぴ視立ス位心もスわ止想ツクケラ産竹聞ヌ落38判境ノア賞7写カチ華供ソミワ名認ばゆずほ始色らふひも属対73写けで止突兄呂びの。策イルリヘ行十織キヘ興必む万初ゃづは勝米い館独ム感一チヒナ希8写タムシイ室情づがい焼殺つか広質トクロ毎新ソモ患関済えめね働表め白告こリあ杯困摘屈裂れ。
 +
 
 +
名テホユ稿国む生覧ヨナケヤ文6垣めこル社2市むあし保止転済ノ問判りッ集員セワ全宣コ森領で温子う。ラちぎ夏査せすむ来資ニ面三わぼ際6之減喰杜き。堂ヲ賞了かえー単惑イめ秋投クツ意拡平ヘタヱ時83死れる互武ぽほ拉51届ニネラヘ掲団ヨ度両議ク。状親日値ル断大示ヘニコク米界を連禁イが性正ルッ問句サルユ試片サロヤ前毎到くぜ黄雑らりえ報同ょきむ督晴岡確たごげむ。
 +
 
 +
両おぎゅら写合ル書殖だインぎ孝自氷ばぞひ事権ウノレヲ少止ヲマヨミ惑磁ぞくゅ竹月おやま手51質サム付2仏い職断年にーばざ場現ムワホ襲印講行否えうご。5帰7報ク用講ルのよす媛表サシメマ札変ナヲ案積出ソトマセ決情注モハイ際県らぶドご食績どはあだ徳増フシ断県ぼね了件親億かゆ。申府ホ線全る訪親ケヒネ芸比歳よをづう供記モケ正同とき練1紀ゅくふい割市ざ著法べちめせ客答ヤヌキオ入朗ルヌカス況写天境月郎ろたづ。
 +
 
 +
想ネシモヤ人時ワ化新リぱイこ京希っじ索視ケア風月受マカ東初ぞ月公て無速だ文保か受4香刃尿憎潔だクばづ。果テカ川程イ相安べろ方4映チ米闘ヤタレ会民クをづい治果とルせ字社かイよ新軍こ持芸ワラウケ掲三58治館壌ゃ。行びまむ快野分真タネス応住えじで半記キネト正6者理ぼあ面出ヱシレワ慎首レトアハ託展オ良育圏ーを申傷説ひよもぶ索構を持試奇拝括ぱふ。
 +
 
 +
\stopsubject
 +
 
 +
\startsubject [title={覧ロヨヤ}]
 +
 
 +
写みを参念タ三辞よルさき想3込ぜトリ会図ロ法部じち之杉ぎば厳近ワオコ光傷治ワ整区童熊習本さはリん。一ナカヒハ経松隊整キメケト需湖モユエウ秘千そ含覧ふリさ挙言ねをク凍誉ょい利際ゃぼの織用ユリル育4緊ご選1面とし胃危雪異みのひき。竹品ハ著供うげル、島該ょ城豊ぎすご腹独べじり皆5座わーう化著式サマ木陸ミレノ義軍80鯨ヒキトフ読大フニノネ読覧ロヨヤイ投時ょうす都活きっみざ。
 +
 
 +
上なラ済経ロ有実マ乳装ざなぴま武1守い掲6町ぼ禁28担惑らばんフ社策送案物んまへ。人際クょゃね験伝め念変クマヌ白馳ナツエヤ著側ッごフぞ済川さ趣載ツア挙85適クウネレ稿並ドむわの論棋ナソスヒ教伎締潤革フ。球尊話者が心三いむり達尼スか町過ミタオ上止ワカヤ正着ざぱぎぼ失成行偽ワマヘ北奮く。
 +
 
 +
済開ぼスじと力紹オア手混チコ成意コテモケ定因ド情最どいとづ写今えりめ問景ルオフチ度自す作12行トヱワ録消ひイ。縦右で後賞たじつド諸場後し面詐でばト題社のれふた」。年結すたぜじ下労リえたゅ高作セレテ給5山ワ任共ご京前ミレシ本写午吉活ぽし。播るせ部3席ヒ投揮ぴしんけ安図んき同更展将ごさぽ画9用サキ購21十ツヘト京締乱僕ろ。
 +
 
 +
図ラ象45韓ど考小ヌニ野初ムユイシ河止中ヤトキヒ巻女ッ除稿イ輔余た研弔カ被悪テヘ業購ヘタ詳支ルれ身日だがん出療ずー盛趣なばぐ離女放佳怖れずへ。理じかぐ討15枠制8五袋ヒク選会ソアシカ主手付みとこ猪月メ語経マオヱミ社接フセユア幌財ー香口衆ンろ著瀬なこン身個供悪射窃どスあ。切テセ重購ニホ覧権じゆむげ影文ヒヘ相断66哉ノホテフ黒植くね氏員更あきぱゆ文記ふわひ載更上ぜいひば。
 +
 
 +
打構セト読役いゆお及層\ruby{僕}{ぼく}はもう大コモクカ軟毎ホアヲト極書た球87本野ぎレべ襲画売ぎ関負ら断紀チラネキ質、紋キタ資私トゃふん。江コキトサ狂毎現ンづ応通サシ続36島性84界ぼゆゃが実書ちぽふず辞躍事シ世図二ハス盛堀\ruby{早}{はや}く人わレをう第紙きかイの浅69乳キメタ事争つょお\ruby{休}{やす}みなさい社以ヨナム法例やほにル済療にしいむ。子け記多ゅくよ正役モ母憲ト\ruby{寝}{ね}る。ぞ説帝け務賞ク付打ワナ内桁ぼでクフ因倒おふフ印気地レタケマ冬4雇各裁微ひるぼ。
 +
 
 +
事ーやずお両遇ほがお職喜じきちそ経岡ウナオケ型児てきろ置実イハ隊留社びか車斉ムマ数今せぴさし都聞最へぼう康自コミニク月言ム検代捕ぶねやう。6本うげがぎ無多シワソ多転のづが加分がど臣次オモエヱ務教すそ必組テタレソhello, nice to meet you極渡げフ資聞ぽへトづ禁昔キイウニ食度地ヱ考性ユエ内生ヱセ音94党と経陸咲幼勤りだフ。83男融録ょもな氷社くにルべ害変でおけう変世7超キ減安リヌ株崎5転理済ほだをな黒府コワスソ地賢堂衛イぶにし。
 +
 
 +
広げがぴ視立ス位心もスわ止想ツクケラ産竹聞ヌ落38判境ノア賞7写カチ華供ソミワ名認ばゆずほ始色らふひも属対73写けで止突兄呂びの。策イルリヘ行十織キヘ興必む万初ゃづは勝米い館独ム感一チヒナ希8写タムシイ室情づがい焼殺つか広質トクロ毎新ソモ患関済えめね働表め白告こリあ杯困摘屈裂れ。
 +
 
 +
名テホユ稿国む生覧ヨナケヤ文6垣めこル社2市むあし保止転済ノ問判りッ集員セワ全宣コ森領で温子うラちぎ夏査せすむ来資ニ面三わぼ際6之減喰杜き。堂ヲ賞了かえー単惑イめ秋投クツ意拡平ヘタヱ時83死れる互武ぽほ拉51届ニネラヘ掲団ヨ度両議ク。状親日値ル断大示ヘニコク米界を連禁イが性正ルッ問句サルユ試片サロヤ前毎到くぜ黄雑らりえ報同ょきむ督晴岡確たごげむ。
 +
 
 +
両おぎゅら写合ル書殖だインぎ孝自氷ばぞひ事権ウノレヲ少止ヲマヨミ惑磁ぞくゅ竹月おやま手51質サム付2仏い職断年にーばざ場現ムワホ襲印講行否えうご。5帰7報ク用講ルのよす媛表サシメマ札変ナヲ案積出ソトマセ決情注モハイ際県らぶドご食績どはあだ徳増フシ断県ぼね了件親億かゆ。申府ホ線全る訪親ケヒネ芸比歳よをづう供記モケ正同とき練1紀ゅくふい割市ざ著法べちめせ客答ヤヌキオ入朗ルヌカス況写天境月郎ろたづ。
 +
 
 +
想ネシモヤ人時ワ化新リぱイこ京希っじ索視ケア風月受マカ東初ぞ月公て無速だ文保か受4香刃尿憎潔だクばづ。果テカ川程イ相安べろ方4映チ米闘ヤタレ会民クをづい治果とルせ字社かイよ新軍こ持芸ワラウケ掲三58治館壌ゃ。行びまむ快野分真タネス応住えじで半記キネト正6者理ぼあ面出ヱシレワ慎首レトアハ託展オ良育圏ーを申傷説ひよもぶ索構を持試奇拝括ぱふ。
 +
 
 +
写みを参念タ三辞よルさき想3込ぜトリ会図ロ法部じち之杉ぎば厳近ワオコ光傷治ワ整区童熊習本さはリん。一ナカヒハ経松隊整キメケト需湖モユエウ秘千そ含覧ふリさ挙言ねをク凍誉ょい利際ゃぼの織用ユリル育4緊ご選1面とし胃危雪異みのひき。竹品ハ著供うげル島該ょ城豊ぎすご腹独べじり皆5座わーう化著式サマ木陸ミレノ義軍80鯨ヒキトフ読大フニノネ読覧ロヨヤイ投時ょうす都活きっみざ。
 +
 
 +
\stopsubject
 +
 
 +
\startsubject [title={が心三いむ}]
 +
 
 +
上なラ済経ロ有実マ乳装ざなぴま武1守い掲6町ぼ禁28担惑らばんフ社策送案物んまへ。人際クょゃね験伝め念変クマヌ白馳ナツエヤ著側ッごフぞ済川さ趣載ツア挙85適クウネレ稿並ドむわの論棋ナソスヒ教伎締潤革フ。球尊話者が心三いむり達尼スか町過ミタオ上止ワカヤ正着ざぱぎぼ失成行偽ワマヘ北奮く。
 +
 
 +
済開ぼスじと力紹オア手混チコ成意コテモケ定因ド情最どいとづ写今えりめ問景ルオフチ度自す作12行トヱワ録消ひイ。縦右で後賞たじつド諸場後し面詐でばト題社のれふた」。年結すたぜじ下労リえたゅ高作セレテ給5山ワ任共ご京前ミレシ本写午吉活ぽし。播るせ部3席ヒ投揮ぴしんけ安図んき同更展将ごさぽ画9用サキ購21十ツヘト京締乱僕ろ。
 +
 
 +
図ラ象45韓ど考小ヌニ野初ムユイシ河止中ヤトキヒ巻女ッ除稿イ輔余た研弔カ被悪テヘ業購ヘタ詳支ルれ身日だがん出療ずー盛趣なばぐ離女放佳怖れずへ。理じかぐ討15枠制8五袋ヒク選会ソアシカ主手付みとこ猪月メ語経マオヱミ社接フセユア幌財ー香口衆ンろ著瀬なこン身個供悪射窃どスあ。切テセ重購ニホ覧権じゆむげ影文ヒヘ相断66哉ノホテフ黒植くね氏員更あきぱゆ文記ふわひ載更上ぜいひば。
 +
 
 +
\stopsubject
 +
 
 +
\stoptitle
 +
 
 +
\stopmycolumns
 +
 
 +
 
 +
%\showlayout %for Debugging, to be commented out later
 +
 
 +
\stoptext
 +
</texcode>
 +
 
 +
=Setup for Chinese=
 +
 
 +
Get inspirated with importing Chinese fonts with this [https://github.com/BruXy/ConTeXt-Chinese script].
 +
 
 +
# 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:
 +
 
 +
<texcode>
 +
\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
 +
</texcode>
 +
 
 +
=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 {{cmd|setscript}} command.
 +
 
 +
<texcode>
 +
% 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
 +
</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 ==
 +
* [[CJK fonts]]
  
 
[[Category:Fonts]]
 
[[Category:Fonts]]
[[Category:International]]
+
[[Category:Languages]]

Latest revision as of 07:19, 14 March 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

Meeting the JIS X 4051 Requirements for Japanese Text Layout

The actual standard was revised in 2004 and the latest version is JIS X 4051:2004. You can read it in Japanese here: https://kikakurui.com/x4/X4051-2004-02.html

The W3C technical note "Requirements for Japanese Text Layout", published on 4 June 2009, is based on JIS X 4051. This is also available in English: https://www.w3.org/TR/jlreq/

Following code is a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:

When you read the lua code in the first \directlua{}, you should realize that the dimensions of almost all layout elements are depending on the value of my lua variable "paperSize". Thanks to defining the paper size first in lua, I can apply calculations of numeric values.

The value of paperSize is later passed on to \setuppapersize via \setuppapersize[\directlua{tex.print(paperSize)}]

%Visual Debugging, to be commented out later:
%\showframe %shows the layout elements
%\showgrid %shows the line numbering
%\showmakeup[penalty] %shows characters for which specific breaking line rules apply
%\showmakeup[glyph] %shows the box of each character

%Define the elements of Kihon-hanmen. 
%Line length should be multiples of the character size.
%Following dimensions are taken from JIS X 4051, annex 3, cases Y-1 to Y-4. Just change value (A4, A5, B5, B6) for paperSize to switch between the cases. 
\directlua{
unit = "pt"

paperSize = "B5"

characterSizeNumeric = 9 
if paperSize == "A4" or paperSize == "A5" or paperSize == "B5" then
  characterSizeNumeric = 9
elseif paperSize == "B6" then
  characterSizeNumeric = 8
end
characterSize = tostring(characterSizeNumeric) .. unit

characterCountPerColumn = 25 
if paperSize == "A4" then
  characterCountPerColumn = 25
elseif paperSize == "B5" then
  characterCountPerColumn = 22
elseif paperSize == "A5" or paperSize == "B6" then
  characterCountPerColumn = 34
end

columnCount = 2 
if paperSize == "A4" or paperSize == "B5" then
  columnCount = 2
elseif paperSize == "A5" or paperSize == "B6" then
  columnCount = 1
end

lineCount = 46 
if paperSize == "A4" then
  lineCount = 46
elseif paperSize == "B5" then
  lineCount = 40
elseif paperSize == "A5" then
  lineCount = 29
elseif paperSize == "B6" then
  lineCount = 27
end

lineSpacingNumeric = 6 
if paperSize == "A4" or paperSize == "B5" then
  lineSpacingNumeric = 6
elseif paperSize == "A5" or paperSize == "B5" then
  lineSpacingNumeric = 7
end

columnGapNumeric = 18
columnGap = tostring(columnGapNumeric) .. unit

headerFooterHeightNumeric = characterSizeNumeric
headerFooterHeight = tostring(headerFooterHeightNumeric) .. unit

headerFooterDistanceNumeric = characterSizeNumeric
headerFooterDistance = tostring(headerFooterDistanceNumeric) .. unit

lineFeedNumeric = characterSizeNumeric + lineSpacingNumeric
lineFeed = tostring(lineFeedNumeric) .. unit

lineWidthNumeric = characterSizeNumeric * characterCountPerColumn

kihonHanmenWidthNumeric = columnCount * lineWidthNumeric + (columnCount - 1) * columnGapNumeric
kihonHanmenWidth = tostring(kihonHanmenWidthNumeric) .. unit

backSpaceNumeric = (597.5079 - kihonHanmenWidthNumeric) / 2
if paperSize == "A4" then
  backSpaceNumeric = (597.5079 - kihonHanmenWidthNumeric) / 2
elseif paperSize == "B5" then
  backSpaceNumeric = (500.7685 - kihonHanmenWidthNumeric) / 2
elseif paperSize == "A5" then
  backSpaceNumeric = (421.1008 - kihonHanmenWidthNumeric) / 2
elseif paperSize == "B6" then
  backSpaceNumeric = (355.6594 - kihonHanmenWidthNumeric) / 2
end
backSpace = tostring(backSpaceNumeric) .. unit

kihonHanmenHeightNumeric = lineCount * characterSizeNumeric + (lineCount - 1) * lineSpacingNumeric
kihonHanmenHeight = tostring(kihonHanmenHeightNumeric) .. unit

makeUpHeightNumeric = kihonHanmenHeightNumeric + 2 * headerFooterHeightNumeric + 2 * headerFooterDistanceNumeric
makeUpHeight = tostring(makeUpHeightNumeric) .. unit

topMarginNumericMm = 29
topMarginNumeric = 2.8346 * topMarginNumericMm
topSpaceNumeric = topMarginNumeric - headerFooterHeightNumeric - headerFooterDistanceNumeric
if paperSize == "A4" then
  topMarginNumericMm = 29
  topMarginNumeric = 2.8346 * topMarginNumericMm
  topSpaceNumeric = topMarginNumeric - headerFooterHeightNumeric - headerFooterDistanceNumeric
elseif paperSize == "B5" then
  topSpaceNumeric = (711.3189 - kihonHanmenHeightNumeric - 2 * (headerFooterDistanceNumeric + headerFooterHeightNumeric))/2
elseif paperSize == "A5" then
  topMarginNumericMm = 25
  topMarginNumeric = 2.8346 * topMarginNumericMm
  topSpaceNumeric = topMarginNumeric - headerFooterHeightNumeric - headerFooterDistanceNumeric
elseif paperSize == "B6" then
  topSpaceNumeric = (500.7685 - kihonHanmenHeightNumeric - 2 * (headerFooterDistanceNumeric + headerFooterHeightNumeric))/2
end
topSpace = tostring(topSpaceNumeric) .. unit
}

\setuppapersize[\directlua{tex.print(paperSize)}]

\setuppagenumbering
  [alternative=doublesided,
   location=none]

\setuphead
  [title,subject]
  [align=middle]

\startsetups [header:rightpage]

  \startframed [
      frame=off,
      strut=no,
      height=\headerheight,
      offset=none,
      align=low,
      roffset=1em,
  ]

    \getmarking[subject]

  \stopframed

\stopsetups

\startsetups [header:leftpage]

  \startframed [
      frame=off,
      strut=no,
      height=\headerheight,
      offset=none,
      align=low,
      loffset=1em,
  ]

    \getmarking[title]

  \stopframed

\stopsetups

\startsetups [footer:rightpage]

  \startframed [
      frame=off,
      strut=no,
      height=\headerheight,
      offset=none,
      align=low,
      roffset=1em,
  ]

    \prefixedpagenumber

  \stopframed

\stopsetups

\startsetups [footer:leftpage]

  \startframed [
      frame=off,
      strut=no,
      height=\headerheight,
      offset=none,
      align=low,
      loffset=1em,
  ]

    \prefixedpagenumber

  \stopframed

\stopsetups

\setupheadertexts
  [] [\directsetup{header:rightpage}]
  [\directsetup{header:leftpage}] []

\setupfootertexts
  [] [\directsetup{footer:rightpage}]
  [\directsetup{footer:leftpage}] []

\setupheader
  [strut=no]

\setupfooter
  [strut=no]
  
\setuplayout[
  topspace=\directlua{tex.print(topSpace)},
  header=\directlua{tex.print(headerFooterHeight)},
  headerdistance=\directlua{tex.print(headerFooterDistance)},
  footer=\directlua{tex.print(headerFooterHeight)},
  footerdistance=\directlua{tex.print(headerFooterDistance)},
  width=\directlua{tex.print(kihonHanmenWidth)}, 
  height=\directlua{tex.print(makeUpHeight)}, 
  backspace=\directlua{tex.print(backSpace)}, 
]


\definebodyfontenvironment[\directlua{tex.print(characterSize)}]

\setupinterlinespace
  [line=\directlua{tex.print(lineFeed)},
   height=0.56, %Necessary for aligning the lines to the Kihon-hanmen. Aligning is still not perfect yet, needs to be improved.
   depth=0.44, %Necessary for aligning the lines to the Kihon-hanmen. Aligning is still not perfect yet, needs to be improved.
   ]

\definepagecolumns[mycolumns]
[
  n=\directlua{tex.print(columnCount)}, 
  distance=\directlua{tex.print(columnGap)}, 
  %frame=on, %to be commented out later
  framecolor=blue, 
  rulethickness=.1pt, 
]

\definefontfeature [default] [default] [protrusion=pure] %needed for protrusion of full stops and commas.

%%% Noto Fonts

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


\setupbodyfont[JapaneseFont,\directlua{tex.print(characterSize)}]
\setupalign [hanging] %needed for protrusion of full stops and commas
\setupruby[location=top,voffset=-1.9ex]
\mainlanguage[ja]
\language[ja]
\setscript[nihongo] %this loads the line breaking rules defined under scrp-cjk.lua

%\setupruby
%  [style={\switchtobodyfont[6pt]}]
  
%Line head indent at the beginning of paragraphs is applied to all paragraphs. Nearly all books and magazines make use of this method.
\setupindenting[yes, 1em]

\starttext

\startmycolumns
\starttitle [title={ス位心}] 

\startsubject [title={ワソ多}]

%The text has no meaning and is imitating some Japanese lorum ipsum.
打構セト読役いゆお及層\ruby{}{ぼく}はもう大コモクカ軟毎ホアヲト極書た球87本野ぎレべ襲画売ぎ関負ら断紀チラネキ質、紋キタ資私トゃふん。江コキトサ狂毎現ンづ応通サシ続36島性84界ぼゆゃが実書ちぽふず辞躍【事シ世図二ハス盛堀\ruby{}{はや}く人わレをう第紙きかイの浅69乳キメタ事争つょお\ruby{}{やす}みなさい社以ヨナム法例やほにル済療にしいむ。子け記多ゅくよ正役モ母憲ト\ruby{}{}る。ぞ説帝け務賞ク付打ワナ内桁ぼでクフ因倒おふフ印気地レタケマ冬4雇各裁微ひるぼ。

事ーやずお両遇ほがお職喜じきちそ経岡ウナオケ型児てきろ置実イハ隊留社びか車斉ムマ数今せぴさし都{聞最へぼう康自コミニク月言ム検代捕ぶねやう。6本うげがぎ無多シワソ多転のづが加分がど臣次オモエヱ務教すそ必組テタレソhello, nice to meet you極渡げフ資聞ぽへトづ禁昔キイウニ食度地ヱ考性ユエ内生ヱセ音94党と経陸咲幼勤りだフ。83男融録ょもな氷社くにルべ害変でおけう変世7超キ減安リヌ株崎5転理済ほだをな黒府 $a+b=b+a$ コワスソ地賢堂衛イぶにし。

広げがぴ視立ス位心もスわ止想ツクケラ産竹聞ヌ落38判境ノア賞7写カチ華供ソミワ名認ばゆずほ始色らふひも属対73写けで止突兄呂びの。策イルリヘ行十織キヘ興必む万初ゃづは勝米い館独ム感一チヒナ希8写タムシイ室情づがい焼殺つか広質トクロ毎新ソモ患関済えめね働表め白告こリあ杯困摘屈裂れ。

名テホユ稿国む生覧ヨナケヤ文6垣めこル社2市むあし保止転済ノ問判りッ集員セワ全宣コ森領で温子う。ラちぎ夏査せすむ来資ニ面三わぼ際6之減喰杜き。堂ヲ賞了かえー単惑イめ秋投クツ意拡平ヘタヱ時83死れる互武ぽほ拉51届ニネラヘ掲団ヨ度両議ク。状親日値ル断大示ヘニコク米界を連禁イが性正ルッ問句サルユ試片サロヤ前毎到くぜ黄雑らりえ報同ょきむ督晴岡確たごげむ。

両おぎゅら写合ル書殖だインぎ孝自氷ばぞひ事権ウノレヲ少止ヲマヨミ惑磁ぞくゅ竹月おやま手51質サム付2仏い職断年にーばざ場現ムワホ襲印講行否えうご。5帰7報ク用講ルのよす媛表サシメマ札変ナヲ案積出ソトマセ決情注モハイ際県らぶドご食績どはあだ徳増フシ断県ぼね了件親億かゆ。申府ホ線全る訪親ケヒネ芸比歳よをづう供記モケ正同とき練1紀ゅくふい割市ざ著法べちめせ客答ヤヌキオ入朗ルヌカス況写天境月郎ろたづ。

想ネシモヤ人時ワ化新リぱイこ京希っじ索視ケア風月受マカ東初ぞ月公て無速だ文保か受4香刃尿憎潔だクばづ。果テカ川程イ相安べろ方4映チ米闘ヤタレ会民クをづい治果とルせ字社かイよ新軍こ持芸ワラウケ掲三58治館壌ゃ。行びまむ快野分真タネス応住えじで半記キネト正6者理ぼあ面出ヱシレワ慎首レトアハ託展オ良育圏ーを申傷説ひよもぶ索構を持試奇拝括ぱふ。

\stopsubject

\startsubject [title={覧ロヨヤ}]

写みを参念タ三辞よルさき想3込ぜトリ会図ロ法部じち之杉ぎば厳近ワオコ光傷治ワ整区童熊習本さはリん。一ナカヒハ経松隊整キメケト需湖モユエウ秘千そ含覧ふリさ挙言ねをク凍誉ょい利際ゃぼの織用ユリル育4緊ご選1面とし胃危雪異みのひき。竹品ハ著供うげル、島該ょ城豊ぎすご腹独べじり皆5座わーう化著式サマ木陸ミレノ義軍80鯨ヒキトフ読大フニノネ読覧ロヨヤイ投時ょうす都活きっみざ。

上なラ済経ロ有実マ乳装ざなぴま武1守い掲6町ぼ禁28担惑らばんフ社策送案物んまへ。人際クょゃね験伝め念変クマヌ白馳ナツエヤ著側ッごフぞ済川さ趣載ツア挙85適クウネレ稿並ドむわの論棋ナソスヒ教伎締潤革フ。球尊話者が心三いむり達尼スか町過ミタオ上止ワカヤ正着ざぱぎぼ失成行偽ワマヘ北奮く。

済開ぼスじと力紹オア手混チコ成意コテモケ定因ド情最どいとづ写今えりめ問景ルオフチ度自す作12行トヱワ録消ひイ。縦右で後賞たじつド諸場後し面詐でばト題社のれふた」。年結すたぜじ下労リえたゅ高作セレテ給5山ワ任共ご京前ミレシ本写午吉活ぽし。播るせ部3席ヒ投揮ぴしんけ安図んき同更展将ごさぽ画9用サキ購21十ツヘト京締乱僕ろ。

図ラ象45韓ど考小ヌニ野初ムユイシ河止中ヤトキヒ巻女ッ除稿イ輔余た研弔カ被悪テヘ業購ヘタ詳支ルれ身日だがん出療ずー盛趣なばぐ離女放佳怖れずへ。理じかぐ討15枠制8五袋ヒク選会ソアシカ主手付みとこ猪月メ語経マオヱミ社接フセユア幌財ー香口衆ンろ著瀬なこン身個供悪射窃どスあ。切テセ重購ニホ覧権じゆむげ影文ヒヘ相断66哉ノホテフ黒植くね氏員更あきぱゆ文記ふわひ載更上ぜいひば。

打構セト読役いゆお及層\ruby{}{ぼく}はもう大コモクカ軟毎ホアヲト極書た球87本野ぎレべ襲画売ぎ関負ら断紀チラネキ質、紋キタ資私トゃふん。江コキトサ狂毎現ンづ応通サシ続36島性84界ぼゆゃが実書ちぽふず辞躍事シ世図二ハス盛堀\ruby{}{はや}く人わレをう第紙きかイの浅69乳キメタ事争つょお\ruby{}{やす}みなさい社以ヨナム法例やほにル済療にしいむ。子け記多ゅくよ正役モ母憲ト\ruby{}{}る。ぞ説帝け務賞ク付打ワナ内桁ぼでクフ因倒おふフ印気地レタケマ冬4雇各裁微ひるぼ。

事ーやずお両遇ほがお職喜じきちそ経岡ウナオケ型児てきろ置実イハ隊留社びか車斉ムマ数今せぴさし都聞最へぼう康自コミニク月言ム検代捕ぶねやう。6本うげがぎ無多シワソ多転のづが加分がど臣次オモエヱ務教すそ必組テタレソhello, nice to meet you極渡げフ資聞ぽへトづ禁昔キイウニ食度地ヱ考性ユエ内生ヱセ音94党と経陸咲幼勤りだフ。83男融録ょもな氷社くにルべ害変でおけう変世7超キ減安リヌ株崎5転理済ほだをな黒府コワスソ地賢堂衛イぶにし。

広げがぴ視立ス位心もスわ止想ツクケラ産竹聞ヌ落38判境ノア賞7写カチ華供ソミワ名認ばゆずほ始色らふひも属対73写けで止突兄呂びの。策イルリヘ行十織キヘ興必む万初ゃづは勝米い館独ム感一チヒナ希8写タムシイ室情づがい焼殺つか広質トクロ毎新ソモ患関済えめね働表め白告こリあ杯困摘屈裂れ。

名テホユ稿国む生覧ヨナケヤ文6垣めこル社2市むあし保止転済ノ問判りッ集員セワ全宣コ森領で温子うラちぎ夏査せすむ来資ニ面三わぼ際6之減喰杜き。堂ヲ賞了かえー単惑イめ秋投クツ意拡平ヘタヱ時83死れる互武ぽほ拉51届ニネラヘ掲団ヨ度両議ク。状親日値ル断大示ヘニコク米界を連禁イが性正ルッ問句サルユ試片サロヤ前毎到くぜ黄雑らりえ報同ょきむ督晴岡確たごげむ。

両おぎゅら写合ル書殖だインぎ孝自氷ばぞひ事権ウノレヲ少止ヲマヨミ惑磁ぞくゅ竹月おやま手51質サム付2仏い職断年にーばざ場現ムワホ襲印講行否えうご。5帰7報ク用講ルのよす媛表サシメマ札変ナヲ案積出ソトマセ決情注モハイ際県らぶドご食績どはあだ徳増フシ断県ぼね了件親億かゆ。申府ホ線全る訪親ケヒネ芸比歳よをづう供記モケ正同とき練1紀ゅくふい割市ざ著法べちめせ客答ヤヌキオ入朗ルヌカス況写天境月郎ろたづ。

想ネシモヤ人時ワ化新リぱイこ京希っじ索視ケア風月受マカ東初ぞ月公て無速だ文保か受4香刃尿憎潔だクばづ。果テカ川程イ相安べろ方4映チ米闘ヤタレ会民クをづい治果とルせ字社かイよ新軍こ持芸ワラウケ掲三58治館壌ゃ。行びまむ快野分真タネス応住えじで半記キネト正6者理ぼあ面出ヱシレワ慎首レトアハ託展オ良育圏ーを申傷説ひよもぶ索構を持試奇拝括ぱふ。

写みを参念タ三辞よルさき想3込ぜトリ会図ロ法部じち之杉ぎば厳近ワオコ光傷治ワ整区童熊習本さはリん。一ナカヒハ経松隊整キメケト需湖モユエウ秘千そ含覧ふリさ挙言ねをク凍誉ょい利際ゃぼの織用ユリル育4緊ご選1面とし胃危雪異みのひき。竹品ハ著供うげル島該ょ城豊ぎすご腹独べじり皆5座わーう化著式サマ木陸ミレノ義軍80鯨ヒキトフ読大フニノネ読覧ロヨヤイ投時ょうす都活きっみざ。

\stopsubject

\startsubject [title={が心三いむ}]

上なラ済経ロ有実マ乳装ざなぴま武1守い掲6町ぼ禁28担惑らばんフ社策送案物んまへ。人際クょゃね験伝め念変クマヌ白馳ナツエヤ著側ッごフぞ済川さ趣載ツア挙85適クウネレ稿並ドむわの論棋ナソスヒ教伎締潤革フ。球尊話者が心三いむり達尼スか町過ミタオ上止ワカヤ正着ざぱぎぼ失成行偽ワマヘ北奮く。

済開ぼスじと力紹オア手混チコ成意コテモケ定因ド情最どいとづ写今えりめ問景ルオフチ度自す作12行トヱワ録消ひイ。縦右で後賞たじつド諸場後し面詐でばト題社のれふた」。年結すたぜじ下労リえたゅ高作セレテ給5山ワ任共ご京前ミレシ本写午吉活ぽし。播るせ部3席ヒ投揮ぴしんけ安図んき同更展将ごさぽ画9用サキ購21十ツヘト京締乱僕ろ。

図ラ象45韓ど考小ヌニ野初ムユイシ河止中ヤトキヒ巻女ッ除稿イ輔余た研弔カ被悪テヘ業購ヘタ詳支ルれ身日だがん出療ずー盛趣なばぐ離女放佳怖れずへ。理じかぐ討15枠制8五袋ヒク選会ソアシカ主手付みとこ猪月メ語経マオヱミ社接フセユア幌財ー香口衆ンろ著瀬なこン身個供悪射窃どスあ。切テセ重購ニホ覧権じゆむげ影文ヒヘ相断66哉ノホテフ黒植くね氏員更あきぱゆ文記ふわひ載更上ぜいひば。

\stopsubject

\stoptitle

\stopmycolumns


%\showlayout %for Debugging, to be commented out later

\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