summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/xetex/xetexko/xetexko.sty214
1 files changed, 102 insertions, 112 deletions
diff --git a/Master/texmf-dist/tex/xetex/xetexko/xetexko.sty b/Master/texmf-dist/tex/xetex/xetexko/xetexko.sty
index 67de1e2aa98..d2fc815549b 100644
--- a/Master/texmf-dist/tex/xetex/xetexko/xetexko.sty
+++ b/Master/texmf-dist/tex/xetex/xetexko/xetexko.sty
@@ -16,7 +16,7 @@
\ifdefined\ProvidesPackage
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
- \ProvidesPackage{xetexko}[2021/04/20 v3.3 typesetting Korean with XeTeX]
+ \ProvidesPackage{xetexko}[2021/05/15 v3.4 typesetting Korean with XeTeX]
\else
\ifdefined\@tempcnta\else \newcount\@tempcnta \fi
\ifdefined\@gobble\else \def\@gobble#1{} \fi
@@ -357,9 +357,9 @@
}
\def\XeKo@Tchinese@classes{% these glyphs in traditional chinese fonts are center-aligned
\XeTeXcharclass "3001 = \XeTeXcharclassMD % 、
- \XeTeXcharclass "3002 = \XeTeXcharclassMD % 。
+ \XeTeXcharclass "3002 = \XeTeXcharclassLD % 。
\XeTeXcharclass "FF0C = \XeTeXcharclassMD % ,
- \XeTeXcharclass "FF0E = \XeTeXcharclassMD % .
+ \XeTeXcharclass "FF0E = \XeTeXcharclassLD % .
}
\chardef\XeKo@typesetvertical\z@
@@ -405,7 +405,8 @@
\protected\def\endhorizontal{%
\egroup
\XeKo@unrotatebox\z@
- \lower.5\ht\z@ \box\z@
+ \lower\dimexpr.5\ht\z@\ifdefined\xetexkocharraise-\xetexkocharraise\fi\relax
+ \box\z@
}
\def\XeKo@rotatebox#1{%
\setbox#1\hbox to\dimexpr\ht#1+\dp#1\bgroup
@@ -429,11 +430,22 @@
\egroup
}
\ifcsname ver@xetexko.sty\endcsname
- \def\verticaltypesetting{%
- \maxdepth\z@ \typesetvertical
- \dimen@\textwidth \textwidth\textheight \textheight\dimen@
- \edef\@outputpage{\unexpanded{\XeKo@rotatebox\@outputbox
- \textwidth\textheight}\unexpanded\expandafter{\@outputpage}}}
+ \IfFormatAtLeastTF{2021/06/01}{
+ \def\verticaltypesetting{%
+ \maxdepth\z@ \typesetvertical
+ \dimen@\textwidth \textwidth\textheight \textheight\dimen@
+ \AddToHook{cmd/@outputpage/before}{\XeKo@rotatebox\@outputbox \textwidth\textheight}%
+ \let\verticaltypesetting\relax % prevent multiple running
+ }
+ }{
+ \def\verticaltypesetting{%
+ \maxdepth\z@ \typesetvertical
+ \dimen@\textwidth \textwidth\textheight \textheight\dimen@
+ \edef\@outputpage{\unexpanded{\XeKo@rotatebox\@outputbox
+ \textwidth\textheight}\unexpanded\expandafter{\@outputpage}}%
+ \let\verticaltypesetting\relax % prevent multiple running
+ }
+ }
\else
\def\verticaltypesetting{%
\dimen@\hsize \hsize\vsize \vsize\dimen@
@@ -441,7 +453,9 @@
\unexpanded\expandafter{\plainoutput}}%
\def\pagebody{\setbox\z@\vbox to\hsize{\boxmaxdepth=\maxdepth
\pagecontents}\XeKo@rotatebox\z@\box\z@}%
- \maxdepth\z@ \typesetvertical }
+ \maxdepth\z@ \typesetvertical
+ \let\verticaltypesetting\relax % prevent multiple running
+ }
\fi
\protected\def\vertlatin#1{\leavevmode\lower.5ex\hbox{\latinmarks #1}} % compat
@@ -453,25 +467,38 @@
\let\xetexkointerhchar\XeKo@undefined
}
+\expandafter\let\expandafter\XeKo@latin@font\the\font
+
\def\XeKo@font@Hangul{%
+ \expandafter\ifx\the\font\XeKo@raw@hangul@font \else
+ \expandafter\ifx\the\font\XeKo@raw@hanja@font \else
+ \expandafter\let\expandafter\XeKo@latin@font\the\font
+ \fi\fi
\ifdefined\XeKo@hangul@font
\XeKo@reset@options
\XeKo@hangul@font
- \let\XeKo@curr@font\XeKo@hangul@font
+ \expandafter\let\expandafter\XeKo@raw@hangul@font\the\font
\fi
}
\def\XeKo@font@CJK{%
+ \expandafter\ifx\the\font\XeKo@raw@hangul@font \else
+ \expandafter\ifx\the\font\XeKo@raw@hanja@font \else
+ \expandafter\let\expandafter\XeKo@latin@font\the\font
+ \fi\fi
\ifdefined\XeKo@hanja@font
\XeKo@reset@options
\XeKo@hanja@font
- \let\XeKo@curr@font\XeKo@hanja@font
+ \expandafter\let\expandafter\XeKo@raw@hanja@font\the\font
\fi
}
\def\XeKo@font@Latin{%
- \ifdefined\XeKo@latin@font
+ \expandafter\ifx\the\font\XeKo@raw@hangul@font
\XeKo@latin@font
- \let\XeKo@curr@font\XeKo@latin@font
- \fi
+ \else \expandafter\ifx\the\font\XeKo@raw@hanja@font
+ \XeKo@latin@font
+ \else
+ \expandafter\let\expandafter\XeKo@latin@font\the\font
+ \fi\fi
}
\let\XeKo@fontHG\XeKo@font@Hangul
\let\XeKo@fontID\XeKo@font@CJK
@@ -539,14 +566,14 @@
\protected\def\hanjacolons {\let\XeKo@fontAM\XeKo@font@CJK}
\protected\def\hanjahyphens{\let\XeKo@fontAH\XeKo@font@CJK}
\protected\def\hanjacjksymbols{%
- \let\XeKo@fontSY\XeKo@font@Hanja
- \let\XeKo@fontOP\XeKo@font@Hanja
- \let\XeKo@fontCL\XeKo@font@Hanja
- \let\XeKo@fontMD\XeKo@font@Hanja
- \let\XeKo@fontFS\XeKo@font@Hanja
- \let\XeKo@fontEX\XeKo@font@Hanja
- \let\XeKo@fontLD\XeKo@font@Hanja
- \let\XeKo@fontVC\XeKo@font@Hanja
+ \let\XeKo@fontSY\XeKo@font@CJK
+ \let\XeKo@fontOP\XeKo@font@CJK
+ \let\XeKo@fontCL\XeKo@font@CJK
+ \let\XeKo@fontMD\XeKo@font@CJK
+ \let\XeKo@fontFS\XeKo@font@CJK
+ \let\XeKo@fontEX\XeKo@font@CJK
+ \let\XeKo@fontLD\XeKo@font@CJK
+ \let\XeKo@fontVC\XeKo@font@CJK
}
\protected\def\hanjamarks{%
\hanjaalphs\hanjaparens\hanjapuncts\hanjacolons\hanjahyphens\hanjacjksymbols
@@ -691,16 +718,20 @@
\def\XeKo@flush@char@orphan{\expandafter \XeKo@do@flush@toks \the\XeKo@toks@ii }
\def\XeKo@char@raise@start{%
\ifdefined\xetexkocharraise
- \ifx\XeKo@curr@font\XeKo@latin@font\else
+ \expandafter\ifx\the\font\XeKo@raw@hangul@font
\raise\xetexkocharraise\hbox\bgroup
- \fi
+ \else \expandafter\ifx\the\font\XeKo@raw@hanja@font
+ \raise\xetexkocharraise\hbox\bgroup
+ \fi\fi
\fi
}
\def\XeKo@char@raise@stop{%
\ifdefined\xetexkocharraise
- \ifx\XeKo@curr@font\XeKo@latin@font\else
+ \expandafter\ifx\the\font\XeKo@raw@hangul@font
\egroup
- \fi
+ \else \expandafter\ifx\the\font\XeKo@raw@hanja@font
+ \egroup
+ \fi\fi
\fi
}
\def\XeKo@do@flush@toks{%
@@ -973,12 +1004,9 @@
}
\def\XeKo@maybe@gobble{%
- \ifdefined\XeKo@curr@font\expandafter\XeKo@maybe@gobble@\fi
- }
-\let\XeKo@do@maybe@gobble\XeKo@maybe@gobble
-\def\XeKo@maybe@gobble@{%
\expandafter\expandafter\expandafter\@gobble
}
+\let\XeKo@do@maybe@gobble\XeKo@maybe@gobble
\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassHG{%
\ifnum\lastnodetype=12 %
@@ -1102,7 +1130,7 @@
\or \unkern\unkern \XeKo@quarterquarter % MD AA
\or \unkern\unkern \XeKo@halfzero % FS AA
\or \unkern\unkern \XeKo@halfhalf % EX AA
- \or \unkern\unkern % LD AA
+ \or \unkern\unkern \XeKo@latincjk % LD AA
\or \unkern\unkern \XeKo@quarterquarter % VC AA
\fi
\fi
@@ -1126,7 +1154,7 @@
\or \unkern\unkern \XeKo@quarterquarter % MD AO
\or \unkern\unkern \XeKo@halfzero % FS AO
\or \unkern\unkern \XeKo@halfhalf % EX AO
- \or \unkern\unkern % LD AO
+ \or \unkern\unkern \XeKo@latincjk % LD AO
\or \unkern\unkern \XeKo@quarterquarter % VC AO
\fi
\fi
@@ -1518,8 +1546,8 @@
}
\def\XeKo@read@hanja@hangul@line{%
\read1 to \@tempa
- \ifnum\count@=\@tempcnta
- \global\count@\@tempa
+ \ifnum\XeKo@count@=\@tempcnta
+ \global\XeKo@count@\@tempa
\else
\advance\@tempcnta\@ne \expandafter\XeKo@read@hanja@hangul@line
\fi
@@ -1747,9 +1775,9 @@
\ifcsname ver@xetexko.sty\endcsname
\def\xetexkoulemsupport{%
\ifdefined\UL@hook
- \UL@hook\expandafter{%
- \the\UL@hook
+ \UL@hook\expandafter{\the\UL@hook
\let\XeKo@char@orphan\XeKo@flush@char@orphan
+ \let\XeKo@maybe@gobble\relax
% uline 안에서 폰트가 변경되는 경우를 대비
\expandafter\def\expandafter\XeKo@hangul@selectfont\expandafter{%
\XeKo@hangul@selectfont
@@ -1757,6 +1785,9 @@
\global\let\XeKo@temp@hangul@font\XeKo@hangul@font
\gdef\XeKo@UL@hangul@font{\let\XeKo@hangul@font\XeKo@temp@hangul@font}%
\aftergroup\aftergroup\aftergroup\XeKo@UL@hangul@font
+ % 여기서 라틴폰트 지정을 보존한다.
+ \global\let\XeKo@UL@latin@font\font@name
+ \aftergroup\aftergroup\aftergroup\XeKo@UL@latin@font
\fi }%
\expandafter\def\expandafter\XeKo@hanja@selectfont\expandafter{%
\XeKo@hanja@selectfont
@@ -1765,13 +1796,6 @@
\gdef\XeKo@UL@hanja@font{\let\XeKo@hanja@font\XeKo@temp@hanja@font}%
\aftergroup\aftergroup\aftergroup\XeKo@UL@hanja@font
\fi }%
- \expandafter\def\expandafter\XeKo@latin@selectfont\expandafter{%
- \XeKo@latin@selectfont
- \ifdefined\XeKo@in@selectfont\else
- \global\let\XeKo@temp@latin@font\XeKo@latin@font
- \gdef\XeKo@UL@latin@font{\let\XeKo@latin@font\XeKo@temp@latin@font}%
- \aftergroup\aftergroup\aftergroup\XeKo@UL@latin@font
- \fi }%
}%
\fi
}
@@ -1780,23 +1804,30 @@
\let\XeKo@UL@hanja@patch \relax
\def\xetexkoulemsupport{%
\ifdefined\UL@hook
- \UL@hook\expandafter{%
- \the\UL@hook
+ \UL@hook\expandafter{\the\UL@hook
\let\XeKo@char@orphan\XeKo@flush@char@orphan
+ \let\XeKo@maybe@gobble\relax
+ % uline 안에서 폰트가 변경되는 경우를 대비
\def\XeKo@UL@hangul@patch{%
\global\let\XeKo@temp@hangul@font\XeKo@hangul@font
- \global\let\XeKo@temp@latin@font\XeKo@latin@font
- \gdef\XeKo@UL@hangul@font{%
- \let\XeKo@hangul@font\XeKo@temp@hangul@font
- \let\XeKo@latin@font\XeKo@temp@latin@font }%
- \aftergroup\aftergroup\aftergroup\XeKo@UL@hangul@font }%
+ \gdef\XeKo@UL@hangul@font{\let\XeKo@hangul@font\XeKo@temp@hangul@font}%
+ \aftergroup\aftergroup\aftergroup\XeKo@UL@hangul@font
+ \XeKo@UL@latin@patch
+ }%
\def\XeKo@UL@hanja@patch{%
\global\let\XeKo@temp@hanja@font\XeKo@hanja@font
- \global\let\XeKo@temp@latin@font\XeKo@latin@font
- \gdef\XeKo@UL@hanja@font{%
- \let\XeKo@hanja@font\XeKo@temp@hanja@font
- \let\XeKo@latin@font\XeKo@temp@latin@font }%
- \aftergroup\aftergroup\aftergroup\XeKo@UL@hanja@font }%
+ \gdef\XeKo@UL@hanja@font{\let\XeKo@hanja@font\XeKo@temp@hanja@font}%
+ \aftergroup\aftergroup\aftergroup\XeKo@UL@hanja@font
+ \XeKo@UL@latin@patch
+ }%
+ % uline 안에서 폰트 지시는 라틴폰트, 한글폰트 순서로 해야 라틴폰트가 올바로 동작함
+ \def\XeKo@UL@latin@patch{%
+ \ifnum 0\expandafter\ifx\the\font\XeKo@raw@hangul@font 1\else
+ \expandafter\ifx\the\font\XeKo@raw@hanja@font 1\fi\fi =\z@
+ \global\expandafter\let\expandafter\XeKo@UL@latin@font\the\font
+ \aftergroup\aftergroup\aftergroup\XeKo@UL@latin@font
+ \fi
+ }%
}%
\fi
}
@@ -1817,14 +1848,6 @@
\afterassignment\XeKo@hangulfont@setup\font\XeKo@hangul@font
}
\def\XeKo@hangulfont@setup{%
- \ifdefined\XeKo@curr@font
- \ifx\XeKo@curr@font\XeKo@hangul@font\else
- \ifx\XeKo@curr@font\XeKo@hanja@font\else
- \expandafter\let\expandafter\XeKo@latin@font\the\font
- \fi\fi
- \else
- \expandafter\let\expandafter\XeKo@latin@font\the\font
- \fi
\edef\XeKo@hangul@font{%
\the\XeKo@hangul@font
\ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
@@ -1841,15 +1864,6 @@
}
\def\XeKo@sethangulfont@setup{%
\expandafter\edef\@tempa{%
- \let\noexpand\XeKo@latin@font=%
- \ifdefined\XeKo@curr@font
- \ifx\XeKo@curr@font\XeKo@hangul@font \the\XeKo@latin@font \else
- \ifx\XeKo@curr@font\XeKo@hanja@font \the\XeKo@latin@font \else
- \the\font
- \fi\fi
- \else
- \the\font
- \fi
\def\noexpand\XeKo@hangul@font{%
\csname XeKo@hangul@font@\@tempb\endcsname
\ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
@@ -1863,14 +1877,6 @@
\afterassignment\XeKo@hanjafont@setup\font\XeKo@hanja@font
}
\def\XeKo@hanjafont@setup{%
- \ifdefined\XeKo@curr@font
- \ifx\XeKo@curr@font\XeKo@hangul@font\else
- \ifx\XeKo@curr@font\XeKo@hanja@font\else
- \expandafter\let\expandafter\XeKo@latin@font\the\font
- \fi\fi
- \else
- \expandafter\let\expandafter\XeKo@latin@font\the\font
- \fi
\edef\XeKo@hanja@font{%
\the\XeKo@hanja@font
\ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
@@ -1887,15 +1893,6 @@
}
\def\XeKo@sethanjafont@setup{%
\expandafter\edef\@tempa{%
- \let\noexpand\XeKo@latin@font=%
- \ifdefined\XeKo@curr@font
- \ifx\XeKo@curr@font\XeKo@hangul@font \the\XeKo@latin@font \else
- \ifx\XeKo@curr@font\XeKo@hanja@font \the\XeKo@latin@font \else
- \the\font
- \fi\fi
- \else
- \the\font
- \fi
\def\noexpand\XeKo@hanja@font{%
\csname XeKo@hanja@font@\@tempb\endcsname
\ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
@@ -1959,28 +1956,37 @@
\latinalphs\latinparens\latinpuncts\latincolons\latinhyphens
\disablehangulspacing
}
-\edef\verbatim@font{%
- \unexpanded\expandafter{%
- \verbatim@font
+\IfFormatAtLeastTF{2021/06/01}{
+ \AddToHook{cmd/verbatim@font/after}{%
\disablehangulspacingandlinebreak
\aftergroup\enablehangulspacingandlinebreak
- }}
+ }
+}{
+ \edef\verbatim@font{%
+ \unexpanded\expandafter{%
+ \verbatim@font
+ \disablehangulspacingandlinebreak
+ \aftergroup\enablehangulspacingandlinebreak
+ }}
+}
\AddToHook{normalfont}{%
\let \xetexkohangulfont \xetexkodefaulthangulfont
\let \xetexkohanguloption \xetexkodefaulthanguloption
\let \xetexkohanjafont \xetexkodefaulthanjafont
\let \xetexkohanjaoption \xetexkodefaulthanjaoption
}
+\AddToHook{env/picture/begin}{%
+ \latinalphs\latinparens\latinpuncts\latincolons\latinhyphens
+ }
+
\IfHookExistsTF{selectfont}{
\AddToHook{selectfont}{%
- \XeKo@latin@selectfont
\XeKo@hanja@selectfont
\XeKo@hangul@selectfont
}
}{
\RequirePackage{everysel}
\EverySelectfont{%
- \XeKo@latin@selectfont
\XeKo@hanja@selectfont
\XeKo@hangul@selectfont
}
@@ -2016,16 +2022,6 @@
\let\XeKo@hanja@font\XeKo@undefined
\fi
\fi }
-\def\XeKo@latin@selectfont{%
- \ifdefined\XeKo@in@selectfont\else
- \begingroup
- \let\XeKo@in@selectfont\empty
- \selectfont
- \edef\x{\endgroup
- \def\noexpand\XeKo@latin@font{\the\font}%
- }\x
- \fi
- }
\ExplSyntaxOn
\tl_new:N \l_xtxko_font_opts_tl
@@ -2094,7 +2090,6 @@
\cs_set_eq:NN \xetexkohanguloption \xetexkomainhanguloption
\cs_set_eq:NN \xetexkodefaulthangulfont \xetexkomainhangulfont
\cs_set_eq:NN \xetexkodefaulthanguloption \xetexkomainhanguloption
- \XeKo@latin@selectfont
\XeKo@hangul@selectfont
}
\ignorespaces
@@ -2114,7 +2109,6 @@
\cs_set_eq:NN \xetexkohanguloption \xetexkosanshanguloption
\cs_set_eq:NN \xetexkodefaulthangulfont \xetexkosanshangulfont
\cs_set_eq:NN \xetexkodefaulthanguloption \xetexkosanshanguloption
- \XeKo@latin@selectfont
\XeKo@hangul@selectfont
}
\ignorespaces
@@ -2134,7 +2128,6 @@
\cs_set_eq:NN \xetexkohanguloption \xetexkomonohanguloption
\cs_set_eq:NN \xetexkodefaulthangulfont \xetexkomonohangulfont
\cs_set_eq:NN \xetexkodefaulthanguloption \xetexkomonohanguloption
- \XeKo@latin@selectfont
\XeKo@hangul@selectfont
}
\ignorespaces
@@ -2221,7 +2214,6 @@
\cs_set_eq:NN \xetexkohanjaoption \xetexkomainhanjaoption
\cs_set_eq:NN \xetexkodefaulthanjafont \xetexkomainhanjafont
\cs_set_eq:NN \xetexkodefaulthanjaoption \xetexkomainhanjaoption
- \XeKo@latin@selectfont
\XeKo@hanja@selectfont
}
\ignorespaces
@@ -2241,7 +2233,6 @@
\cs_set_eq:NN \xetexkohanjaoption \xetexkosanshanjaoption
\cs_set_eq:NN \xetexkodefaulthanjafont \xetexkosanshanjafont
\cs_set_eq:NN \xetexkodefaulthanjaoption \xetexkosanshanjaoption
- \XeKo@latin@selectfont
\XeKo@hanja@selectfont
}
\ignorespaces
@@ -2261,7 +2252,6 @@
\cs_set_eq:NN \xetexkohanjaoption \xetexkomonohanjaoption
\cs_set_eq:NN \xetexkodefaulthanjafont \xetexkomonohanjafont
\cs_set_eq:NN \xetexkodefaulthanjaoption \xetexkomonohanjaoption
- \XeKo@latin@selectfont
\XeKo@hanja@selectfont
}
\ignorespaces