Debian Codegraph @

texmf-dist/tex/xetex/xetexko/xetexko.sty

raw
1 % xetexko.sty
2 %
3 % Copyright (c) 2013-2025 Dohyun Kim <nomosnomos at gmail com>
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3c
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX
11 % version 2006/05/20 or later.
12
13 \ifdefined\XeKocatcodeofATchar\endinput\fi
14 \edef\XeKocatcodeofATchar{\catcode`@=\the\catcode`@\relax}
15 \catcode`@=11
16
17 \ifdefined\ProvidesPackage
18 \NeedsTeXFormat{LaTeX2e}[2025/06/01]
19 \ProvidesPackage{xetexko}[2025/08/24 v4.6 typesetting Korean with XeTeX]
20 \else
21 \ifdefined\@tempcnta\else \newcount\@tempcnta \fi
22 \ifdefined\@sptoken \else
23 \begingroup\def\:{\global\let\@sptoken= } \: \endgroup
24 \fi
25 \fi
26
27 \chardef\XeTeXcharclassBoundary=4095
28 \chardef\XeTeXcharclassIgnore =4096
29
30 \newXeTeXintercharclass\XeTeXcharclassID
31 \newXeTeXintercharclass\XeTeXcharclassCJ
32 \newXeTeXintercharclass\XeTeXcharclassOP
33 \newXeTeXintercharclass\XeTeXcharclassCL
34 \newXeTeXintercharclass\XeTeXcharclassEX
35 \let\XeTeXcharclassIS\XeTeXcharclassCJ
36 \let\XeTeXcharclassNS\XeTeXcharclassCJ
37 \newXeTeXintercharclass\XeTeXcharclassCM
38 \input load-unicode-xetex-classes %
39
40 \newXeTeXintercharclass\XeTeXcharclassHG
41 \newXeTeXintercharclass\XeTeXcharclassJJ % hangul MV and TC
42 \newXeTeXintercharclass\XeTeXcharclassMD % ・ : ;
43 \newXeTeXintercharclass\XeTeXcharclassFS % 。 .
44 \newXeTeXintercharclass\XeTeXcharclassLD % ― … ‥
45 \newXeTeXintercharclass\XeTeXcharclassSY % KS symbols
46 \newXeTeXintercharclass\XeTeXcharclassAO % ascii ( `` etc
47 \newXeTeXintercharclass\XeTeXcharclassAC % ascii ) '' etc
48 \newXeTeXintercharclass\XeTeXcharclassAM % ascii colons
49 \newXeTeXintercharclass\XeTeXcharclassAH % ascii hyphen and its ligatures
50 \newXeTeXintercharclass\XeTeXcharclassAP % ascii punctuations
51 \newXeTeXintercharclass\XeTeXcharclassVC % colons in vertical writing
52 \let\XeTeXcharclassAA=\z@ % other non-cjk chars
53
54 % more CM
55 \count@"FE00 \loop
56 \XeTeXcharclass\count@=\XeTeXcharclassCM
57 \ifnum\count@<"FE0F \advance\count@\@ne \repeat
58 \count@"E0100 \loop
59 \XeTeXcharclass\count@=\XeTeXcharclassCM
60 \ifnum\count@<"E01EF \advance\count@\@ne \repeat
61
62 % hangul
63 \count@="AC00 \loop
64 \catcode\count@=12 % for josa
65 \XeTeXcharclass\count@=\XeTeXcharclassHG
66 \ifnum\count@<"D7A3 \advance\count@\@ne \repeat
67 \count@="1100 \loop
68 \XeTeXcharclass\count@=\XeTeXcharclassHG
69 \ifnum\count@<"115F \advance\count@\@ne \repeat
70 \count@="A960 \loop
71 \XeTeXcharclass\count@=\XeTeXcharclassHG
72 \ifnum\count@<"A97C \advance\count@\@ne \repeat
73 \count@="3131 \loop
74 \XeTeXcharclass\count@=\XeTeXcharclassHG
75 \ifnum\count@<"318E \advance\count@\@ne \repeat
76 % hangul MV and TC
77 \count@="1160 \loop
78 \XeTeXcharclass\count@=\XeTeXcharclassJJ
79 \ifnum\count@<"11FF \advance\count@\@ne \repeat
80 \count@="D7B0 \loop
81 \XeTeXcharclass\count@=\XeTeXcharclassJJ
82 \ifnum\count@<"D7FB \advance\count@\@ne \repeat
83
84 % ascii opening
85 \XeTeXcharclass "28=\XeTeXcharclassAO % ( LEFT PARENTHESIS
86 \XeTeXcharclass "3C=\XeTeXcharclassAO % < LESS-THAN SIGN
87 \XeTeXcharclass "5B=\XeTeXcharclassAO % [ LEFT SQUARE BRACKET
88 \XeTeXcharclass "60=\XeTeXcharclassAO % ` GRAVE ACCENT
89 \XeTeXcharclass "7B=\XeTeXcharclassAO % { LEFT CURLY BRACKET
90 \XeTeXcharclass "AB=\XeTeXcharclassAO % « LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
91 % ascii closing
92 \XeTeXcharclass "27=\XeTeXcharclassAC % ' APOSTROPHE
93 \XeTeXcharclass "29=\XeTeXcharclassAC % ) RIGHT PARENTHESIS
94 \XeTeXcharclass "3E=\XeTeXcharclassAC % > GREATER-THAN SIGN
95 \XeTeXcharclass "5D=\XeTeXcharclassAC % ] RIGHT SQUARE BRACKET
96 \XeTeXcharclass "7D=\XeTeXcharclassAC % } RIGHT CURLY BRACKET
97 \XeTeXcharclass "BB=\XeTeXcharclassAC % » RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
98 % ascii colons
99 \XeTeXcharclass "3A=\XeTeXcharclassAM % : COLON
100 \XeTeXcharclass "3B=\XeTeXcharclassAM % ; SEMICOLON
101 \XeTeXcharclass "7E=\XeTeXcharclassAM % ~ TILDE
102 % ascii hyphen
103 \XeTeXcharclass "2D =\XeTeXcharclassAH % -
104 \XeTeXcharclass "2F =\XeTeXcharclassAH % /
105 \XeTeXcharclass "2013=\XeTeXcharclassAH % –
106 \XeTeXcharclass "2014=\XeTeXcharclassAH % —
107 % ascii punctuations
108 \XeTeXcharclass "21=\XeTeXcharclassAP % ! EXCLAMATION MARK
109 \XeTeXcharclass "2C=\XeTeXcharclassAP % , COMMA
110 \XeTeXcharclass "2E=\XeTeXcharclassAP % . FULL STOP
111 \XeTeXcharclass "3F=\XeTeXcharclassAP % ? QUESTION MARK
112 %
113 \XeTeXcharclass "2018=\XeTeXcharclassOP % ‘ LEFT SINGLE QUOTATION MARK
114 \XeTeXcharclass "201C=\XeTeXcharclassOP % “ LEFT DOUBLE QUOTATION MARK
115 %
116 \XeTeXcharclass "2019=\XeTeXcharclassCL % ’ RIGHT SINGLE QUOTATION MARK
117 \XeTeXcharclass "201D=\XeTeXcharclassCL % ” RIGHT DOUBLE QUOTATION MARK
118 % IS : these are not expected to be input
119 \XeTeXcharclass "FE10=\XeTeXcharclassCL % ︐ PRESENTATION FORM FOR VERTICAL COMMA
120 \XeTeXcharclass "FE13=\XeTeXcharclassVC % ︓ PRESENTATION FORM FOR VERTICAL COLON
121 \XeTeXcharclass "FE14=\XeTeXcharclassVC % ︔ PRESENTATION FORM FOR VERTICAL SEMICOLON
122 % NS
123 \XeTeXcharclass "00B7=\XeTeXcharclassMD % · MIDDLE DOT
124 \XeTeXcharclass "30FB=\XeTeXcharclassMD % ・ KATAKANA MIDDLE DOT
125 \XeTeXcharclass "FE54=\XeTeXcharclassMD % ﹔ SMALL SEMICOLON
126 \XeTeXcharclass "FE55=\XeTeXcharclassMD % ﹕ SMALL COLON
127 \XeTeXcharclass "FF1A=\XeTeXcharclassMD % : FULLWIDTH COLON
128 \XeTeXcharclass "FF1B=\XeTeXcharclassMD % ; FULLWIDTH SEMICOLON
129 \XeTeXcharclass "FF65=\XeTeXcharclassMD % ・ HALFWIDTH KATAKANA MIDDLE DOT
130 %
131 \XeTeXcharclass "3002=\XeTeXcharclassFS % 。 IDEOGRAPHIC FULL STOP
132 \XeTeXcharclass "FE12=\XeTeXcharclassFS % ︒ PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP
133 \XeTeXcharclass "FE52=\XeTeXcharclassFS % ﹒ SMALL FULL STOP
134 \XeTeXcharclass "FF0E=\XeTeXcharclassFS % . FULLWIDTH FULL STOP
135 \XeTeXcharclass "FF61=\XeTeXcharclassFS % 。 HALFWIDTH IDEOGRAPHIC FULL STOP
136 %
137 \XeTeXcharclass "2015=\XeTeXcharclassLD % ― HORIZONTAL BAR
138 \XeTeXcharclass "2025=\XeTeXcharclassLD % ‥ TWO DOT LEADER
139 \XeTeXcharclass "2026=\XeTeXcharclassLD % … HORIZONTAL ELLIPSIS
140 \XeTeXcharclass "3003=\XeTeXcharclassLD % 〃 DITTO MARK : KS symbol
141 % 결락기호
142 \XeTeXcharclass "25A1=\XeTeXcharclassID % □
143 % some KS symbols
144 \XeTeXcharclass "2032=\XeTeXcharclassSY % ′
145 \XeTeXcharclass "2033=\XeTeXcharclassSY % ″
146 \XeTeXcharclass "203B=\XeTeXcharclassSY % ※
147 \XeTeXcharclass "2103=\XeTeXcharclassSY % ℃
148 \XeTeXcharclass "2109=\XeTeXcharclassSY % ℉
149 \XeTeXcharclass "2113=\XeTeXcharclassSY % ℓ
150 \XeTeXcharclass "2121=\XeTeXcharclassSY % ℡
151 \count@="2160 \loop % Ⅰ..Ⅹ
152 \XeTeXcharclass\count@=\XeTeXcharclassSY
153 \ifnum\count@<"2169 \advance\count@\@ne \repeat
154 \count@="2170 \loop % ⅰ..ⅹ
155 \XeTeXcharclass\count@=\XeTeXcharclassSY
156 \ifnum\count@<"2179 \advance\count@\@ne \repeat
157 \count@="2190 \loop % ←..↙
158 \XeTeXcharclass\count@=\XeTeXcharclassSY
159 \ifnum\count@<"2199 \advance\count@\@ne \repeat
160 \XeTeXcharclass "21D2=\XeTeXcharclassSY % ⇒
161 \XeTeXcharclass "21D4=\XeTeXcharclassSY % ⇔
162 \XeTeXcharclass "2225=\XeTeXcharclassSY % ∥
163 \XeTeXcharclass "223C=\XeTeXcharclassSY % ∼ TILDE OPERATOR
164 \XeTeXcharclass "226A=\XeTeXcharclassSY % ≪ 꽉찬 전각! 어디에 배정해야 하나?
165 \XeTeXcharclass "226B=\XeTeXcharclassSY % ≫ 꽉찬 전각! 어디에 배정해야 하나?
166 \XeTeXcharclass "2299=\XeTeXcharclassSY % ⊙
167 \count@="2460 \loop % ①..⑮
168 \XeTeXcharclass\count@=\XeTeXcharclassSY
169 \ifnum\count@<"246E \advance\count@\@ne \repeat
170 \count@="2474 \loop % ⑴..⒂
171 \XeTeXcharclass\count@=\XeTeXcharclassSY
172 \ifnum\count@<"2482 \advance\count@\@ne \repeat
173 \count@="249C \loop % ⒜..⒵
174 \XeTeXcharclass\count@=\XeTeXcharclassSY
175 \ifnum\count@<"24B5 \advance\count@\@ne \repeat
176 \count@="24D0 \loop % ⓐ..ⓩ
177 \XeTeXcharclass\count@=\XeTeXcharclassSY
178 \ifnum\count@<"24E9 \advance\count@\@ne \repeat
179 \XeTeXcharclass "2500 = \XeTeXcharclassSY % ─
180 \XeTeXcharclass "2501 = \XeTeXcharclassSY % ━
181 \XeTeXcharclass "2502 = \XeTeXcharclassSY % │
182 \XeTeXcharclass "2503 = \XeTeXcharclassSY % ┃
183 \count@="250C \loop % ─..╋
184 \XeTeXcharclass\count@=\XeTeXcharclassSY
185 \ifnum\count@<"254B \advance\count@\@ne \repeat
186 \XeTeXcharclass "2592 = \XeTeXcharclassSY % ▒
187 \XeTeXcharclass "25A0 = \XeTeXcharclassSY % ■
188 \XeTeXcharclass "25A3 = \XeTeXcharclassSY % ▣
189 \XeTeXcharclass "25A4 = \XeTeXcharclassSY % ▤
190 \XeTeXcharclass "25A5 = \XeTeXcharclassSY % ▥
191 \XeTeXcharclass "25A6 = \XeTeXcharclassSY % ▦
192 \XeTeXcharclass "25A7 = \XeTeXcharclassSY % ▧
193 \XeTeXcharclass "25A8 = \XeTeXcharclassSY % ▨
194 \XeTeXcharclass "25A9 = \XeTeXcharclassSY % ▩
195 \XeTeXcharclass "25B2 = \XeTeXcharclassSY % ▲
196 \XeTeXcharclass "25B3 = \XeTeXcharclassSY % △
197 \XeTeXcharclass "25B6 = \XeTeXcharclassSY % ▶
198 \XeTeXcharclass "25B7 = \XeTeXcharclassSY % ▷
199 \XeTeXcharclass "25BC = \XeTeXcharclassSY % ▼
200 \XeTeXcharclass "25BD = \XeTeXcharclassSY % ▽
201 \XeTeXcharclass "25C0 = \XeTeXcharclassSY % ◀
202 \XeTeXcharclass "25C1 = \XeTeXcharclassSY % ◁
203 \XeTeXcharclass "25C6 = \XeTeXcharclassSY % ◆
204 \XeTeXcharclass "25C7 = \XeTeXcharclassSY % ◇
205 \XeTeXcharclass "25C8 = \XeTeXcharclassSY % ◈
206 \XeTeXcharclass "25CB = \XeTeXcharclassSY % ○
207 \XeTeXcharclass "25CE = \XeTeXcharclassSY % ◎
208 \XeTeXcharclass "25CF = \XeTeXcharclassSY % ●
209 \XeTeXcharclass "25D0 = \XeTeXcharclassSY % ◐
210 \XeTeXcharclass "25D1 = \XeTeXcharclassSY % ◑
211 \XeTeXcharclass "2605 = \XeTeXcharclassSY % ★
212 \XeTeXcharclass "2606 = \XeTeXcharclassSY % ☆
213 \XeTeXcharclass "260E = \XeTeXcharclassSY % ☎
214 \XeTeXcharclass "260F = \XeTeXcharclassSY % ☏
215 \XeTeXcharclass "261C = \XeTeXcharclassSY % ☜
216 \XeTeXcharclass "261E = \XeTeXcharclassSY % ☞
217 \XeTeXcharclass "2640 = \XeTeXcharclassSY % ♀
218 \XeTeXcharclass "2642 = \XeTeXcharclassSY % ♂
219 \XeTeXcharclass "2660 = \XeTeXcharclassSY % ♠
220 \XeTeXcharclass "2661 = \XeTeXcharclassSY % ♡
221 \XeTeXcharclass "2663 = \XeTeXcharclassSY % ♣
222 \XeTeXcharclass "2664 = \XeTeXcharclassSY % ♤
223 \XeTeXcharclass "2665 = \XeTeXcharclassSY % ♥
224 \XeTeXcharclass "2667 = \XeTeXcharclassSY % ♧
225 \XeTeXcharclass "2668 = \XeTeXcharclassSY % ♨
226 \XeTeXcharclass "2669 = \XeTeXcharclassSY % ♩
227 \XeTeXcharclass "266A = \XeTeXcharclassSY % ♪
228 \XeTeXcharclass "266C = \XeTeXcharclassSY % ♬
229 \XeTeXcharclass "266D = \XeTeXcharclassSY % ♭
230 \XeTeXcharclass "3000 = \XeTeXcharclassSY %  
231 \XeTeXcharclass "3013 = \XeTeXcharclassSY % 〓
232 \count@="3200 \loop % ㈀..㈞
233 \XeTeXcharclass\count@=\XeTeXcharclassSY
234 \ifnum\count@<"321E \advance\count@\@ne \repeat
235 \count@="3260 \loop % ㉠..㉿
236 \XeTeXcharclass\count@=\XeTeXcharclassSY
237 \ifnum\count@<"327F \advance\count@\@ne \repeat
238 \XeTeXcharclass "33C2 = \XeTeXcharclassSY % ㏂
239 \XeTeXcharclass "33C7 = \XeTeXcharclassSY % ㏇
240 \XeTeXcharclass "33D8 = \XeTeXcharclassSY % ㏘
241 \XeTeXcharclass "FF04 = \XeTeXcharclassSY % $
242 \XeTeXcharclass "FF05 = \XeTeXcharclassSY % %
243 \XeTeXcharclass "FF3C = \XeTeXcharclassSY % \
244 \XeTeXcharclass "FF5E = \XeTeXcharclassSY % ~ FULLWIDTH TILDE : KS symbol
245 \XeTeXcharclass "FFE0 = \XeTeXcharclassSY % ¢
246 \XeTeXcharclass "FFE1 = \XeTeXcharclassSY % £
247 \XeTeXcharclass "FFE5 = \XeTeXcharclassSY % ¥
248 \XeTeXcharclass "FFE6 = \XeTeXcharclassSY % ₩
249
250 % spaces
251 \def\XeKo@halfzero {\hskip 2\XeKo@quarterdim \relax}
252 \def\XeKo@halfhalf {\hskip 2\XeKo@quarterdim minus 2\XeKo@quarterdim \relax}
253 \def\XeKo@halfquarter {\hskip 2\XeKo@quarterdim minus \XeKo@quarterdim \relax}
254 \def\XeKo@quarterquarter {\hskip \XeKo@quarterdim minus \XeKo@quarterdim \relax}
255 \def\XeKo@iiiquarterquarter{\hskip 3\XeKo@quarterdim minus \XeKo@quarterdim \relax}
256 \let\XeKo@nobreak\nobreak
257
258 \def\XKinterhangulbreak{% compat
259 \ifnum\XeKo@typesetclassic=\z@
260 \penalty\XeTeXlinebreakpenalty
261 \fi
262 \hskip
263 \ifdefined\xetexkointerhchar \xetexkointerhchar \else \z@ \fi
264 \XeKo@stretchshrink
265 }
266 \def\XKinterhanjabreak{% compat
267 \ifnum\XeKo@typesetclassic=\z@
268 \penalty\XeTeXlinebreakpenalty
269 \fi
270 \hskip\z@ \XeKo@stretchshrink
271 }
272
273 \def\XeKo@latincjk@classic{%
274 \hskip
275 \ifdefined\xetexkohu
276 \xetexkohu plus .5\dimexpr\xetexkohu\relax minus.25\dimexpr\xetexkohu\relax
277 \else
278 \XeKo@quarterdim plus .5\XeKo@quarterdim minus.25\XeKo@quarterdim
279 \fi
280 \relax
281 }
282 \def\XeKo@latincjk@modern{%
283 \hskip \ifdefined\xetexkohu \xetexkohu \else \XeKo@quarterdim \fi
284 \XeKo@stretchshrink
285 }
286 \def\XeKo@postmath@modern{%
287 \hskip 2\ifdefined\xetexkohu \dimexpr\xetexkohu\relax \else \XeKo@quarterdim \fi
288 \XeKo@stretchshrink
289 }
290
291 % 고아글자 억제. verbatim 에서는 이 명령을 꺼야 한다
292 \def\XeKo@suppress@linebreak{%
293 \ifnum\lastnodetype=11 % glue node
294 \XeKo@skip@=\lastskip \unskip
295 \XeKo@count@=\lastpenalty \unpenalty
296 \ifnum\XeKo@count@<5000 \XeKo@count@=5000 \fi
297 \penalty\XeKo@count@
298 \hskip\XeKo@skip@
299 \fi
300 }
301
302 \protected\def\inhibitglue{\hskip\z@\XeKo@stretchshrink}
303
304 % typesetting modes
305 \protected\def\typesetclassic{%
306 \chardef\XeKo@typesetclassic\@ne
307 \def\XeKo@quarterdim{\dimexpr.25em\relax}%
308 \ifdefined\XeKo@stretch@shrink
309 \let\XeKo@stretchshrink\XeKo@stretch@shrink
310 \else
311 \def\XeKo@stretchshrink{plus.08em minus.04em\relax}%
312 \fi
313 \let\XeKo@latincjk\XeKo@latincjk@classic
314 \let\XeKo@postmath\XeKo@latincjk@classic
315 \XeTeXlinebreakpenalty=\z@
316 \XeTeXlinebreakskip=\z@ \XeKo@stretchshrink
317 \parindent=1em
318 }
319 \protected\def\typesetmodern{%
320 \chardef\XeKo@typesetclassic\z@
321 \def\XeKo@quarterdim{\dimexpr.05em\relax}%
322 \ifdefined\XeKo@stretch@shrink
323 \let\XeKo@stretchshrink\XeKo@stretch@shrink
324 \else
325 \def\XeKo@stretchshrink{plus.04em minus.02em\relax}%
326 \fi
327 \let\XeKo@latincjk\XeKo@latincjk@modern
328 \let\XeKo@postmath\XeKo@postmath@modern
329 \XeTeXlinebreakpenalty=50
330 \XeTeXlinebreakskip=\z@ \XeKo@stretchshrink
331 }
332 \typesetmodern
333 % xetexkostretchshrink
334 \protected\def\xetexkostretchshrink#1{%
335 \def\XeKo@stretchshrink{#1\relax}%
336 \let\XeKo@stretch@shrink\XeKo@stretchshrink
337 \XeTeXlinebreakskip=\z@ \XeKo@stretchshrink
338 }
339
340 \chardef\XeKo@typesetvertical\z@
341 \chardef\XeKo@STchineseJapanese\z@ % 0=KOR, 1=SC, 2=TC, 3=JPN
342
343 \protected\def\japanese{%
344 \typesetclassic
345 \chardef\XeKo@STchineseJapanese\thr@@
346 \XeTeXcharclass "FF1A = \XeTeXcharclassMD % : both horizontal and vertical glyphs
347 }
348 \protected\def\Tchinese{%
349 \typesetclassic
350 \chardef\XeKo@STchineseJapanese\tw@
351 \XeKo@Tchinese@classes
352 \parindent=2em
353 }
354 \protected\def\Schinese{%
355 \typesetclassic
356 \chardef\XeKo@STchineseJapanese\@ne
357 \ifnum\XeKo@typesetvertical=\@ne
358 \XeKo@Schinese@vertical
359 \else
360 \XeKo@Schinese@horizontal
361 \fi
362 \parindent=2em
363 }
364 \let\chinese\Schinese
365 \def\XeKo@Schinese@horizontal{% these glyphs in simplified chinese fonts are left-aligned.
366 \XeTeXcharclass "FF01 = \XeTeXcharclassFS % !
367 \XeTeXcharclass "FF1A = \XeTeXcharclassCL % :
368 \XeTeXcharclass "FF1B = \XeTeXcharclassCL % ;
369 \XeTeXcharclass "FF1F = \XeTeXcharclassFS % ?
370 }
371 \def\XeKo@Schinese@vertical{%
372 \XeTeXcharclass "FF01 = \XeTeXcharclassEX % !
373 \XeTeXcharclass "FF1A = \XeTeXcharclassVC % :
374 \XeTeXcharclass "FF1B = \XeTeXcharclassVC % ;
375 \XeTeXcharclass "FF1F = \XeTeXcharclassEX % ?
376 }
377 \def\XeKo@Tchinese@classes{% these glyphs in traditional chinese fonts are center-aligned
378 \XeTeXcharclass "3001 = \XeTeXcharclassMD % 、
379 \XeTeXcharclass "3002 = \XeTeXcharclassMD % 。
380 \XeTeXcharclass "FF0C = \XeTeXcharclassMD % ,
381 \XeTeXcharclass "FF0E = \XeTeXcharclassMD % .
382 }
383
384 \protected\def\typesetvertical{%
385 \chardef\XeKo@typesetvertical\@ne
386 \XeTeXcharclass "FF1A = \XeTeXcharclassVC % :
387 \XeTeXcharclass "FF1B = \XeTeXcharclassVC % ;
388 \ifcase\XeKo@STchineseJapanese
389 \parindent=1em
390 \or \XeKo@Schinese@vertical
391 \or \XeKo@Tchinese@classes
392 \or \XeTeXcharclass "FF1A = \XeTeXcharclassMD % :
393 \fi
394 }
395 \protected\def\typesethorizontal{%
396 \chardef\XeKo@typesetvertical\z@
397 \XeTeXcharclass "FF1A = \XeTeXcharclassMD % :
398 \XeTeXcharclass "FF1B = \XeTeXcharclassMD % ;
399 \ifcase\XeKo@STchineseJapanese
400 \or \XeKo@Schinese@horizontal
401 \or \XeKo@Tchinese@classes
402 \fi
403 \parindent\z@
404 }
405 \protected\def\vertical#1{%
406 \leavevmode
407 \ifx\empty#1\empty
408 \setbox\z@\hbox\bgroup
409 \else
410 \setbox\z@\vbox\bgroup \hsize#1\relax
411 \fi
412 \typesetvertical
413 }
414 \protected\def\endvertical{%
415 \ifinner\else \par\fi
416 \egroup
417 \XeKo@rotatebox\z@
418 \box\z@
419 }
420 \protected\def\horizontal#1{%
421 \leavevmode
422 \ifx\empty#1\empty
423 \setbox\z@\hbox\bgroup
424 \else
425 \setbox\z@\vbox\bgroup \hsize#1\relax
426 \fi
427 \typesethorizontal
428 }
429 \protected\def\endhorizontal{%
430 \ifinner\else \par\fi
431 \egroup
432 \XeKo@unrotatebox\z@
433 \ifdefined\xetexkocharraise \raise\xetexkocharraise \fi
434 \box\z@
435 }
436 \def\XeKo@rotatebox#1{%
437 \dimen@\dimexpr\ht#1+\dp#1\relax
438 \setbox#1\hbox to\dimen@\bgroup
439 \hfil
440 \vbox to\wd#1\bgroup
441 \wd#1\z@
442 \special{x:gsave}\relax
443 \special{x:rotate -90}\relax
444 \box#1\relax
445 \kern-\dimen@
446 \special{x:grestore}\relax
447 \vfil
448 \egroup
449 \kern-.5ex
450 \egroup
451 }
452 \def\XeKo@unrotatebox#1{%
453 \dimen@\dimexpr\ht#1+\dp#1\relax
454 \setbox#1\hbox to\dimen@\bgroup
455 \lower.5\wd#1\vbox to\wd#1\bgroup
456 \vfil
457 \wd#1\z@
458 \special{x:gsave}\relax
459 \special{x:rotate 90}\relax
460 \box#1\relax
461 \kern-\dimen@
462 \special{x:grestore}\relax
463 \egroup
464 \hfil
465 \egroup
466 }
467
468 \protected\def\vertlatin#1{\leavevmode\lower.5ex\hbox{\latinmarks #1}} % compat
469
470 % fonts
471 \def\XeKo@reset@options{%
472 \let\xetexkohu \XeKo@undefined
473 \let\xetexkocharraise \XeKo@undefined
474 \let\xetexkointerhchar\XeKo@undefined
475 }
476
477 \expandafter\let\expandafter\XeKo@latin@font\the\font
478
479 \def\XeKo@font@Hangul{%
480 \expandafter\ifx\the\font\XeKo@raw@hangul@font \else
481 \expandafter\ifx\the\font\XeKo@raw@hanja@font \else
482 \expandafter\let\expandafter\XeKo@latin@font\the\font
483 \fi\fi
484 \ifdefined\XeKo@hangul@font
485 \XeKo@reset@options
486 \XeKo@hangul@font
487 \expandafter\let\expandafter\XeKo@raw@hangul@font\the\font
488 \fi
489 }
490 \def\XeKo@font@CJK{%
491 \expandafter\ifx\the\font\XeKo@raw@hangul@font \else
492 \expandafter\ifx\the\font\XeKo@raw@hanja@font \else
493 \expandafter\let\expandafter\XeKo@latin@font\the\font
494 \fi\fi
495 \ifdefined\XeKo@hanja@font
496 \XeKo@reset@options
497 \XeKo@hanja@font
498 \expandafter\let\expandafter\XeKo@raw@hanja@font\the\font
499 \fi
500 }
501 \def\XeKo@font@Latin{%
502 \expandafter\ifx\the\font\XeKo@raw@hangul@font
503 \XeKo@latin@font
504 \else \expandafter\ifx\the\font\XeKo@raw@hanja@font
505 \XeKo@latin@font
506 \fi\fi
507 }
508 \let\XeKo@fontHG\XeKo@font@Hangul
509 \let\XeKo@fontID\XeKo@font@CJK
510 \let\XeKo@fontCJ\XeKo@font@CJK
511 \let\XeKo@fontSY\XeKo@font@Hangul
512 \let\XeKo@fontAA\XeKo@font@Latin
513 \let\XeKo@fontAO\XeKo@font@Hangul
514 \let\XeKo@fontAC\XeKo@font@Hangul
515 \let\XeKo@fontAP\relax % prevfont
516 \let\XeKo@fontAM\relax % prevfont
517 \let\XeKo@fontAH\XeKo@font@Latin
518 \let\XeKo@fontOP\XeKo@font@Hangul
519 \let\XeKo@fontCL\XeKo@font@Hangul
520 \let\XeKo@fontMD\XeKo@font@Hangul
521 \let\XeKo@fontFS\XeKo@font@Hangul
522 \let\XeKo@fontEX\XeKo@font@Hangul
523 \let\XeKo@fontLD\XeKo@font@Hangul
524 \let\XeKo@fontVC\XeKo@font@Hangul
525
526 \protected\def\latinalphs {\let\XeKo@fontAA\XeKo@font@Latin}
527 \protected\def\latinparens {\let\XeKo@fontAO\XeKo@font@Latin\let\XeKo@fontAC\XeKo@font@Latin}
528 \protected\def\latinpuncts {\let\XeKo@fontAP\XeKo@font@Latin}
529 \protected\def\latincolons {\let\XeKo@fontAM\XeKo@font@Latin}
530 \protected\def\latinhyphens{\let\XeKo@fontAH\XeKo@font@Latin}
531 \protected\def\latincjksymbols{%
532 \let\XeKo@fontSY\XeKo@font@Latin
533 \let\XeKo@fontOP\XeKo@font@Latin
534 \let\XeKo@fontCL\XeKo@font@Latin
535 \let\XeKo@fontMD\XeKo@font@Latin
536 \let\XeKo@fontFS\XeKo@font@Latin
537 \let\XeKo@fontEX\XeKo@font@Latin
538 \let\XeKo@fontLD\XeKo@font@Latin
539 \let\XeKo@fontVC\XeKo@font@Latin
540 }
541 \protected\def\latinmarks{%
542 \latinalphs\latinparens\latinpuncts\latincolons\latinhyphens\latincjksymbols
543 }
544 \let\latinnums\latinalphs
545 \let\latinquotes\latinparens
546
547 \protected\def\hangulalphs {\let\XeKo@fontAA\XeKo@font@Hangul}
548 \protected\def\hangulparens {\let\XeKo@fontAO\XeKo@font@Hangul\let\XeKo@fontAC\XeKo@font@Hangul}
549 \protected\def\hangulpuncts {\let\XeKo@fontAP\XeKo@font@Hangul}
550 \protected\def\hangulcolons {\let\XeKo@fontAM\XeKo@font@Hangul}
551 \protected\def\hangulhyphens{\let\XeKo@fontAH\XeKo@font@Hangul}
552 \protected\def\hangulcjksymbols{%
553 \let\XeKo@fontSY\XeKo@font@Hangul
554 \let\XeKo@fontOP\XeKo@font@Hangul
555 \let\XeKo@fontCL\XeKo@font@Hangul
556 \let\XeKo@fontMD\XeKo@font@Hangul
557 \let\XeKo@fontFS\XeKo@font@Hangul
558 \let\XeKo@fontEX\XeKo@font@Hangul
559 \let\XeKo@fontLD\XeKo@font@Hangul
560 \let\XeKo@fontVC\XeKo@font@Hangul
561 }
562 \protected\def\hangulmarks{%
563 \hangulalphs\hangulparens\hangulpuncts\hangulcolons\hangulhyphens\hangulcjksymbols
564 }
565 \let\hangulnums\hangulalphs
566 \let\hangulquotes\hangulparens
567
568 \protected\def\hanjaalphs {\let\XeKo@fontAA\XeKo@font@CJK}
569 \protected\def\hanjaparens {\let\XeKo@fontAO\XeKo@font@CJK\let\XeKo@fontAC\XeKo@font@CJK}
570 \protected\def\hanjapuncts {\let\XeKo@fontAP\XeKo@font@CJK}
571 \protected\def\hanjacolons {\let\XeKo@fontAM\XeKo@font@CJK}
572 \protected\def\hanjahyphens{\let\XeKo@fontAH\XeKo@font@CJK}
573 \protected\def\hanjacjksymbols{%
574 \let\XeKo@fontSY\XeKo@font@CJK
575 \let\XeKo@fontOP\XeKo@font@CJK
576 \let\XeKo@fontCL\XeKo@font@CJK
577 \let\XeKo@fontMD\XeKo@font@CJK
578 \let\XeKo@fontFS\XeKo@font@CJK
579 \let\XeKo@fontEX\XeKo@font@CJK
580 \let\XeKo@fontLD\XeKo@font@CJK
581 \let\XeKo@fontVC\XeKo@font@CJK
582 }
583 \protected\def\hanjamarks{%
584 \hanjaalphs\hanjaparens\hanjapuncts\hanjacolons\hanjahyphens\hanjacjksymbols
585 }
586 \let\hanjanums\hanjaalphs
587 \let\hanjaquotes\hanjaparens
588
589 \protected\def\prevfontalphs {\let\XeKo@fontAA\relax}
590 \protected\def\prevfontparens {\let\XeKo@fontAO\relax\let\XeKo@fontAC\relax}
591 \protected\def\prevfontpuncts {\let\XeKo@fontAP\relax}
592 \protected\def\prevfontcolons {\let\XeKo@fontAM\relax}
593 \protected\def\prevfonthyphens{\let\XeKo@fontAH\relax}
594 \protected\def\prevfontcjksymbols{%
595 \let\XeKo@fontSY\relax
596 \let\XeKo@fontOP\relax
597 \let\XeKo@fontCL\relax
598 \let\XeKo@fontMD\relax
599 \let\XeKo@fontFS\relax
600 \let\XeKo@fontEX\relax
601 \let\XeKo@fontLD\relax
602 \let\XeKo@fontVC\relax
603 }
604 \protected\def\prevfontmarks{%
605 \prevfontalphs\prevfontparens\prevfontpuncts\prevfontcolons\prevfonthyphens\prevfontcjksymbols
606 }
607 \let\prevfontnums\prevfontalphs
608 \let\prevfontquotes\prevfontparens
609
610 % interchartoks
611 \chardef\XeKo@cjk@ignorespaces\z@
612 \protected\def\removeclassicspaces{\chardef\XeKo@cjk@ignorespaces\@ne}
613
614 \expandafter\let\csname XeKo@6@class\endcsname =\XeTeXcharclassHG
615 \expandafter\let\csname XeKo@7@class\endcsname =\XeTeXcharclassID
616 \expandafter\let\csname XeKo@8@class\endcsname =\XeTeXcharclassSY
617 \expandafter\let\csname XeKo@9@class\endcsname =\XeTeXcharclassAA
618 \expandafter\let\csname XeKo@10@class\endcsname=\XeTeXcharclassAO
619 \expandafter\let\csname XeKo@11@class\endcsname=\XeTeXcharclassAC
620 \expandafter\let\csname XeKo@12@class\endcsname=\XeTeXcharclassAP
621 \expandafter\let\csname XeKo@13@class\endcsname=\XeTeXcharclassAM
622 \expandafter\let\csname XeKo@14@class\endcsname=\XeTeXcharclassAH
623 \expandafter\let\csname XeKo@15@class\endcsname=\XeTeXcharclassOP
624 \expandafter\let\csname XeKo@16@class\endcsname=\XeTeXcharclassCL
625 \expandafter\let\csname XeKo@17@class\endcsname=\XeTeXcharclassMD
626 \expandafter\let\csname XeKo@18@class\endcsname=\XeTeXcharclassFS
627 \expandafter\let\csname XeKo@19@class\endcsname=\XeTeXcharclassEX
628 \expandafter\let\csname XeKo@20@class\endcsname=\XeTeXcharclassLD
629 \expandafter\let\csname XeKo@21@class\endcsname=\XeTeXcharclassVC
630
631 \newtoks\XeKo@toks@
632 \newtoks\XeKo@toks@ii
633 \newskip\XeKo@skip@
634 \newcount\XeKo@count@
635 \newdimen\XeKo@dimen@
636
637 \def\XeKo@check@next@tok{\futurelet\XeKo@let@token\XeKo@check@next@tok@}
638 \def\XeKo@check@next@tok@{%
639 \XeKo@get@charslot
640 \ifnum\XeKo@charslot="FFFF
641 \expandafter\XeKo@flush@toks
642 \else
643 \ifnum 0\ifnum\XeKo@currclass>8 \ifnum\XeKo@currclass<15 % AA..AH
644 1\fi\fi >\z@
645 \expandafter\expandafter\expandafter\XeKo@check@next@tok@latin
646 \else % HG ID
647 \expandafter\expandafter\expandafter\XeKo@check@next@tok@cjk
648 \fi
649 \fi
650 }
651 \def\XeKo@check@next@tok@cjk{%
652 \ifnum 0\ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassJJ 1\else
653 \ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassCM 1\fi\fi >\z@
654 \expandafter\XeKo@addto@toks
655 \else
656 \expandafter\XeKo@flush@toks
657 \fi
658 }
659 \def\XeKo@check@next@tok@latin{%
660 % load-unicode-xetex-classes가 설정하는 모든 CM은 한글, 한자, 가나 뒤에 온다.
661 % 따라서 영문자는 CM을 고려할 필요가 없다.
662 % 아니다!!! 위에서 FE00-FE0F를 CM으로 지정했으므로 CJK에 한정되지 않는다.
663 \ifnum 0%
664 \ifnum\XeTeXcharclass\XeKo@charslot=\csname XeKo@\XeKo@currclass @class\endcsname 1\else
665 \ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassCM 1\fi\fi >\z@
666 \expandafter\XeKo@addto@toks
667 \else
668 \expandafter\XeKo@flush@toks
669 \fi
670 }
671 \def\XeKo@addto@toks#1{%
672 \ifnum\XeKo@currclass=9 % AA
673 \global\let\XeKo@josatoken=#1\relax
674 \else\ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassJJ
675 \global\let\XeKo@josatoken=#1\relax
676 \else\ifnum\XeKo@currclass=8 % SY
677 \global\let\XeKo@josatoken=#1\relax
678 \fi\fi\fi
679 \XeKo@toks@\expandafter{\the\XeKo@toks@ #1}%
680 \XeKo@check@next@tok
681 }
682 \def\XeKo@flush@toks{%
683 \ifnum\XeKo@currclass<8 %
684 \XeKo@toks@ii{}\expandafter\XeKo@char@orphan % HG, ID
685 \else
686 \expandafter\XeKo@do@flush@toks
687 \fi
688 }
689 \def\XeKo@char@orphan{%
690 \ifx\XeKo@let@token\par
691 \XeKo@suppress@linebreak
692 \let\XeKo@next\XeKo@flush@char@orphan
693 \else \ifx\@sptoken\XeKo@let@token
694 \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii \@sptoken}%
695 \let\XeKo@next\XeKo@char@orphan@
696 \else \ifx ^^2e\XeKo@let@token % .
697 \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^2e}%
698 \let\XeKo@next\XeKo@char@orphan@
699 \else \ifx ^^3f\XeKo@let@token % ?
700 \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^3f}%
701 \let\XeKo@next\XeKo@char@orphan@
702 \else \ifx ^^21\XeKo@let@token % !
703 \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^21}%
704 \let\XeKo@next\XeKo@char@orphan@
705 \else \ifx ^^^^3002\XeKo@let@token % 。
706 \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^^^3002}%
707 \let\XeKo@next\XeKo@char@orphan@
708 \else \ifx ^^^^ff0e\XeKo@let@token % .
709 \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^^^ff0e}%
710 \let\XeKo@next\XeKo@char@orphan@
711 \else
712 \let\XeKo@next\XeKo@flush@char@orphan
713 \fi\fi\fi\fi\fi \fi\fi
714 \XeKo@next
715 }
716 \def\XeKo@char@orphan@{\afterassignment\XeKo@char@orphan@@\let\XeKo@let@token= }
717 \def\XeKo@char@orphan@@{\futurelet\XeKo@let@token\XeKo@char@orphan}
718 \def\XeKo@flush@char@orphan{\expandafter \XeKo@do@flush@toks \the\XeKo@toks@ii }
719 \def\XeKo@char@raise@start{%
720 \ifdefined\xetexkocharraise
721 \expandafter\ifx\the\font\XeKo@raw@hangul@font
722 \raise\xetexkocharraise\hbox\bgroup
723 \else \expandafter\ifx\the\font\XeKo@raw@hanja@font
724 \raise\xetexkocharraise\hbox\bgroup
725 \fi\fi
726 \fi
727 }
728 \def\XeKo@char@raise@stop{%
729 \ifdefined\xetexkocharraise
730 \expandafter\ifx\the\font\XeKo@raw@hangul@font
731 \egroup
732 \else \expandafter\ifx\the\font\XeKo@raw@hanja@font
733 \egroup
734 \fi\fi
735 \fi
736 }
737 \def\XeKo@do@flush@toks{%
738 \begingroup
739 \XeTeXinterchartokenstate\z@
740 \ifdefined\XeKo@pre@hang
741 \XeKo@pre@hang % hanging punctuations
742 \fi
743 \XeKo@char@raise@start % charraise
744 \ifnum\XeKo@currclass=6 %
745 \XeKo@everyhangul{\XeKo@maybe@dotemph \the\XeKo@toks@}% everyhangul
746 \else
747 \ifnum\XeKo@currclass=7 %
748 \XeKo@everyhanja{\XeKo@maybe@dotemph \the\XeKo@toks@}% everyhanja
749 \else
750 \ifnum\XeKo@compresspuncts=\@ne
751 \ifnum\XeKo@currclass=15 % OP
752 \hbox to.5em\bgroup\hss \the\XeKo@toks@ \egroup
753 \else\ifnum\XeKo@currclass=16 % CL
754 \hbox to.5em\bgroup \the\XeKo@toks@ \hss\egroup
755 \else\ifnum\XeKo@currclass=17 % MD
756 \hbox to.5em\bgroup\hss \the\XeKo@toks@ \hss\egroup
757 \else\ifnum\XeKo@currclass=18 % FS
758 \hbox to.5em\bgroup \the\XeKo@toks@ \hss\egroup
759 \else
760 \the\XeKo@toks@
761 \fi\fi\fi\fi
762 \else
763 \the\XeKo@toks@
764 \fi
765 \fi
766 \fi
767 \XeKo@char@raise@stop % charraise
768 \ifdefined\XeKo@post@hang
769 \XeKo@post@hang % hanging punctuations
770 \fi
771 \endgroup
772 \futurelet\XeKo@let@token\XeKo@maybe@kern@ii
773 }
774 \def\XeKo@maybe@kern@ii{%
775 \ifx\XeKo@let@token\@sptoken
776 \ifnum\XeKo@cjk@ignorespaces=\@ne % try to remove space
777 \expandafter\expandafter\expandafter\XeKo@maybe@ignorespaces
778 \fi
779 \else
780 \XeKo@insert@kerns
781 \fi
782 }
783 \def\XeKo@insert@kerns{%
784 \kern-\XeKo@currclass sp \kern \XeKo@currclass sp
785 }
786 % remove space
787 \def\XeKo@maybe@ignorespaces{%
788 \ifnum 0\ifnum\XeKo@currclass<9 1\else % HG ID SY
789 \ifnum\XeKo@currclass>14 1\fi\fi % CJK punctuations
790 >\z@
791 \expandafter\XeKo@ignorespaces@iv
792 \fi
793 }
794 \def\XeKo@ignorespaces@iv{\afterassignment\XeKo@ignorespaces@v\let\XeKo@let@token= }
795 \def\XeKo@ignorespaces@v{\futurelet\XeKo@let@token\XeKo@ignorespaces@vi}
796 \def\XeKo@ignorespaces@vi{%
797 \XeKo@get@charslot
798 \XeKo@count@=\XeTeXcharclass\XeKo@charslot
799 \ifnum\XeKo@count@=\XeTeXcharclassAA \@sptoken \else
800 \ifnum\XeKo@count@=\XeTeXcharclassAO \@sptoken \else
801 \ifnum\XeKo@count@=\XeTeXcharclassAC \@sptoken \else
802 \ifnum\XeKo@count@=\XeTeXcharclassAP \@sptoken \else
803 \ifnum\XeKo@count@=\XeTeXcharclassAM \@sptoken \else
804 \ifnum\XeKo@count@=\XeTeXcharclassAH \@sptoken \else
805 \XeKo@insert@kerns
806 \fi\fi\fi\fi\fi \fi
807 }
808
809 % hanging punctuations
810 \chardef\XeKo@hangingpuncts\z@
811 \protected\def\hangingpunctuation{\chardef\XeKo@hangingpuncts\@ne }
812 \let\hangingpunctuations\hangingpunctuation
813
814 \protected\def\sethangingratio#1=#2 {%
815 \expandafter\def\csname XeKo@hanging@ratio@\number#1\endcsname{#2}%
816 }
817 \protected\def\unsethangingratio{\afterassignment\unsethangingratio@\count@= }
818 \def\unsethangingratio@{%
819 \expandafter\let\csname XeKo@hanging@ratio@\number\count@\endcsname\XeKo@undefined
820 }
821 \def\XeKo@def@pre@hang#1{%
822 \ifnum\XeKo@hangingpuncts=\@ne
823 \ifcsname XeKo@hanging@ratio@\number`#1\endcsname
824 \ifnum 0\ifnum\XeKo@compresspuncts=\@ne
825 \ifnum\XeKo@currclass=15 % OP
826 1\fi\fi >\z@
827 \XeKo@dimen@=.5em
828 \else
829 \setbox\XeKo@box@\hbox{\XeTeXinterchartokenstate\z@ #1}%
830 \XeKo@dimen@=\wd\XeKo@box@
831 \fi
832 \XeKo@dimen@=\csname XeKo@hanging@ratio@\number`#1\endcsname\XeKo@dimen@
833 \edef\XeKo@pre@hang{%
834 \kern\the\XeKo@dimen@
835 \vrule width-\the\XeKo@dimen@ height\z@ depth\z@
836 }%
837 \fi
838 \fi
839 }
840 \def\XeKo@def@post@hang#1{%
841 \ifnum\XeKo@hangingpuncts=\@ne
842 \ifcsname XeKo@hanging@ratio@\number`#1\endcsname
843 \ifnum 0\ifnum\XeKo@compresspuncts=\@ne
844 \ifnum\XeKo@currclass>15 %
845 \ifnum\XeKo@currclass<19 % CL MD FS
846 1\fi\fi\fi >\z@
847 \XeKo@dimen@=.5em
848 \else
849 \setbox\XeKo@box@\hbox{\XeTeXinterchartokenstate\z@ #1}%
850 \XeKo@dimen@=\wd\XeKo@box@
851 \fi
852 \XeKo@dimen@=\csname XeKo@hanging@ratio@\number`#1\endcsname\XeKo@dimen@
853 \edef\XeKo@post@hang{%
854 \noexpand\XeKo@count@\noexpand\spacefactor
855 \vrule width-\the\XeKo@dimen@ height\z@ depth\z@
856 \kern\the\XeKo@dimen@
857 \noexpand\spacefactor\noexpand\XeKo@count@
858 }%
859 \fi
860 \fi
861 }
862 \sethangingratio"2C=1 % , 반점
863 \sethangingratio"2E=1 % . 온점
864 \sethangingratio"3001=1 % 、 모점
865 \sethangingratio"3002=1 % 。 고리점
866 \sethangingratio"FF0C=1 % , 전각반점
867 \sethangingratio"FF0E=1 % . 전각온점
868
869 % compress CJK punctuations to .5em
870 \protected\def\compresspunctuations{\chardef\XeKo@compresspuncts\@ne }
871 \protected\def\nocompresspunctuations{\chardef\XeKo@compresspuncts\z@ }
872 \compresspunctuations
873
874 %% everyhangul/hanja
875 \def\everyhangul#1{\def\XeKo@everyhangul##1{#1}}
876 \def\everyhanja #1{\def\XeKo@everyhanja ##1{#1}}
877 \def\XeKo@everyhangul#1{#1}
878 \def\XeKo@everyhanja #1{#1}
879
880 \def\XeKo@startHG#1{%
881 \global\let\XeKo@josatoken=#1\relax
882 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
883 \def\XeKo@currclass{6}%
884 \XeKo@toks@{#1}%
885 \XeKo@check@next@tok
886 }
887 \def\XeKo@startID#1{%
888 \global\let\XeKo@josatoken=#1\relax
889 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
890 \def\XeKo@currclass{7}%
891 \XeKo@toks@{#1}%
892 \ifdefined\fallbackhanjafont
893 \iffontchar\font`#1\else
894 \XeKo@toks@{\fallbackhanjafont #1}%
895 \fi
896 \fi
897 \XeKo@check@next@tok
898 }
899 \def\XeKo@startCJ#1{%
900 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
901 \def\XeKo@currclass{7}% same as ID
902 \XeKo@toks@{#1}%
903 \XeKo@check@next@tok
904 }
905 \def\XeKo@startSY#1{%
906 \global\let\XeKo@josatoken=#1\relax
907 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
908 \def\XeKo@currclass{8}%
909 \XeKo@toks@{#1}%
910 \XeKo@check@next@tok
911 }
912 \def\XeKo@startAA#1{%
913 \global\let\XeKo@josatoken=#1\relax
914 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
915 \def\XeKo@currclass{9}%
916 \XeKo@toks@{#1}%
917 \XeKo@check@next@tok
918 }
919 \def\XeKo@startAO#1{%
920 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
921 \def\XeKo@currclass{10}%
922 \XeKo@toks@{#1}%
923 \XeKo@def@pre@hang{#1}%
924 \XeKo@check@next@tok
925 }
926 \def\XeKo@startAC#1{%
927 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
928 \def\XeKo@currclass{11}%
929 \XeKo@toks@{#1}%
930 \XeKo@def@post@hang{#1}%
931 \XeKo@check@next@tok
932 }
933 \def\XeKo@startAP#1{%
934 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
935 \def\XeKo@currclass{12}%
936 \XeKo@toks@{#1}%
937 \XeKo@def@post@hang{#1}%
938 \XeKo@check@next@tok
939 }
940 \def\XeKo@startAM#1{%
941 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
942 \def\XeKo@currclass{13}%
943 \XeKo@toks@{#1}%
944 \XeKo@def@post@hang{#1}%
945 \XeKo@check@next@tok
946 }
947 \def\XeKo@startAH#1{%
948 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
949 \def\XeKo@currclass{14}%
950 \XeKo@toks@{#1}%
951 \ifnum`#1=\hyphenchar\font \else % exclude hyphen char
952 \XeKo@def@post@hang{#1}%
953 \fi
954 \XeKo@check@next@tok
955 }
956 \def\XeKo@startOP#1{%
957 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
958 \def\XeKo@currclass{15}%
959 \XeKo@toks@{#1}%
960 \XeKo@def@pre@hang{#1}%
961 \XeKo@check@next@tok
962 }
963 \def\XeKo@startCL#1{%
964 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
965 \def\XeKo@currclass{16}%
966 \XeKo@toks@{#1}%
967 \XeKo@def@post@hang{#1}%
968 \XeKo@check@next@tok
969 }
970 \def\XeKo@startMD#1{%
971 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
972 \def\XeKo@currclass{17}%
973 \XeKo@toks@{#1}%
974 \XeKo@def@post@hang{#1}%
975 \XeKo@check@next@tok
976 }
977 \def\XeKo@startFS#1{%
978 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
979 \def\XeKo@currclass{18}%
980 \XeKo@toks@{#1}%
981 \XeKo@def@post@hang{#1}%
982 \XeKo@check@next@tok
983 }
984 \def\XeKo@startEX#1{%
985 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
986 \def\XeKo@currclass{19}%
987 \XeKo@toks@{#1}%
988 \XeKo@def@post@hang{#1}%
989 \XeKo@check@next@tok
990 }
991 \def\XeKo@startLD#1{%
992 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
993 \def\XeKo@currclass{20}%
994 \XeKo@toks@{#1}%
995 \XeKo@def@post@hang{#1}%
996 \XeKo@check@next@tok
997 }
998 \def\XeKo@startVC#1{%
999 \let\XeKo@pre@hang\XeKo@undefined \let\XeKo@post@hang\XeKo@undefined
1000 \def\XeKo@currclass{21}%
1001 \XeKo@toks@{#1}%
1002 \XeKo@def@post@hang{#1}%
1003 \XeKo@check@next@tok
1004 }
1005
1006 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassHG{%
1007 \ifx\f@encoding\UTFencname
1008 \ifnum\lastnodetype=12 %
1009 \ifcase\lastkern
1010 \or \XKinterhanjabreak \or \or \or \or % 1: ruby를 한자처럼 취급
1011 \or \unkern\unkern \XKinterhangulbreak % HG HG
1012 \or \unkern\unkern \XKinterhanjabreak % ID HG
1013 \or \unkern\unkern % SY HG
1014 \or \unkern\unkern \XeKo@latincjk % AA HG
1015 \or \unkern\unkern % AO HG
1016 \or \unkern\unkern \XeKo@latincjk % AC HG
1017 \or \unkern\unkern \XeKo@latincjk % AP HG
1018 \or \unkern\unkern \XeKo@latincjk % AM HG
1019 \or \unkern\unkern \XKinterhanjabreak % AH HG
1020 \or \unkern\unkern % OP HG
1021 \or \unkern\unkern \XeKo@halfhalf % CL HG
1022 \or \unkern\unkern \XeKo@quarterquarter % MD HG
1023 \or \unkern\unkern \XeKo@halfzero % FS HG
1024 \or \unkern\unkern \XeKo@halfhalf % EX HG
1025 \or \unkern\unkern \XKinterhanjabreak % LD HG
1026 \or \unkern\unkern \XeKo@quarterquarter % VC HG
1027 \fi
1028 \else\ifnum\lastnodetype=10 % mathoff
1029 \XeKo@postmath
1030 \fi\fi
1031 \XeKo@fontHG\expandafter\XeKo@startHG
1032 \fi
1033 }
1034 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassID{%
1035 \ifx\f@encoding\UTFencname
1036 \ifnum\lastnodetype=12 %
1037 \ifcase\lastkern
1038 \or \XKinterhanjabreak \or \or \or \or
1039 \or \unkern\unkern \XKinterhanjabreak % HG ID
1040 \or \unkern\unkern \XKinterhanjabreak % ID ID
1041 \or \unkern\unkern % SY ID
1042 \or \unkern\unkern \XeKo@latincjk % AA ID
1043 \or \unkern\unkern % AO ID
1044 \or \unkern\unkern \XeKo@latincjk % AC ID
1045 \or \unkern\unkern \XeKo@latincjk % AP ID
1046 \or \unkern\unkern \XeKo@latincjk % AM ID
1047 \or \unkern\unkern \XKinterhanjabreak % AH ID
1048 \or \unkern\unkern % OP ID
1049 \or \unkern\unkern \XeKo@halfhalf % CL ID
1050 \or \unkern\unkern \XeKo@quarterquarter % MD ID
1051 \or \unkern\unkern \XeKo@halfzero % FS ID
1052 \or \unkern\unkern \XeKo@halfhalf % EX ID
1053 \or \unkern\unkern \XKinterhanjabreak % LD ID
1054 \or \unkern\unkern \XeKo@quarterquarter % VC ID
1055 \fi
1056 \else\ifnum\lastnodetype=10 % mathoff
1057 \XeKo@postmath
1058 \fi\fi
1059 \XeKo@fontID\expandafter\XeKo@startID
1060 \fi
1061 }
1062 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassCJ{%
1063 \ifx\f@encoding\UTFencname
1064 \ifnum\lastnodetype=12 %
1065 \ifcase\lastkern
1066 \or \XKinterhanjabreak \XeKo@suppress@linebreak \or \or \or \or
1067 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % HG CJ
1068 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % ID CJ
1069 \or \unkern\unkern % SY CJ
1070 \or \unkern\unkern \XeKo@latincjk % AA CJ
1071 \or \unkern\unkern % AO CJ
1072 \or \unkern\unkern \XeKo@latincjk % AC CJ
1073 \or \unkern\unkern \XeKo@latincjk % AP CJ
1074 \or \unkern\unkern \XeKo@latincjk % AM CJ
1075 \or \unkern\unkern \XKinterhanjabreak % AH CJ
1076 \or \unkern\unkern % OP CJ
1077 \or \unkern\unkern \XeKo@halfhalf \XeKo@suppress@linebreak % CL CJ
1078 \or \unkern\unkern \XeKo@quarterquarter \XeKo@suppress@linebreak % MD CJ
1079 \or \unkern\unkern \XeKo@halfzero \XeKo@suppress@linebreak % FS CJ
1080 \or \unkern\unkern \XeKo@halfhalf \XeKo@suppress@linebreak % EX CJ
1081 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % LD CJ
1082 \or \unkern\unkern \XeKo@quarterquarter \XeKo@suppress@linebreak % VC CJ
1083 \fi
1084 \else\ifnum\lastnodetype=10 % mathoff
1085 \XeKo@postmath
1086 \fi\fi
1087 \XeKo@fontCJ\expandafter\XeKo@startCJ
1088 \fi
1089 }
1090 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassSY{%
1091 \ifx\f@encoding\UTFencname
1092 \ifnum\lastnodetype=12 %
1093 \ifcase\lastkern
1094 \or \or \or \or \or
1095 \or \unkern\unkern % HG SY
1096 \or \unkern\unkern % ID SY
1097 \or \unkern\unkern % SY SY
1098 \or \unkern\unkern % AA SY
1099 \or \unkern\unkern % AO SY
1100 \or \unkern\unkern \XeKo@latincjk % AC SY
1101 \or \unkern\unkern \XeKo@latincjk % AP SY
1102 \or \unkern\unkern \XeKo@latincjk % AM SY
1103 \or \unkern\unkern % AH SY
1104 \or \unkern\unkern % OP SY
1105 \or \unkern\unkern \XeKo@halfhalf % CL SY
1106 \or \unkern\unkern \XeKo@quarterquarter % MD SY
1107 \or \unkern\unkern \XeKo@halfzero % FS SY
1108 \or \unkern\unkern \XeKo@halfhalf % EX SY
1109 \or \unkern\unkern % LD SY
1110 \or \unkern\unkern \XeKo@quarterquarter % VC SY
1111 \fi
1112 \else\ifnum\lastnodetype=10 % mathoff
1113 \XeKo@postmath
1114 \fi\fi
1115 \XeKo@fontSY\expandafter\XeKo@startSY
1116 \fi
1117 }
1118 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassAA{%
1119 \ifx\f@encoding\UTFencname
1120 \ifnum\lastnodetype=12 %
1121 \ifcase\lastkern
1122 \or \XeKo@latincjk \or \or \or \or
1123 \or \unkern\unkern \XeKo@latincjk % HG AA
1124 \or \unkern\unkern \XeKo@latincjk % ID AA
1125 \or \unkern\unkern % SY AA
1126 \or \unkern\unkern % AA AA
1127 \or \unkern\unkern % AO AA
1128 \or \unkern\unkern % AC AA
1129 \or \unkern\unkern % AP AA
1130 \or \unkern\unkern % AM AA
1131 \or \unkern\unkern % AH AA
1132 \or \unkern\unkern % OP AA
1133 \or \unkern\unkern \XeKo@halfhalf % CL AA
1134 \or \unkern\unkern \XeKo@quarterquarter % MD AA
1135 \or \unkern\unkern \XeKo@halfzero % FS AA
1136 \or \unkern\unkern \XeKo@halfhalf % EX AA
1137 \or \unkern\unkern \XeKo@latincjk % LD AA
1138 \or \unkern\unkern \XeKo@quarterquarter % VC AA
1139 \fi
1140 \fi
1141 \XeKo@fontAA\expandafter\XeKo@startAA
1142 \fi
1143 }
1144 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassAO{%
1145 \ifx\f@encoding\UTFencname
1146 \ifnum\lastnodetype=12 %
1147 \ifcase\lastkern
1148 \or \XeKo@latincjk \or \or \or \or
1149 \or \unkern\unkern \XeKo@latincjk % HG AO
1150 \or \unkern\unkern \XeKo@latincjk % ID AO
1151 \or \unkern\unkern \XeKo@latincjk % SY AO
1152 \or \unkern\unkern % AA AO
1153 \or \unkern\unkern % AO AO
1154 \or \unkern\unkern \inhibitglue % AC AO
1155 \or \unkern\unkern % AP AO
1156 \or \unkern\unkern % AM AO
1157 \or \unkern\unkern % AH AO
1158 \or \unkern\unkern % OP AO
1159 \or \unkern\unkern \XeKo@halfhalf % CL AO
1160 \or \unkern\unkern \XeKo@quarterquarter % MD AO
1161 \or \unkern\unkern \XeKo@halfzero % FS AO
1162 \or \unkern\unkern \XeKo@halfhalf % EX AO
1163 \or \unkern\unkern \XeKo@latincjk % LD AO
1164 \or \unkern\unkern \XeKo@quarterquarter % VC AO
1165 \fi
1166 \fi
1167 \XeKo@fontAO\expandafter\XeKo@startAO
1168 \fi
1169 }
1170 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassAC{%
1171 \ifx\f@encoding\UTFencname
1172 \ifnum\lastnodetype=12 %
1173 \ifcase\lastkern
1174 \or \or \or \or \or
1175 \or \unkern\unkern % HG AC
1176 \or \unkern\unkern % ID AC
1177 \or \unkern\unkern % SY AC
1178 \or \unkern\unkern % AA AC
1179 \or \unkern\unkern % AO AC
1180 \or \unkern\unkern % AC AC
1181 \or \unkern\unkern % AP AC
1182 \or \unkern\unkern % AM AC
1183 \or \unkern\unkern % AH AC
1184 \or \unkern\unkern % OP AC
1185 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % CL AC
1186 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD AC
1187 \or \unkern\unkern \XeKo@nobreak\XeKo@halfzero % FS AC
1188 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % EX AC
1189 \or \unkern\unkern % LD AC
1190 \or \unkern\unkern % VC AC
1191 \fi
1192 \fi
1193 \XeKo@fontAC\expandafter\XeKo@startAC
1194 \fi
1195 }
1196 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassAP{%
1197 \ifx\f@encoding\UTFencname
1198 \ifnum\lastnodetype=12 %
1199 \ifcase\lastkern
1200 \or \or \or \or \or
1201 \or \unkern\unkern % HG AP
1202 \or \unkern\unkern % ID AP
1203 \or \unkern\unkern % SY AP
1204 \or \unkern\unkern % AA AP
1205 \or \unkern\unkern % AO AP
1206 \or \unkern\unkern % AC AP
1207 \or \unkern\unkern % AP AP
1208 \or \unkern\unkern % AM AP
1209 \or \unkern\unkern % AH AP
1210 \or \unkern\unkern % OP AP
1211 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % CL AP
1212 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD AP
1213 \or \unkern\unkern \XeKo@nobreak\XeKo@halfzero % FS AP
1214 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % EX AP
1215 \or \unkern\unkern % LD AP
1216 \or \unkern\unkern % VC AP
1217 \fi
1218 \fi
1219 \XeKo@fontAP\expandafter\XeKo@startAP
1220 \fi
1221 }
1222 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassAM{%
1223 \ifx\f@encoding\UTFencname
1224 \ifnum\lastnodetype=12 %
1225 \ifcase\lastkern
1226 \or \XeKo@nobreak\XeKo@latincjk \or \or \or \or
1227 \or \unkern\unkern \XeKo@nobreak\XeKo@latincjk % HG AM
1228 \or \unkern\unkern \XeKo@nobreak\XeKo@latincjk % ID AM
1229 \or \unkern\unkern \XeKo@nobreak\XeKo@latincjk % SY AM
1230 \or \unkern\unkern % AA AM
1231 \or \unkern\unkern % AO AM
1232 \or \unkern\unkern % AC AM
1233 \or \unkern\unkern % AP AM
1234 \or \unkern\unkern % AM AM
1235 \or \unkern\unkern % AH AM
1236 \or \unkern\unkern % OP AM
1237 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % CL AM
1238 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD AM
1239 \or \unkern\unkern \XeKo@nobreak\XeKo@halfzero % FS AM
1240 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % EX AM
1241 \or \unkern\unkern % LD AM
1242 \or \unkern\unkern % VC AM
1243 \fi
1244 \fi
1245 \XeKo@fontAM\expandafter\XeKo@startAM
1246 \fi
1247 }
1248 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassAH{%
1249 \ifx\f@encoding\UTFencname
1250 \ifnum\lastnodetype=12 %
1251 \ifcase\lastkern
1252 \or \XeKo@nobreak \or \or \or \or
1253 \or \unkern\unkern \XeKo@nobreak % HG AH
1254 \or \unkern\unkern \XeKo@nobreak % ID AH
1255 \or \unkern\unkern \XeKo@nobreak % SY AH
1256 \or \unkern\unkern % AA AH
1257 \or \unkern\unkern % AO AH
1258 \or \unkern\unkern % AC AH
1259 \or \unkern\unkern % AP AH
1260 \or \unkern\unkern % AM AH
1261 \or \unkern\unkern % AH AH
1262 \or \unkern\unkern % OP AH
1263 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % CL AH
1264 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD AH
1265 \or \unkern\unkern \XeKo@nobreak\XeKo@halfzero % FS AH
1266 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % EX AH
1267 \or \unkern\unkern \XeKo@nobreak % LD AH
1268 \or \unkern\unkern \XeKo@nobreak % VC AH
1269 \fi
1270 \fi
1271 \XeKo@fontAH\expandafter\XeKo@startAH
1272 \fi
1273 }
1274 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassOP{%
1275 \ifx\f@encoding\UTFencname
1276 \ifnum\lastnodetype=12 %
1277 \ifcase\lastkern
1278 \or \XeKo@halfhalf \or \or \or \or
1279 \or \unkern\unkern \XeKo@halfhalf % HG OP
1280 \or \unkern\unkern \XeKo@halfhalf % ID OP
1281 \or \unkern\unkern \XeKo@halfhalf % SY OP
1282 \or \unkern\unkern \XeKo@halfhalf % AA OP
1283 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % AO OP
1284 \or \unkern\unkern \XeKo@halfhalf % AC OP
1285 \or \unkern\unkern \XeKo@halfhalf % AP OP
1286 \or \unkern\unkern \XeKo@halfhalf % AM OP
1287 \or \unkern\unkern \XeKo@halfhalf % AH OP
1288 \or \unkern\unkern % OP OP
1289 \or \unkern\unkern \XeKo@halfhalf % CL OP
1290 \or \unkern\unkern \XeKo@quarterquarter % MD OP
1291 \or \unkern\unkern \XeKo@halfzero % FS OP
1292 \or \unkern\unkern \XeKo@halfhalf % EX OP
1293 \or \unkern\unkern \XeKo@halfhalf % LD OP
1294 \or \unkern\unkern \XeKo@quarterquarter % VC OP
1295 \fi
1296 \else\ifnum\lastnodetype=10 % mathoff
1297 \XeKo@halfhalf
1298 \fi\fi
1299 \XeKo@fontOP\expandafter\XeKo@startOP
1300 \fi
1301 }
1302 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassCL{%
1303 \ifx\f@encoding\UTFencname
1304 \ifnum\lastnodetype=12 %
1305 \ifcase\lastkern
1306 \or \or \or \or \or
1307 \or \unkern\unkern % HG CL
1308 \or \unkern\unkern % ID CL
1309 \or \unkern\unkern % SY CL
1310 \or \unkern\unkern % AA CL
1311 \or \unkern\unkern % AO CL
1312 \or \unkern\unkern % AC CL
1313 \or \unkern\unkern % AP CL
1314 \or \unkern\unkern % AM CL
1315 \or \unkern\unkern % AH CL
1316 \or \unkern\unkern % OP CL
1317 \or \unkern\unkern % CL CL
1318 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD CL
1319 \or \unkern\unkern % FS CL
1320 \or \unkern\unkern % EX CL
1321 \or \unkern\unkern % LD CL
1322 \or \unkern\unkern % VC CL
1323 \fi
1324 \fi
1325 \XeKo@fontCL\expandafter\XeKo@startCL
1326 \fi
1327 }
1328 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassMD{%
1329 \ifx\f@encoding\UTFencname
1330 \ifnum\lastnodetype=12 %
1331 \ifcase\lastkern
1332 \or \XeKo@nobreak\XeKo@quarterquarter \or \or \or \or
1333 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % HG MD
1334 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % ID MD
1335 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % SY MD
1336 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % AA MD
1337 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % AO MD
1338 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % AC MD
1339 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % AP MD
1340 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % AM MD
1341 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % AH MD
1342 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % OP MD
1343 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % CL MD
1344 \or \unkern\unkern \XeKo@nobreak\XeKo@halfquarter % MD MD
1345 \or \unkern\unkern \XeKo@nobreak\XeKo@iiiquarterquarter % FS MD
1346 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % EX MD
1347 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % LD MD
1348 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % VC MD
1349 \fi
1350 \else\ifnum\lastnodetype=10 % mathoff
1351 \XeKo@nobreak\XeKo@quarterquarter
1352 \fi\fi
1353 \XeKo@fontMD\expandafter\XeKo@startMD
1354 \fi
1355 }
1356 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassFS{%
1357 \ifx\f@encoding\UTFencname
1358 \ifnum\lastnodetype=12 %
1359 \ifcase\lastkern
1360 \or \or \or \or \or
1361 \or \unkern\unkern % HG FS
1362 \or \unkern\unkern % ID FS
1363 \or \unkern\unkern % SY FS
1364 \or \unkern\unkern % AA FS
1365 \or \unkern\unkern % AO FS
1366 \or \unkern\unkern % AC FS
1367 \or \unkern\unkern % AP FS
1368 \or \unkern\unkern % AM FS
1369 \or \unkern\unkern % AH FS
1370 \or \unkern\unkern % OP FS
1371 \or \unkern\unkern % CL FS
1372 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD FS
1373 \or \unkern\unkern % FS FS
1374 \or \unkern\unkern % EX FS
1375 \or \unkern\unkern % LD FS
1376 \or \unkern\unkern % VC FS
1377 \fi
1378 \fi
1379 \XeKo@fontFS\expandafter\XeKo@startFS
1380 \fi
1381 }
1382 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassEX{%
1383 \ifx\f@encoding\UTFencname
1384 \ifnum\lastnodetype=12 %
1385 \ifcase\lastkern
1386 \or \or \or \or \or
1387 \or \unkern\unkern % HG EX
1388 \or \unkern\unkern % ID EX
1389 \or \unkern\unkern % SY EX
1390 \or \unkern\unkern % AA EX
1391 \or \unkern\unkern % AO EX
1392 \or \unkern\unkern % AC EX
1393 \or \unkern\unkern % AP EX
1394 \or \unkern\unkern % AM EX
1395 \or \unkern\unkern % AH EX
1396 \or \unkern\unkern % OP EX
1397 \or \unkern\unkern \XeKo@nobreak\XeKo@halfhalf % CL EX
1398 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD EX
1399 \or \unkern\unkern \XeKo@nobreak\XeKo@halfzero % FS EX
1400 \or \unkern\unkern % EX EX
1401 \or \unkern\unkern % LD EX
1402 \or \unkern\unkern % VC EX
1403 \fi
1404 \fi
1405 \XeKo@fontEX\expandafter\XeKo@startEX
1406 \fi
1407 }
1408 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassLD{%
1409 \ifx\f@encoding\UTFencname
1410 \ifnum\lastnodetype=12 %
1411 \ifcase\lastkern
1412 \or \XKinterhanjabreak \XeKo@suppress@linebreak \or \or \or \or
1413 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % HG LD
1414 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % ID LD
1415 \or \unkern\unkern % SY LD
1416 \or \unkern\unkern % AA LD
1417 \or \unkern\unkern % AO LD
1418 \or \unkern\unkern % AC LD
1419 \or \unkern\unkern % AP LD
1420 \or \unkern\unkern % AM LD
1421 \or \unkern\unkern % AH LD
1422 \or \unkern\unkern % OP LD
1423 \or \unkern\unkern \XeKo@halfhalf \XeKo@suppress@linebreak % CL LD
1424 \or \unkern\unkern \XeKo@quarterquarter \XeKo@suppress@linebreak % MD LD
1425 \or \unkern\unkern \XeKo@halfzero \XeKo@suppress@linebreak % FS LD
1426 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % EX LD
1427 \or \unkern\unkern % LD LD
1428 \or \unkern\unkern \XKinterhanjabreak \XeKo@suppress@linebreak % VC LD
1429 \fi
1430 \fi
1431 \XeKo@fontLD\expandafter\XeKo@startLD
1432 \fi
1433 }
1434 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassVC{%
1435 \ifx\f@encoding\UTFencname
1436 \ifnum\lastnodetype=12 %
1437 \ifcase\lastkern
1438 \or \or \or \or \or
1439 \or \unkern\unkern % HG VC
1440 \or \unkern\unkern % ID VC
1441 \or \unkern\unkern % SY VC
1442 \or \unkern\unkern % AA VC
1443 \or \unkern\unkern % AO VC
1444 \or \unkern\unkern % AC VC
1445 \or \unkern\unkern % AP VC
1446 \or \unkern\unkern % AM VC
1447 \or \unkern\unkern % AH VC
1448 \or \unkern\unkern % OP VC
1449 \or \unkern\unkern % CL VC
1450 \or \unkern\unkern \XeKo@nobreak\XeKo@quarterquarter % MD VC
1451 \or \unkern\unkern % FS VC
1452 \or \unkern\unkern % EX VC
1453 \or \unkern\unkern % LD VC
1454 \or \unkern\unkern % VC VC
1455 \fi
1456 \fi
1457 \XeKo@fontVC\expandafter\XeKo@startVC
1458 \fi
1459 }
1460
1461 \newbox\XeKo@box@
1462
1463 % \char"1112\char"119E\char"11AB etc.
1464 % !!!!! 이 경우 \everyhangul 등이 제대로 작동 않는다 !!!!!
1465 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassJJ{%
1466 \ifnum\lastnodetype=12 %
1467 \ifnum\lastkern=6 %
1468 \unkern\unkern
1469 \expandafter\expandafter\expandafter\XeKo@startJJ
1470 \fi
1471 \fi
1472 }
1473 \def\XeKo@startJJ#1{%
1474 \global\let\XeKo@josatoken=#1\relax
1475 \begingroup
1476 \XeTeXinterchartokenstate\z@
1477 \ifnum\lastnodetype=\@ne % hbox (charraise box)
1478 \setbox\XeKo@box@=\lastbox
1479 \XeKo@char@raise@start \unhbox\XeKo@box@ #1\XeKo@char@raise@stop
1480 \else
1481 #1\relax
1482 \fi
1483 \endgroup
1484 \XeKo@insert@kerns
1485 }
1486 % \char"9AA8\char"E0102 etc.
1487 \XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassCM{%
1488 \ifnum\lastnodetype=12 %
1489 \ifcase\lastkern
1490 \or \or \or \or \or
1491 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % HG
1492 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % ID
1493 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % SY
1494 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % AA
1495 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % AO
1496 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % AC
1497 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % AP
1498 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % AM
1499 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % AH
1500 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % OP
1501 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % CL
1502 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % MD
1503 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % FS
1504 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % EX
1505 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % LD
1506 \or \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM % VC
1507 \fi
1508 \fi
1509 }
1510 \def\XeKo@startCM#1{%
1511 \begingroup
1512 \XeTeXinterchartokenstate\z@
1513 \ifnum\lastnodetype=\@ne % hbox
1514 \ifdefined\xetexkocharraise
1515 \setbox\XeKo@box@=\lastbox % charraise box
1516 \XeKo@char@raise@start
1517 \unhbox\XeKo@box@
1518 \ifnum\lastnodetype=\@ne % hbox again
1519 \XeKo@rebox@punctbox{#1}% compressed punctuation box
1520 \else
1521 #1\relax
1522 \fi
1523 \XeKo@char@raise@stop
1524 \else
1525 \XeKo@rebox@punctbox{#1}% compressed punctuation box
1526 \fi
1527 \else
1528 #1\relax
1529 \fi
1530 \endgroup
1531 \XeKo@insert@kerns
1532 }
1533 \def\XeKo@rebox@punctbox#1{%
1534 \ifnum 0\ifnum\XeKo@currclass>14 \ifnum\XeKo@currclass<19 % OP .. FS
1535 1\fi\fi >\z@
1536 \setbox\XeKo@box@=\lastbox
1537 \hbox to.5em\bgroup
1538 \unhbox\XeKo@box@
1539 \XeKo@skip@\lastskip \unskip
1540 #1\hskip\XeKo@skip@
1541 \egroup
1542 \else
1543 #1\relax
1544 \fi
1545 }
1546 % for users' AddToHook
1547 \def\xetexkoprehanjaspacing{%
1548 \ifx\f@encoding\UTFencname
1549 \ifnum\lastnodetype=12 %
1550 \ifcase\lastkern
1551 \or \XKinterhanjabreak \or \or \or \or
1552 \or \unkern\unkern \XKinterhanjabreak % HG ID
1553 \or \unkern\unkern \XKinterhanjabreak % ID ID
1554 \or \unkern\unkern % SY ID
1555 \or \unkern\unkern \XeKo@latincjk % AA ID
1556 \or \unkern\unkern % AO ID
1557 \or \unkern\unkern \XeKo@latincjk % AC ID
1558 \or \unkern\unkern \XeKo@latincjk % AP ID
1559 \or \unkern\unkern \XeKo@latincjk % AM ID
1560 \or \unkern\unkern \XKinterhanjabreak % AH ID
1561 \or \unkern\unkern % OP ID
1562 \or \unkern\unkern \XeKo@halfhalf % CL ID
1563 \or \unkern\unkern \XeKo@quarterquarter % MD ID
1564 \or \unkern\unkern \XeKo@halfzero % FS ID
1565 \or \unkern\unkern \XeKo@halfhalf % EX ID
1566 \or \unkern\unkern \XKinterhanjabreak % LD ID
1567 \or \unkern\unkern \XeKo@quarterquarter % VC ID
1568 \fi
1569 \else\ifnum\lastnodetype=10 % mathoff
1570 \XeKo@postmath
1571 \fi\fi\fi
1572 }
1573 \def\xetexkoposthanjaspacing{\kern-7sp\kern 7sp\relax}
1574
1575 %%% josa selection
1576 \begingroup
1577 \catcode`A=11\relax \global\let\XeKo@catcode@letter=A
1578 \catcode`0=12\relax \global\let\XeKo@catcode@other =0
1579 \endgroup
1580 \def\XeKo@striptw@words#1 #2 #3\relax{#3}
1581 \def\XeKo@get@charslot{%
1582 \if\noexpand\XeKo@let@token\relax
1583 \chardef\XeKo@charslot="FFFF
1584 \else
1585 \expandafter\XeKo@get@charslot@
1586 \fi
1587 }
1588 \def\XeKo@get@charslot@{%
1589 \ifnum 0\ifcat\XeKo@let@token\XeKo@catcode@letter 1\else
1590 \ifcat\XeKo@let@token\XeKo@catcode@other 1\fi\fi >\z@
1591 \edef\@tempa{\expandafter\XeKo@striptw@words\meaning\XeKo@let@token\relax}%
1592 \expandafter\chardef\expandafter\XeKo@charslot\expandafter`\@tempa\relax
1593 \else
1594 \chardef\XeKo@charslot="FFFF
1595 \fi
1596 }
1597
1598 \def\XeKo@read@hanja@hangul@file#1{%
1599 \begingroup
1600 \@tempcnta=\z@
1601 \openin1=#1\relax \XeKo@read@hanja@hangul@line \closein1
1602 \endgroup
1603 }
1604 \def\XeKo@read@hanja@hangul@line{%
1605 \read1 to \@tempa
1606 \ifnum\XeKo@count@=\@tempcnta
1607 \global\XeKo@count@\@tempa
1608 \else
1609 \advance\@tempcnta\@ne \expandafter\XeKo@read@hanja@hangul@line
1610 \fi
1611 }
1612
1613 \def\XeKo@num@josa{%
1614 \ifnum\XeKo@count@<\z@ \XeKo@count@=-\XeKo@count@ \fi
1615 \count@\XeKo@count@
1616 \divide\count@ 10
1617 \multiply\count@ 10
1618 \advance\XeKo@count@-\count@
1619 \XeKo@count@=\ifcase\XeKo@count@ \z@
1620 \or \@ne
1621 \or \tw@
1622 \or \z@
1623 \or \tw@
1624 \or \tw@
1625 \or \z@
1626 \or \@ne
1627 \or \@ne
1628 \or \tw@
1629 \fi
1630 \XeKo@do@make@josa
1631 }
1632 \def\XeKo@alph@josa{%
1633 \XeKo@count@=\ifnum "4C=\XeKo@count@ \@ne % L
1634 \else\ifnum "4D=\XeKo@count@ \z@ % M
1635 \else\ifnum "4E=\XeKo@count@ \z@ % N
1636 \else\ifnum "6C=\XeKo@count@ \@ne % l
1637 \else\ifnum "6D=\XeKo@count@ \z@ % m
1638 \else\ifnum "6E=\XeKo@count@ \z@ % n
1639 \else \tw@
1640 \fi\fi\fi\fi\fi \fi
1641 \XeKo@do@make@josa
1642 }
1643
1644 \protected\def\jong {\global\let\XeKo@josatoken=0}\jong
1645 \protected\def\rieul{\global\let\XeKo@josatoken=1}
1646 \protected\def\jung {\global\let\XeKo@josatoken=2}
1647 \protected\def\가{\XeKo@make@josa 가이}
1648 \protected\def\이{\futurelet\XeKo@let@token\XeKo@make@josa@I}
1649 \protected\def\은{\XeKo@make@josa 는은} \let\는\은
1650 \protected\def\을{\XeKo@make@josa 를을} \let\를\을
1651 \protected\def\와{\XeKo@make@josa 와과} \let\과\와
1652 \protected\def\으{\XeKo@make@josa \empty 으}
1653 \protected\def\로{\으로}
1654 \protected\def\라{\XeKo@make@josa 라{이라}}
1655 \def\XeKo@make@josa@II{\XeKo@make@josa\relax 이}
1656 \def\XeKo@make@josa@I{%
1657 \XeKo@get@charslot
1658 \ifnum\XeKo@charslot="FFFF
1659 \expandafter\가%
1660 \else
1661 \ifnum 0\ifnum\XeKo@charslot>"ABFF \ifnum\XeKo@charslot<"D7A4 1\fi\fi >\z@
1662 \expandafter\expandafter\expandafter\XeKo@make@josa@II
1663 \else
1664 \expandafter\expandafter\expandafter\가%
1665 \fi
1666 \fi
1667 }
1668 \def\XeKo@make@josa{%
1669 \let\XeKo@let@token=\XeKo@josatoken
1670 \XeKo@get@charslot
1671 \XeKo@count@=\XeKo@charslot
1672 \ifnum\XeKo@count@<"FF00
1673 \else\ifnum\XeKo@count@<"FF5B
1674 \advance\XeKo@count@-"FEE0
1675 \fi\fi
1676 \let\XeKo@next\XeKo@make@josa@
1677 \ifnum\XeKo@count@<"30 % 0
1678 \else\ifnum\XeKo@count@<"3A
1679 \advance\XeKo@count@-"30 \let\XeKo@next\XeKo@num@josa
1680 \else\ifnum\XeKo@count@<"41
1681 \else\ifnum\XeKo@count@<"7B \let\XeKo@next\XeKo@alph@josa
1682 \else\ifnum\XeKo@count@<"2160 % roman numneral I
1683 \else\ifnum\XeKo@count@<"216C
1684 \advance\XeKo@count@-"215F \let\XeKo@next\XeKo@num@josa
1685 \else\ifnum\XeKo@count@<"2170 % roman numneral i
1686 \else\ifnum\XeKo@count@<"217C
1687 \advance\XeKo@count@-"216F \let\XeKo@next\XeKo@num@josa
1688 \else\ifnum\XeKo@count@<"2460 % ①
1689 \else\ifnum\XeKo@count@<"249C % ⒜
1690 \advance\XeKo@count@-"245F \let\XeKo@next\XeKo@num@josa
1691 \else\ifnum\XeKo@count@<"24B6 % Ⓐ
1692 \advance\XeKo@count@-"245B \let\XeKo@next\XeKo@alph@josa
1693 \else\ifnum\XeKo@count@<"24D0 % ⓐ
1694 \advance\XeKo@count@-"2475 \let\XeKo@next\XeKo@alph@josa
1695 \else\ifnum\XeKo@count@<"24EA
1696 \advance\XeKo@count@-"248F \let\XeKo@next\XeKo@alph@josa
1697 \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi \fi\fi\fi
1698 \XeKo@next
1699 }
1700 \def\XeKo@make@josa@{%
1701 \ifnum\XeKo@count@<"3260 % ㉠
1702 \else\ifnum\XeKo@count@<"3280
1703 \advance\XeKo@count@-"60
1704 \fi\fi
1705 \let\XeKo@next\XeKo@make@josa@@
1706 \ifnum\XeKo@count@<"3131 % ㄱ
1707 \else\ifnum\XeKo@count@<"318F
1708 \ifnum \XeKo@count@="3139 \XeKo@count@\@ne
1709 \else\ifnum\XeKo@count@<"314F \XeKo@count@\z@
1710 \else\ifnum\XeKo@count@>"3164
1711 \ifnum\XeKo@count@<"3187 \XeKo@count@\z@ \fi
1712 \fi\fi\fi
1713 \let\XeKo@next\XeKo@do@make@josa
1714 \else\ifnum\XeKo@count@<"3200 % ㈀
1715 \else\ifnum\XeKo@count@<"321F
1716 \ifnum \XeKo@count@="3203 \XeKo@count@\@ne
1717 \else\ifnum\XeKo@count@<"320E \XeKo@count@\z@
1718 \fi\fi
1719 \let\XeKo@next\XeKo@do@make@josa
1720 \fi\fi\fi\fi
1721 \XeKo@next
1722 }
1723 \def\XeKo@make@josa@@{%
1724 \ifnum\XeKo@count@<"3400 \else\ifnum\XeKo@count@<"4DB6
1725 \advance\XeKo@count@-"3400 \XeKo@read@hanja@hangul@file{hanjaexa_hangul.tab}%
1726 \else\ifnum\XeKo@count@<"4E00 \else\ifnum\XeKo@count@<"9FA6
1727 \advance\XeKo@count@-"4E00 \XeKo@read@hanja@hangul@file{hanja_hangul.tab}%
1728 \else\ifnum\XeKo@count@<"F900 \else\ifnum\XeKo@count@<"FA2E
1729 \advance\XeKo@count@-"F900 \XeKo@read@hanja@hangul@file{hanjacom_hangul.tab}%
1730 \fi\fi\fi\fi\fi \fi
1731 \ifnum\XeKo@count@<"AC00 \else\ifnum\XeKo@count@<"D7A4 % Hangul syllables
1732 \advance\XeKo@count@-"AC00
1733 \@tempcnta\XeKo@count@ \divide\@tempcnta28 \multiply\@tempcnta28
1734 \advance\XeKo@count@-\@tempcnta \advance\XeKo@count@"11A7
1735 \fi\fi
1736 \ifnum\XeKo@count@<"11A8
1737 \else\ifnum\XeKo@count@<"1200
1738 \ifnum\XeKo@count@="11AF \XeKo@count@\@ne \else \XeKo@count@\z@ \fi
1739 \else\ifnum\XeKo@count@<"D7CB
1740 \else\ifnum\XeKo@count@<"D7FC
1741 \XeKo@count@\z@
1742 \fi\fi\fi\fi
1743 \XeKo@do@make@josa
1744 }
1745 \def\XeKo@do@make@josa#1#2{%
1746 \ifcase\XeKo@count@ #2% jong
1747 \or \ifx#1\empty\else#2\fi % rieul
1748 \else #1% jung
1749 \fi
1750 }
1751
1752 % dotemph
1753 \def\dotemphraise{0.4em }
1754 \ifcsname bfseries\endcsname
1755 \def\dotemphchar{\bfseries ^^^^02d9}
1756 \else
1757 \def\dotemphchar{\bf \char95 }
1758 \fi
1759
1760 \newbox\XeKo@dotemph@box
1761 \let\XeKo@maybe@dotemph\relax
1762
1763 \protected\def\dotemph#1{%
1764 \leavevmode
1765 \setbox\XeKo@dotemph@box\hbox{\raise\dotemphraise\hbox{\dotemphchar}}%
1766 \begingroup
1767 \let\XeKo@maybe@dotemph\XeKo@do@dotemph
1768 #1\relax
1769 \endgroup
1770 }
1771 \def\XeKo@do@dotemph{%
1772 \XeKo@check@hangulTM % 방점 너비를 감안하자
1773 \setbox\z@\hbox{\the\XeKo@toks@}%
1774 \setbox\tw@\hbox to\wd\z@{%
1775 \hss
1776 \ifnum\XeKo@has@hangulTM>\z@
1777 \kern\fontcharwd\font\XeKo@has@hangulTM
1778 \fi
1779 \unhcopy\XeKo@dotemph@box
1780 \hss
1781 }\wd\tw@\z@ \ht\tw@\z@ \dp\tw@\z@
1782 \box\tw@
1783 }
1784 \def\XeKo@check@hangulTM{%
1785 \chardef\XeKo@has@hangulTM\z@
1786 \expandafter\XeKo@check@hangulTM@e \the\XeKo@toks@ ^^^^302e\relax
1787 \ifnum\XeKo@has@hangulTM=\z@
1788 \expandafter\XeKo@check@hangulTM@f \the\XeKo@toks@ ^^^^302f\relax
1789 \fi
1790 }
1791 \def\XeKo@check@hangulTM@e#1^^^^302e#2\relax{%
1792 \ifx\empty#2\empty \else
1793 \chardef\XeKo@has@hangulTM="302E
1794 \fi
1795 }
1796 \def\XeKo@check@hangulTM@f#1^^^^302f#2\relax{%
1797 \ifx\empty#2\empty \else
1798 \chardef\XeKo@has@hangulTM="302F
1799 \fi
1800 }
1801
1802 % other commands
1803 \let\enablecjksymbolspacing\compresspunctuations
1804 \let\disablecjksymbolspacing\nocompresspunctuations
1805 \protected\def\disablekoreanfonts{%
1806 \let\XeKo@fontHG\relax
1807 \let\XeKo@fontID\relax
1808 \let\XeKo@fontCJ\relax
1809 \let\XeKo@fontSY\relax
1810 \let\XeKo@fontAA\relax
1811 \let\XeKo@fontAO\relax
1812 \let\XeKo@fontAC\relax
1813 \let\XeKo@fontAP\relax
1814 \let\XeKo@fontAM\relax
1815 \let\XeKo@fontAH\relax
1816 \let\XeKo@fontOP\relax
1817 \let\XeKo@fontCL\relax
1818 \let\XeKo@fontMD\relax
1819 \let\XeKo@fontFS\relax
1820 \let\XeKo@fontEX\relax
1821 \let\XeKo@fontLD\relax
1822 \let\XeKo@fontVC\relax
1823 }
1824 \protected\def\disablehangulspacing{%
1825 \let\XeKo@halfzero \inhibitglue
1826 \let\XeKo@halfhalf \inhibitglue
1827 \let\XeKo@halfquarter \inhibitglue
1828 \let\XeKo@quarterquarter \inhibitglue
1829 \let\XeKo@iiiquarterquarter \inhibitglue
1830 \let\XeKo@latincjk \inhibitglue
1831 \let\XeKo@postmath \inhibitglue
1832 \let\XKinterhangulbreak \inhibitglue
1833 \let\XKinterhanjabreak \inhibitglue
1834 \let\XeKo@latincjk@classic \inhibitglue
1835 \let\XeKo@latincjk@modern \inhibitglue
1836 \let\XeKo@postmath@modern \inhibitglue
1837 \let\XeKo@suppress@linebreak \relax
1838 \chardef\XeKo@cjk@ignorespaces \z@
1839 \chardef\XeKo@compresspuncts \z@
1840 }
1841 \protected\def\disablehangulspacingandlinebreak{%
1842 \let\inhibitglue \relax
1843 \chardef\XeKo@hangingpuncts \z@
1844 \disablehangulspacing
1845 \XeTeXlinebreaklocale""
1846 }
1847 \protected\def\enablehangulspacingandlinebreak{%
1848 \XeTeXinterchartokenstate\@ne
1849 \XeTeXlinebreaklocale"ko"
1850 }
1851 \enablehangulspacingandlinebreak
1852 % no longer support these two \disable...
1853 \let\disableautojosa\relax
1854 \let\disablejamoautojosa\relax
1855 % ulem support
1856 \protected\def\XeKo@UL@dotemph#1{%
1857 \ifx\ \LA@space\else \UL@stop\fi
1858 \leavevmode
1859 \setbox\XeKo@dotemph@box\hbox{\raise\dotemphraise\hbox{\dotemphchar}}%
1860 \begingroup
1861 \let\XeKo@maybe@dotemph\XeKo@do@dotemph
1862 \XeKo@UL@dotemph@#1 ^^^^ffff \relax
1863 \endgroup
1864 \ifx\ \LA@space\else \UL@start\fi
1865 }
1866 \def\XeKo@UL@dotemph@#1 {%
1867 \ifx^^^^ffff#1\relax
1868 \unskip\unskip\unskip
1869 \else
1870 \ifx\ \LA@space
1871 #1\ %
1872 \else
1873 \UL@start
1874 #1\ %
1875 \UL@stop
1876 \fi
1877 \expandafter\XeKo@UL@dotemph@
1878 \fi
1879 }
1880 \def\xetexkoulemsupport{%
1881 \let\XeKo@UL@stop\UL@stop
1882 \UL@hook\expandafter{\the\UL@hook
1883 \let\dotemph\XeKo@UL@dotemph
1884 % uline 안에서 폰트가 변경되는 경우를 대비
1885 \def\UL@stop{%
1886 \global\let\XeKo@UL@tmp@latinfont \XeKo@latin@font
1887 \global\let\XeKo@UL@tmp@hangulfont \XeKo@hangul@font
1888 \global\let\XeKo@UL@tmp@hanjafont \XeKo@hanja@font
1889 \global\let\XeKo@UL@tmp@rawhangulfont \XeKo@raw@hangul@font
1890 \global\let\XeKo@UL@tmp@rawhanjafont \XeKo@raw@hanja@font
1891 \expandafter \XeKo@UL@stop \the\font
1892 \let\XeKo@latin@font \XeKo@UL@tmp@latinfont
1893 \let\XeKo@hangul@font \XeKo@UL@tmp@hangulfont
1894 \let\XeKo@hanja@font \XeKo@UL@tmp@hanjafont
1895 \let\XeKo@raw@hangul@font \XeKo@UL@tmp@rawhangulfont
1896 \let\XeKo@raw@hanja@font \XeKo@UL@tmp@rawhanjafont
1897 }%
1898 }}
1899
1900 % math hangul
1901 \def\setmathhangulblock#1#2{%
1902 \count@="#1
1903 \loop
1904 \Umathcode\count@ = 7 \symmathhangul\count@
1905 \ifnum\count@<"#2 \advance\count@\@ne
1906 \repeat
1907 }
1908
1909 %%% plain
1910 \ifcsname [email protected]\endcsname \else
1911 \def\verticaltypesetting{%
1912 \dimen@\hsize \hsize\vsize \vsize\dimen@
1913 \edef\plainoutput{\dimen@\hsize \hsize\vsize \vsize\dimen@
1914 \unexpanded\expandafter{\plainoutput}}%
1915 \def\pagebody{\setbox\z@\vbox to\hsize{\boxmaxdepth=\maxdepth \pagecontents}%
1916 \XeKo@rotatebox\z@\box\z@}%
1917 \typesetvertical
1918 \let\verticaltypesetting\relax % prevent multiple running
1919 }
1920 \def\beginverticaltypesetting{\vfill\supereject \begingroup \verticaltypesetting}
1921 \def\endverticaltypesetting{\vfill\supereject \endgroup}
1922 % hangul fonts
1923 \protected\def\hangulfont{%
1924 \afterassignment\XeKo@hangulfont@setup\font\XeKo@hangul@font
1925 }
1926 \def\XeKo@hangulfont@setup{%
1927 \edef\XeKo@hangul@font{%
1928 \the\XeKo@hangul@font
1929 \ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
1930 \ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
1931 \ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
1932 }%
1933 }
1934 \protected\def\sethangulfont#1{%
1935 \def\@tempa{#1}%
1936 \edef\@tempb{\string#1}%
1937 \expandafter\afterassignment\expandafter\XeKo@sethangulfont@setup
1938 \expandafter\font\csname XeKo@hangul@font@\@tempb\endcsname
1939 }
1940 \def\XeKo@sethangulfont@setup{%
1941 \expandafter\edef\@tempa{%
1942 \def\noexpand\XeKo@hangul@font{%
1943 \csname XeKo@hangul@font@\@tempb\endcsname
1944 \ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
1945 \ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
1946 \ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
1947 }%
1948 }%
1949 }
1950 \protected\def\hanjafont{%
1951 \afterassignment\XeKo@hanjafont@setup\font\XeKo@hanja@font
1952 }
1953 \def\XeKo@hanjafont@setup{%
1954 \edef\XeKo@hanja@font{%
1955 \the\XeKo@hanja@font
1956 \ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
1957 \ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
1958 \ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
1959 }%
1960 }
1961 \protected\def\sethanjafont#1{%
1962 \def\@tempa{#1}%
1963 \edef\@tempb{\string#1}%
1964 \expandafter\afterassignment\expandafter\XeKo@sethanjafont@setup
1965 \expandafter\font\csname XeKo@hanja@font@\@tempb\endcsname
1966 }
1967 \def\XeKo@sethanjafont@setup{%
1968 \expandafter\edef\@tempa{%
1969 \def\noexpand\XeKo@hanja@font{%
1970 \csname XeKo@hanja@font@\@tempb\endcsname
1971 \ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
1972 \ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
1973 \ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
1974 }%
1975 }%
1976 }
1977 \protected\def\hanjabyhangulfont{\let\XeKo@hanja@font\XeKo@hangul@font }
1978 % math hangul
1979 \protected\def\setmathhangulfonts#1#2#3{% font identifiers
1980 \ifnum\Umathcodenum"AC00="AC00\relax
1981 \csname newfam\endcsname\symmathhangul
1982 \setmathhangulblock{AC00}{D7A3}%
1983 \fi
1984 \textfont\symmathhangul=#1\relax
1985 \scriptfont\symmathhangul=#2\relax
1986 \scriptscriptfont\symmathhangul=#3\relax
1987 }
1988 \protected\def\mathhangulfont{%
1989 \afterassignment\xetexkosetmathhangulfonts\font\textmathhangul
1990 }
1991 \def\xetexkosetmathhangulfonts{%
1992 \edef\@tempa{%
1993 \expandafter\expandafter\expandafter\XeKo@strip@at@size@from@font
1994 \expandafter\fontname\expandafter\textmathhangul\detokenize{ at }\relax
1995 }%
1996 \dimen@\fontdimen 6 \textmathhangul
1997 \font\scriptmathhangul= \@tempa\space at .7\dimen@
1998 \font\scriptscriptmathhangul = \@tempa\space at .5\dimen@
1999 \setmathhangulfonts\textmathhangul\scriptmathhangul\scriptscriptmathhangul
2000 }
2001 \expandafter\def\expandafter\XeKo@strip@at@size@from@font
2002 \expandafter#\expandafter1\detokenize{ at }#2\relax{#1}
2003 % default unbatang
2004 \hangulfont="[UnBatang.ttf]:mapping=tex-text;script=hang" at 10pt
2005 \hanjabyhangulfont
2006 \XeKocatcodeofATchar
2007 \endinput\fi
2008
2009 %%% latex
2010
2011 \def\verticaltypesetting{%
2012 \ifx\@nodocument\relax % not in the preamble
2013 \clearpage
2014 \begingroup
2015 \fi
2016 \hsize\textheight \vsize\textwidth
2017 \textwidth\hsize \textheight\vsize
2018 \@colroom\vsize \@colht\vsize
2019 \if@twocolumn
2020 \columnwidth=.5\dimexpr\textwidth-\columnsep\relax
2021 \linewidth\columnwidth \hsize\columnwidth
2022 \else
2023 \linewidth\hsize \columnwidth\hsize
2024 \fi
2025 \AddToHook{build/page/before}[xetexko/beforeOR]{%
2026 \XeKo@rotatebox\@outputbox
2027 \textwidth\textheight
2028 }%
2029 \typesetvertical
2030 \let\verticaltypesetting\relax % prevent multiple running
2031 }
2032 \def\endverticaltypesetting{%
2033 \clearpage
2034 \RemoveFromHook{build/page/before}[xetexko/beforeOR]%
2035 \endgroup
2036 \global\@colroom\textheight
2037 \global\@colht\textheight
2038 \global\vsize\textheight
2039 }
2040
2041 \RequirePackage{fontspec}[2020/02/03]
2042 \AddToHook{rmfamily}{%
2043 \let \xetexkohangulfont \xetexkomainhangulfont
2044 \let \xetexkohanguloption \xetexkomainhanguloption
2045 \let \xetexkohanjafont \xetexkomainhanjafont
2046 \let \xetexkohanjaoption \xetexkomainhanjaoption
2047 }
2048 \AddToHook{sffamily}{%
2049 \let \xetexkohangulfont \xetexkosanshangulfont
2050 \let \xetexkohanguloption \xetexkosanshanguloption
2051 \let \xetexkohanjafont \xetexkosanshanjafont
2052 \let \xetexkohanjaoption \xetexkosanshanjaoption
2053 }
2054 \AddToHook{ttfamily}{%
2055 \let \xetexkohangulfont \xetexkomonohangulfont
2056 \let \xetexkohanguloption \xetexkomonohanguloption
2057 \let \xetexkohanjafont \xetexkomonohanjafont
2058 \let \xetexkohanjaoption \xetexkomonohanjaoption
2059 \latinalphs\latinparens\latinpuncts\latincolons\latinhyphens
2060 \disablehangulspacing
2061 }
2062 \AddToHook{cmd/verbatim@font/after}{%
2063 \disablehangulspacingandlinebreak
2064 \aftergroup\enablehangulspacingandlinebreak
2065 }
2066 \AddToHook{normalfont}{%
2067 \let \xetexkohangulfont \xetexkodefaulthangulfont
2068 \let \xetexkohanguloption \xetexkodefaulthanguloption
2069 \let \xetexkohanjafont \xetexkodefaulthanjafont
2070 \let \xetexkohanjaoption \xetexkodefaulthanjaoption
2071 }
2072 \AddToHook{env/picture/begin}{%
2073 \latinalphs\latinparens\latinpuncts\latincolons\latinhyphens
2074 }
2075 \def\XeKo@hangul@selectfont{%
2076 \ifdefined\XeKo@in@selectfont\else
2077 \ifdefined\xetexkohangulfont
2078 \begingroup
2079 \let\XeKo@in@selectfont\empty
2080 \xetexkohangulfont
2081 \edef\x{\endgroup
2082 \def\noexpand\XeKo@hangul@font{\the\font
2083 \unexpanded\expandafter{\xetexkohanguloption}}%
2084 }\x
2085 \xetexkohanguloption % for 영문자-한글 interlatincjk
2086 \else
2087 \let\XeKo@hangul@font\XeKo@undefined
2088 \fi
2089 \fi
2090 }
2091 \def\XeKo@hanja@selectfont{%
2092 \ifdefined\XeKo@in@selectfont\else
2093 \ifdefined\xetexkohanjafont
2094 \begingroup
2095 \let\XeKo@in@selectfont\empty
2096 \xetexkohanjafont
2097 \edef\x{\endgroup
2098 \def\noexpand\XeKo@hanja@font{\the\font
2099 \unexpanded\expandafter{\xetexkohanjaoption}}%
2100 }\x
2101 \xetexkohanjaoption
2102 \else
2103 \let\XeKo@hanja@font\XeKo@undefined
2104 \fi
2105 \fi }
2106
2107 \let\XeKo@selectfont\selectfont
2108
2109 \ExplSyntaxOn
2110 \AddToHook{selectfont}
2111 {
2112 \fontspec_if_current_script:nTF {math} {} % unless unicode-math font
2113 {
2114 \XeKo@hanja@selectfont
2115 \XeKo@hangul@selectfont
2116 }
2117 }
2118 \tl_new:N \l_xtxko_font_opts_tl
2119 \tl_new:N \l_xtxko_rest_opts_tl
2120 \keys_define:nn { xtxko-font }
2121 {
2122 hu .code:n = { \__xtxko_add_font_opt:Nn \xetexkohu {#1} } ,
2123 interhchar .code:n = { \__xtxko_add_font_opt:Nn \xetexkointerhchar {#1} } ,
2124 charraise .code:n = { \__xtxko_add_font_opt:Nn \xetexkocharraise {#1} } ,
2125 InterLatinCJK .meta:n = { hu = {#1} } ,
2126 InterHangul .meta:n = { interhchar = {#1} } ,
2127 CharRaise .meta:n = { charraise = {#1} } ,
2128 lowerexclamation .code:n = { },
2129 lowerperiod .code:n = { },
2130 lowercomma .code:n = { },
2131 lowerquestion .code:n = { },
2132 postexclamationkern .code:n = { },
2133 postmathskip .code:n = { },
2134 postperiodkern .code:n = { },
2135 postcommakern .code:n = { },
2136 postquestionkern .code:n = { },
2137 preexclamationkern .code:n = { },
2138 preperiodkern .code:n = { },
2139 precommakern .code:n = { },
2140 prequestionkern .code:n = { },
2141 quoteraise .code:n = { },
2142 quotewidth .code:n = { },
2143 PunctRaise .code:n = { },
2144 }
2145 \cs_new:Nn \__xtxko_add_font_opt:Nn
2146 {
2147 \tl_put_right:Nn \l_xtxko_font_opts_tl { \cs_set_nopar:Npn #1 {#2} }
2148 }
2149 \cs_new:Nn \__xtxko_assign_font_opts:n
2150 {
2151 \tl_clear:N \l_xtxko_font_opts_tl
2152 \keys_set_known:neN { xtxko-font } {#1} \l_xtxko_rest_opts_tl
2153 }
2154 \DeclareDocumentCommand \setmainhangulfont { O{} m O{} }
2155 {
2156 \__xtxko_assign_font_opts:n { #1, #3 }
2157 \fontspec_set_family:Nnn \XeKo@mainhangulfamily { Ligatures=TeX, \l_xtxko_rest_opts_tl } { #2 }
2158 \cs_set_protected_nopar:Npn \xetexkomainhangulfont
2159 {
2160 \fontencoding \g_fontspec_encoding_tl \fontfamily \XeKo@mainhangulfamily \XeKo@selectfont
2161 }
2162 \cs_set_eq:NN \xetexkomainhanguloption \l_xtxko_font_opts_tl
2163 \str_if_eq:eeT \familydefault \rmdefault
2164 {
2165 \cs_set_eq:NN \xetexkohangulfont \xetexkomainhangulfont
2166 \cs_set_eq:NN \xetexkohanguloption \xetexkomainhanguloption
2167 \cs_set_eq:NN \xetexkodefaulthangulfont \xetexkomainhangulfont
2168 \cs_set_eq:NN \xetexkodefaulthanguloption \xetexkomainhanguloption
2169 \XeKo@hangul@selectfont
2170 }
2171 \ignorespaces
2172 }
2173 \DeclareDocumentCommand \setsanshangulfont { O{} m O{} }
2174 {
2175 \__xtxko_assign_font_opts:n { #1, #3 }
2176 \fontspec_set_family:Nnn \XeKo@sanshangulfamily { Ligatures=TeX, \l_xtxko_rest_opts_tl } { #2 }
2177 \cs_set_protected_nopar:Npn \xetexkosanshangulfont
2178 {
2179 \fontencoding \g_fontspec_encoding_tl \fontfamily \XeKo@sanshangulfamily \XeKo@selectfont
2180 }
2181 \cs_set_eq:NN \xetexkosanshanguloption \l_xtxko_font_opts_tl
2182 \str_if_eq:eeT \familydefault \sfdefault
2183 {
2184 \cs_set_eq:NN \xetexkohangulfont \xetexkosanshangulfont
2185 \cs_set_eq:NN \xetexkohanguloption \xetexkosanshanguloption
2186 \cs_set_eq:NN \xetexkodefaulthangulfont \xetexkosanshangulfont
2187 \cs_set_eq:NN \xetexkodefaulthanguloption \xetexkosanshanguloption
2188 \XeKo@hangul@selectfont
2189 }
2190 \ignorespaces
2191 }
2192 \DeclareDocumentCommand \setmonohangulfont { O{} m O{} }
2193 {
2194 \__xtxko_assign_font_opts:n { #1, #3 }
2195 \fontspec_set_family:Nnn \XeKo@monohangulfamily { \l_xtxko_rest_opts_tl } { #2 }
2196 \cs_set_protected_nopar:Npn \xetexkomonohangulfont
2197 {
2198 \fontencoding \g_fontspec_encoding_tl \fontfamily \XeKo@monohangulfamily \XeKo@selectfont
2199 }
2200 \cs_set_eq:NN \xetexkomonohanguloption \l_xtxko_font_opts_tl
2201 \str_if_eq:eeT \familydefault \ttdefault
2202 {
2203 \cs_set_eq:NN \xetexkohangulfont \xetexkomonohangulfont
2204 \cs_set_eq:NN \xetexkohanguloption \xetexkomonohanguloption
2205 \cs_set_eq:NN \xetexkodefaulthangulfont \xetexkomonohangulfont
2206 \cs_set_eq:NN \xetexkodefaulthanguloption \xetexkomonohanguloption
2207 \XeKo@hangul@selectfont
2208 }
2209 \ignorespaces
2210 }
2211 \DeclareDocumentCommand \newhangulfontfamily { m O{} m O{} }
2212 {
2213 \__xtxko_assign_font_opts:n { #2, #4 }
2214 \fontspec_set_family:cnn { xetexko_user_family_ \cs_to_str:N #1 } { \l_xtxko_rest_opts_tl } { #3 }
2215 \cs_set_nopar:cpn { xetexko_user_font_ \cs_to_str:N #1 }
2216 {
2217 \fontencoding \g_fontspec_encoding_tl
2218 \exp_args:Nc \fontfamily { xetexko_user_family_ \cs_to_str:N #1 } \XeKo@selectfont
2219 }
2220 \cs_set_nopar:cpe { xetexko_user_option_ \cs_to_str:N #1 }
2221 {
2222 \exp_not:o { \l_xtxko_font_opts_tl }
2223 }
2224 \cs_set_protected_nopar:Npn #1
2225 {
2226 \cs_set_eq:Nc \xetexkohangulfont { xetexko_user_font_ \cs_to_str:N #1 }
2227 \cs_set_eq:Nc \xetexkohanguloption { xetexko_user_option_ \cs_to_str:N #1 }
2228 \XeKo@hangul@selectfont
2229 }
2230 \ignorespaces
2231 }
2232 \DeclareDocumentCommand \newhangulfontface { m O{} m O{} }
2233 {
2234 \newhangulfontfamily #1 { #3 } [ BoldFont={}, ItalicFont={}, SmallCapsFont={}, #2, #4 ]
2235 }
2236 \DeclareDocumentCommand \hangulfontspec { O{} m O{} }
2237 {
2238 \__xtxko_assign_font_opts:n { #1, #3 }
2239 \fontspec_set_family:Nnn \xetexkohangulfontfamily { \l_xtxko_rest_opts_tl } { #2 }
2240 \cs_set_nopar:Npn \xetexkohangulfont
2241 {
2242 \fontencoding \g_fontspec_encoding_tl
2243 \fontfamily \xetexkohangulfontfamily \XeKo@selectfont
2244 }
2245 \cs_set_nopar:Npe \xetexkohanguloption
2246 {
2247 \exp_not:o { \l_xtxko_font_opts_tl }
2248 }
2249 \XeKo@hangul@selectfont
2250 \ignorespaces
2251 }
2252 \cs_set_eq:NN \adhochangulfont \hangulfontspec
2253 \DeclareDocumentCommand \addhangulfontfeature { m }
2254 {
2255 \group_begin:
2256 \fontseries\seriesdefault\fontshape\shapedefault \xetexkohangulfont
2257 \cs_set_eq:NN \l_xtxko_font_opts_tl \xetexkohanguloption
2258 \keys_set_known:neN { xtxko-font } { #1 } \l_xtxko_rest_opts_tl
2259 \addfontfeature { \l_xtxko_rest_opts_tl }
2260 \use:e
2261 {
2262 \group_end:
2263 \exp_not:N \cs_set_nopar:Npn \exp_not:N \xetexkohangulfont
2264 {
2265 \exp_not:N \fontencoding { \f@encoding }
2266 \exp_not:N \fontfamily { \f@family }
2267 \exp_not:N \XeKo@selectfont
2268 }
2269 \exp_not:N \cs_set_nopar:Npn \exp_not:N \xetexkohanguloption
2270 {
2271 \exp_not:o { \l_xtxko_font_opts_tl }
2272 }
2273 }
2274 \XeKo@hangul@selectfont
2275 \ignorespaces
2276 }
2277 \cs_set_eq:NN \addhangulfontfeatures \addhangulfontfeature
2278 \DeclareDocumentCommand \setmainhanjafont { O{} m O{} }
2279 {
2280 \__xtxko_assign_font_opts:n { #1, #3 }
2281 \fontspec_set_family:Nnn \XeKo@mainhanjafamily { Ligatures=TeX, \l_xtxko_rest_opts_tl } { #2 }
2282 \cs_set_protected_nopar:Npn \xetexkomainhanjafont
2283 {
2284 \fontencoding \g_fontspec_encoding_tl \fontfamily \XeKo@mainhanjafamily \XeKo@selectfont
2285 }
2286 \cs_set_eq:NN \xetexkomainhanjaoption \l_xtxko_font_opts_tl
2287 \str_if_eq:eeT \familydefault \rmdefault
2288 {
2289 \cs_set_eq:NN \xetexkohanjafont \xetexkomainhanjafont
2290 \cs_set_eq:NN \xetexkohanjaoption \xetexkomainhanjaoption
2291 \cs_set_eq:NN \xetexkodefaulthanjafont \xetexkomainhanjafont
2292 \cs_set_eq:NN \xetexkodefaulthanjaoption \xetexkomainhanjaoption
2293 \XeKo@hanja@selectfont
2294 }
2295 \ignorespaces
2296 }
2297 \DeclareDocumentCommand \setsanshanjafont { O{} m O{} }
2298 {
2299 \__xtxko_assign_font_opts:n { #1, #3 }
2300 \fontspec_set_family:Nnn \XeKo@sanshanjafamily { Ligatures=TeX, \l_xtxko_rest_opts_tl } { #2 }
2301 \cs_set_protected_nopar:Npn \xetexkosanshanjafont
2302 {
2303 \fontencoding \g_fontspec_encoding_tl \fontfamily \XeKo@sanshanjafamily \XeKo@selectfont
2304 }
2305 \cs_set_eq:NN \xetexkosanshanjaoption \l_xtxko_font_opts_tl
2306 \str_if_eq:eeT \familydefault \sfdefault
2307 {
2308 \cs_set_eq:NN \xetexkohanjafont \xetexkosanshanjafont
2309 \cs_set_eq:NN \xetexkohanjaoption \xetexkosanshanjaoption
2310 \cs_set_eq:NN \xetexkodefaulthanjafont \xetexkosanshanjafont
2311 \cs_set_eq:NN \xetexkodefaulthanjaoption \xetexkosanshanjaoption
2312 \XeKo@hanja@selectfont
2313 }
2314 \ignorespaces
2315 }
2316 \DeclareDocumentCommand \setmonohanjafont { O{} m O{} }
2317 {
2318 \__xtxko_assign_font_opts:n { #1, #3 }
2319 \fontspec_set_family:Nnn \XeKo@monohanjafamily { \l_xtxko_rest_opts_tl } { #2 }
2320 \cs_set_protected_nopar:Npn \xetexkomonohanjafont
2321 {
2322 \fontencoding \g_fontspec_encoding_tl \fontfamily \XeKo@monohanjafamily \XeKo@selectfont
2323 }
2324 \cs_set_eq:NN \xetexkomonohanjaoption \l_xtxko_font_opts_tl
2325 \str_if_eq:eeT \familydefault \ttdefault
2326 {
2327 \cs_set_eq:NN \xetexkohanjafont \xetexkomonohanjafont
2328 \cs_set_eq:NN \xetexkohanjaoption \xetexkomonohanjaoption
2329 \cs_set_eq:NN \xetexkodefaulthanjafont \xetexkomonohanjafont
2330 \cs_set_eq:NN \xetexkodefaulthanjaoption \xetexkomonohanjaoption
2331 \XeKo@hanja@selectfont
2332 }
2333 \ignorespaces
2334 }
2335 \DeclareDocumentCommand \newhanjafontfamily { m O{} m O{} }
2336 {
2337 \__xtxko_assign_font_opts:n { #2, #4 }
2338 \fontspec_set_family:cnn { xetexko_user_family_ \cs_to_str:N #1 } { \l_xtxko_rest_opts_tl } { #3 }
2339 \cs_set_nopar:cpn { xetexko_user_font_ \cs_to_str:N #1 }
2340 {
2341 \fontencoding \g_fontspec_encoding_tl
2342 \exp_args:Nc \fontfamily { xetexko_user_family_ \cs_to_str:N #1 } \XeKo@selectfont
2343 }
2344 \cs_set_nopar:cpe { xetexko_user_option_ \cs_to_str:N #1 }
2345 {
2346 \exp_not:o { \l_xtxko_font_opts_tl }
2347 }
2348 \cs_set_protected_nopar:Npn #1
2349 {
2350 \cs_set_eq:Nc \xetexkohanjafont { xetexko_user_font_ \cs_to_str:N #1 }
2351 \cs_set_eq:Nc \xetexkohanjaoption { xetexko_user_option_ \cs_to_str:N #1 }
2352 \XeKo@hanja@selectfont
2353 }
2354 \ignorespaces
2355 }
2356 \DeclareDocumentCommand \newhanjafontface { m O{} m O{} }
2357 {
2358 \newhanjafontfamily #1 { #3 } [ BoldFont={}, ItalicFont={}, SmallCapsFont={}, #2, #4 ]
2359 }
2360 \DeclareDocumentCommand \hanjafontspec { O{} m O{} }
2361 {
2362 \__xtxko_assign_font_opts:n { #1, #3 }
2363 \fontspec_set_family:Nnn \xetexkohanjafontfamily { \l_xtxko_rest_opts_tl } { #2 }
2364 \cs_set_nopar:Npn \xetexkohanjafont
2365 {
2366 \fontencoding \g_fontspec_encoding_tl
2367 \fontfamily \xetexkohanjafontfamily \XeKo@selectfont
2368 }
2369 \cs_set_nopar:Npe \xetexkohanjaoption
2370 {
2371 \exp_not:o { \l_xtxko_font_opts_tl }
2372 }
2373 \XeKo@hanja@selectfont
2374 \ignorespaces
2375 }
2376 \cs_set_eq:NN \adhochanjafont \hanjafontspec
2377 \DeclareDocumentCommand \addhanjafontfeature { m }
2378 {
2379 \group_begin:
2380 \fontseries\seriesdefault\fontshape\shapedefault \xetexkohanjafont
2381 \cs_set_eq:NN \l_xtxko_font_opts_tl \xetexkohanjaoption
2382 \keys_set_known:neN { xtxko-font } { #1 } \l_xtxko_rest_opts_tl
2383 \addfontfeature { \l_xtxko_rest_opts_tl }
2384 \use:e
2385 {
2386 \group_end:
2387 \exp_not:N \cs_set_nopar:Npn \exp_not:N \xetexkohanjafont
2388 {
2389 \exp_not:N \fontencoding { \f@encoding }
2390 \exp_not:N \fontfamily { \f@family }
2391 \exp_not:N \XeKo@selectfont
2392 }
2393 \exp_not:N \cs_set_nopar:Npn \exp_not:N \xetexkohanjaoption
2394 {
2395 \exp_not:o { \l_xtxko_font_opts_tl }
2396 }
2397 }
2398 \XeKo@hanja@selectfont
2399 \ignorespaces
2400 }
2401 \cs_set_eq:NN \addhanjafontfeatures \addhanjafontfeature
2402 % math hangul
2403 \DeclareDocumentCommand \setmathhangulfont { O{} m O{} }
2404 {
2405 \fontspec_set_family:Nnn \xetexkomathhangulfamily { #1, #3 } { #2 }
2406 \DeclareSymbolFont { mathhangul }
2407 \g_fontspec_encoding_tl \xetexkomathhangulfamily \seriesdefault \shapedefault
2408 \int_compare:nNnT { \Umathcodenum"AC00 } = { "AC00 }
2409 {
2410 \setmathhangulblock{AC00}{D7A3}
2411 }
2412 \ignorespaces
2413 }
2414 % xetexkofontregime
2415 \keys_define:nn { xtxko-char }
2416 {
2417 alphs .code:n = \use:c { #1alphs } ,
2418 parens .code:n = \use:c { #1parens } ,
2419 puncts .code:n = \use:c { #1puncts } ,
2420 colons .code:n = \use:c { #1colons } ,
2421 hyphens .code:n = \use:c { #1hyphens } ,
2422 cjksymbols .code:n = \use:c { #1cjksymbols } ,
2423 nums .meta:n = { alphs = {#1} },
2424 quotes .meta:n = { parens = {#1} },
2425 }
2426 \DeclareDocumentCommand \xetexkofontregime { O{} m O{} }
2427 {
2428 \use:c { #2marks }
2429 \keys_set:nn { xtxko-char } { #1, #3 }
2430 }
2431 % no longer support default hangul/hanja fontfeatures
2432 \DeclareDocumentCommand \defaulthangulfontfeatures { t+ o m } { }
2433 \cs_set_eq:NN \defaulthanjafontfeatures \defaulthangulfontfeatures
2434 \ExplSyntaxOff
2435
2436 \protected\def\hanjabyhangulfont{%
2437 \let\xetexkomainhanjafont \xetexkomainhangulfont
2438 \let\xetexkomainhanjaoption \xetexkomainhanguloption
2439 \let\xetexkosanshanjafont \xetexkosanshangulfont
2440 \let\xetexkosanshanjaoption \xetexkosanshanguloption
2441 \let\xetexkomonohanjafont \xetexkomonohangulfont
2442 \let\xetexkomonohanjaoption \xetexkomonohanguloption
2443 \let\xetexkodefaulthanjafont \xetexkodefaulthangulfont
2444 \let\xetexkodefaulthanjaoption \xetexkodefaulthanguloption
2445 \let\xetexkohanjafont \xetexkohangulfont
2446 \let\xetexkohanjaoption \xetexkohanguloption
2447 \let\XeKo@hanja@font \XeKo@hangul@font
2448 }
2449
2450 \AtBeginDocument{%
2451 \ifdefined\xetexkomainhangulfont\else
2452 \begingroup\rmfamily \expandafter\endgroup
2453 \iffontchar\font"AC00 \else
2454 \IfFontExistsTF{UnBatang.ttf}
2455 {\setmainhangulfont{UnBatang.ttf}[BoldFont=UnBatangBold.ttf,Script=Hangul,Language=Korean]}{}
2456 \fi
2457 \fi
2458 \ifdefined\xetexkosanshangulfont\else
2459 \begingroup\sffamily \expandafter\endgroup
2460 \iffontchar\font"AC00 \else
2461 \IfFontExistsTF{UnDotum.ttf}
2462 {\setsanshangulfont{UnDotum.ttf}[BoldFont=UnDotumBold.ttf]}{}
2463 \fi
2464 \fi
2465 \ifdefined\xetexkomonohangulfont\else
2466 \begingroup\ttfamily \expandafter\endgroup
2467 \iffontchar\font"AC00 \else
2468 \IfFontExistsTF{UnDotum.ttf}{%
2469 \ifnum 0\ifnum\strcmp{\ttdefault}{lmtt}=\z@ 1\fi
2470 \ifnum\strcmp{\ttdefault}{LatinModernMono(0)}=\z@ 1\fi >\z@
2471 \setmonohangulfont{UnDotum.ttf}[
2472 BoldFont=UnDotumBold.ttf,
2473 UprightFeatures={SizeFeatures={{Size={-8.5}, FakeStretch=1.062},
2474 {Size={8.5-11}, FakeStretch=1.05 },
2475 {Size={11-}, FakeStretch=1.03 }}},
2476 BoldFeatures={SizeFeatures={{Size={-}, FakeStretch=1.05 }}},
2477 WordSpace={1.66667,0,0} ]
2478 \else
2479 \setmonohangulfont{UnDotum.ttf}[BoldFont=UnDotumBold.ttf]
2480 \fi
2481 }{}
2482 \fi
2483 \fi
2484 \ifdefined\xetexkomainhanjafont\else
2485 \let\xetexkomainhanjafont \xetexkomainhangulfont
2486 \let\xetexkomainhanjaoption \xetexkomainhanguloption
2487 \fi
2488 \ifdefined\xetexkosanshanjafont\else
2489 \let\xetexkosanshanjafont \xetexkosanshangulfont
2490 \let\xetexkosanshanjaoption \xetexkosanshanguloption
2491 \fi
2492 \ifdefined\xetexkomonohanjafont\else
2493 \let\xetexkomonohanjafont \xetexkomonohangulfont
2494 \let\xetexkomonohanjaoption \xetexkomonohanguloption
2495 \fi
2496 \ifdefined\xetexkodefaulthanjafont\else
2497 \let\xetexkodefaulthanjafont \xetexkodefaulthangulfont
2498 \let\xetexkodefaulthanjaoption \xetexkodefaulthanguloption
2499 \fi
2500 \ifdefined\xetexkohanjafont\else
2501 \let\xetexkohanjafont \xetexkohangulfont
2502 \let\xetexkohanjaoption \xetexkohanguloption
2503 \fi
2504 \ifdefined\XeKo@hanja@font\else
2505 \let\XeKo@hanja@font \XeKo@hangul@font
2506 \fi
2507 }
2508
2509 \AddToHook{package/ulem/after}{\xetexkoulemsupport}
2510 \AddToHook{package/hyperref/after}{\pdfstringdefDisableCommands{%
2511 \let\hangulalphs\relax
2512 \let\hangulnums\relax
2513 \let\hangulparens\relax
2514 \let\hangulquotes\relax
2515 \let\hangulpuncts\relax
2516 \let\hangulmarks\relax
2517 \let\hangulcolons\relax
2518 \let\hangulhyphens\relax
2519 \let\hangulcjksymbols\relax
2520 \let\hanjaalphs\relax
2521 \let\hanjanums\relax
2522 \let\hanjaparens\relax
2523 \let\hanjaquotes\relax
2524 \let\hanjapuncts\relax
2525 \let\hanjamarks\relax
2526 \let\hanjacolons\relax
2527 \let\hanjahyphens\relax
2528 \let\hanjacjksymbols\relax
2529 \let\latinalphs\relax
2530 \let\latinnums\relax
2531 \let\latinparens\relax
2532 \let\latinquotes\relax
2533 \let\latinpuncts\relax
2534 \let\latinmarks\relax
2535 \let\latincolons\relax
2536 \let\latinhyphens\relax
2537 \let\latincjksymbols\relax
2538 \let\prevfontalphs\relax
2539 \let\prevfontnums\relax
2540 \let\prevfontparens\relax
2541 \let\prevfontquotes\relax
2542 \let\prevfontpuncts\relax
2543 \let\prevfontmarks\relax
2544 \let\prevfontcolons\relax
2545 \let\prevfonthyphens\relax
2546 \let\prevfontcjksymbols\relax
2547 \let\hanjabyhangulfont\relax
2548 \let\inhibitglue\relax
2549 \let\typesetclassic\relax
2550 \let\typesetmodern\relax
2551 \let\hangingpunctuation\relax
2552 \let\hangingpunctuations\relax
2553 \let\removeclassicspaces\relax
2554 \let\nocompresspunctuations\relax
2555 \let\compresspunctuations\relax
2556 \let\disablekoreanfonts\relax
2557 \let\disablehangulspacing\relax
2558 \let\disablehangulspacingandlinebreak\relax
2559 \let\enablehangulspacingandlinebreak\relax
2560 \let\jong\relax
2561 \let\jung\relax
2562 \let\rieul\relax
2563 \let\dotemph\@firstofone
2564 \let\addhangulfontfeature\@gobble
2565 \let\addhangulfontfeatures\@gobble
2566 \let\addhanjafontfeature\@gobble
2567 \let\addhanjafontfeatures\@gobble
2568 \let\xetexkostretchshrink\@gobble
2569 \def\는{는}%
2570 \def\은{은}%
2571 \def\을{을}%
2572 \def\를{를}%
2573 \def\와{와}%
2574 \def\과{과}%
2575 \def\가{가}%
2576 \def\이{이}%
2577 \def\라{라}%
2578 \def\으{으}%
2579 \def\로{로}%
2580 \def\hellipsis{...}}}
2581
2582 \newif\if@hangul
2583 \newif\if@hanja
2584 \DeclareOption{hangul}{\@hangultrue}
2585 \DeclareOption{hanja}{\@hangultrue\@hanjatrue}
2586 \DeclareOption{unfonts}{}
2587 \ProcessOptions\relax
2588
2589 \RequirePackage{kolabels-utf}
2590 \if@hangul
2591 \RequirePackage{konames-utf}
2592 \fi
2593
2594 \protected\def\hellipsis{^^^^2026^^^^2026}
2595
2596 \if@hangul
2597 \linespread{1.38889}
2598 \footnotesep=1.38889\footnotesep
2599 \skip\footins=\glueexpr\skip\footins/72*100\relax
2600 \frenchspacing
2601 \fi
2602
2603 \XeKocatcodeofATchar
2604 \endinput