summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xetex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-03-22 23:00:11 +0000
committerKarl Berry <karl@freefriends.org>2021-03-22 23:00:11 +0000
commitf33d124d3b27aede4700152ce2b3b365eef6732a (patch)
treeb29bb8ce10787684463982c9ea8bffecbb678031 /Master/texmf-dist/tex/xetex
parent5902eb7a626c59703b0c21b93806f6545c7723d3 (diff)
xetexko (22mar21) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2020.0@58634 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xetex')
-rw-r--r--Master/texmf-dist/tex/xetex/xetexko/xetexko.sty226
1 files changed, 144 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/xetex/xetexko/xetexko.sty b/Master/texmf-dist/tex/xetex/xetexko/xetexko.sty
index 6d7403617e0..9b155d3c737 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/03/20 v3.0 typesetting Korean with XeTeX]
+ \ProvidesPackage{xetexko}[2021/03/22 v3.1 typesetting Korean with XeTeX]
\else
\ifdefined\@tempcnta\else \newcount\@tempcnta \fi
\ifdefined\@gobble\else \def\@gobble#1{} \fi
@@ -35,7 +35,7 @@
\newXeTeXintercharclass\XeTeXcharclassEX
\let\XeTeXcharclassIS\XeTeXcharclassID
\let\XeTeXcharclassNS\XeTeXcharclassID
-\let\XeTeXcharclassCM\XeTeXcharclassIgnore
+\newXeTeXintercharclass\XeTeXcharclassCM
\input load-unicode-xetex-classes %
\newXeTeXintercharclass\XeTeXcharclassHG
@@ -54,10 +54,10 @@
% more CM
\count@"FE00 \loop
- \XeTeXcharclass\count@=\XeTeXcharclassIgnore
+ \XeTeXcharclass\count@=\XeTeXcharclassCM
\ifnum\count@<"FE0F \advance\count@\@ne \repeat
\count@"E0100 \loop
- \XeTeXcharclass\count@=\XeTeXcharclassIgnore
+ \XeTeXcharclass\count@=\XeTeXcharclassCM
\ifnum\count@<"E01EF \advance\count@\@ne \repeat
% hangul
@@ -390,9 +390,6 @@
\protected\def\vertlatin#1{\leavevmode\lower.5ex\hbox{\latinmarks #1}} % compat
% fonts
-\newtoks\XeKo@font@options
-\XeKo@font@options{}
-
\def\XeKo@reset@options{%
\let\xetexkohu \XeKo@undefined
\let\xetexkocharraise \XeKo@undefined
@@ -401,40 +398,22 @@
\def\XeKo@font@Hangul{%
\ifdefined\XeKo@hangul@font
- \edef\XeKo@curr{\the\font\the\XeKo@font@options}%
- \ifx\XeKo@curr\XeKo@hangul@font\else
- \ifx\XeKo@curr\XeKo@hanja@font\else
- \edef\XeKo@curr@latin{\the\font}%
- \fi
- \XeKo@reset@options
- \XeKo@hangul@font
- \XeKo@font@options\expandafter{\xetexkohanguloption}%
- \fi
+ \XeKo@reset@options
+ \XeKo@hangul@font
+ \let\XeKo@curr@font\XeKo@hangul@font
\fi
}
\def\XeKo@font@CJK{%
\ifdefined\XeKo@hanja@font
- \edef\XeKo@curr{\the\font\the\XeKo@font@options}%
- \ifx\XeKo@curr\XeKo@hanja@font\else
- \ifx\XeKo@curr\XeKo@hangul@font\else
- \edef\XeKo@curr@latin{\the\font}%
- \fi
- \XeKo@reset@options
- \XeKo@hanja@font
- \XeKo@font@options\expandafter{\xetexkohanjaoption}%
- \fi
+ \XeKo@reset@options
+ \XeKo@hanja@font
+ \let\XeKo@curr@font\XeKo@hanja@font
\fi
}
\def\XeKo@font@Latin{%
- \ifdefined\XeKo@curr@latin
- \edef\XeKo@curr{\the\font\the\XeKo@font@options}%
- \ifx\XeKo@curr\XeKo@hangul@font
- \XeKo@curr@latin
- \else
- \ifx\XeKo@curr\XeKo@hanja@font
- \XeKo@curr@latin
- \fi
- \fi
+ \ifdefined\XeKo@latin@font
+ \XeKo@latin@font
+ \let\XeKo@curr@font\XeKo@latin@font
\fi
}
\let\XeKo@fontHG\XeKo@font@Hangul
@@ -583,17 +562,17 @@
\fi
}
\def\XeKo@check@next@tok@cjk{%
- \ifnum 0\ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassJJ 1\else
- \ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassIgnore 1\fi\fi >\z@
+ \ifnum 0\ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassJJ 1\else
+ \ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassCM 1\fi\fi >\z@
\expandafter\XeKo@addto@toks
\else
\expandafter\XeKo@flush@toks
\fi
}
\def\XeKo@check@next@tok@latin{%
- \ifnum 0%
- \ifnum\XeTeXcharclass\XeKo@charslot=\csname XeKo@\XeKo@currclass @class\endcsname 1\else
- \ifnum\XeTeXcharclass\XeKo@charslot=\XeTeXcharclassIgnore 1\fi\fi >\z@
+ % load-unicode-xetex-classes가 설정하는 모든 CM은 한글, 한자, 가나 뒤에 온다.
+ % 따라서 영문자는 CM을 고려할 필요가 없다.
+ \ifnum\XeTeXcharclass\XeKo@charslot=\csname XeKo@\XeKo@currclass @class\endcsname
\expandafter\XeKo@addto@toks
\else
\expandafter\XeKo@flush@toks
@@ -637,7 +616,7 @@
\XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^^^3002}%
\let\XeKo@next\XeKo@char@orphan@
\else \ifx ^^^^ff0e\XeKo@let@token % .
- \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^^^3002}%
+ \XeKo@toks@ii\expandafter{\the\XeKo@toks@ii ^^^^ff0e}%
\let\XeKo@next\XeKo@char@orphan@
\else
\let\XeKo@next\XeKo@flush@char@orphan
@@ -649,24 +628,15 @@
\def\XeKo@flush@char@orphan{\XeKo@do@flush@toks \the\XeKo@toks@ii }
\def\XeKo@char@raise@start{%
\ifdefined\xetexkocharraise
- \edef\XeKo@curr{\the\font\the\XeKo@font@options}%
- \ifx\XeKo@curr\XeKo@hangul@font
+ \ifx\XeKo@curr@font\XeKo@latin@font\else
\raise\xetexkocharraise\hbox\bgroup
- \else
- \ifx\XeKo@curr\XeKo@hanja@font
- \raise\xetexkocharraise\hbox\bgroup
- \fi
\fi
\fi
}
\def\XeKo@char@raise@stop{%
\ifdefined\xetexkocharraise
- \ifx\XeKo@curr\XeKo@hangul@font
+ \ifx\XeKo@curr@font\XeKo@latin@font\else
\egroup
- \else
- \ifx\XeKo@curr\XeKo@hanja@font
- \egroup
- \fi
\fi
\fi
}
@@ -691,9 +661,6 @@
\XeKo@post@hang % hanging punctuations
\fi
\endgroup
- \XeKo@maybe@kern
- }
-\def\XeKo@maybe@kern{%
\ifnum\XeKo@currclass<\thr@@ % \the\XeKo@toks@ii
\expandafter\expandafter\expandafter\XeKo@maybe@kern@i
\else
@@ -1366,6 +1333,55 @@
\XeKo@fontVC\XeKo@startVC
}
+\newbox\XeKo@box@
+
+% \char"1112\char"119E\char"11AB etc.
+% !!!!! 이 경우 \everyhangul 등이 제대로 작동 않는다 !!!!!
+\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassJJ{%
+ \ifnum\lastnodetype=12 %
+ \ifnum\lastkern=\@ne
+ \unkern\unkern
+ \expandafter\expandafter\expandafter\XeKo@startJJ
+ \fi
+ \fi
+ }
+\def\XeKo@startJJ#1{%
+ \global\let\XeKo@josatoken=#1\relax
+ \begingroup
+ \XeTeXinterchartokenstate\z@
+ \ifnum\lastnodetype=\@ne % hbox (charraise box)
+ \setbox\XeKo@box@=\lastbox
+ \XeKo@char@raise@start \unhbox\XeKo@box@ #1\XeKo@char@raise@stop
+ \else
+ #1\relax
+ \fi
+ \endgroup
+ \XeKo@insert@kerns
+ }
+% \char"9AA8\char"E0102 etc.
+\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassCM{%
+ \ifnum\lastnodetype=12 %
+ \ifcase\lastkern
+ \or % HG
+ \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM
+ \or % ID
+ \unkern\unkern \expandafter\expandafter\expandafter\XeKo@startCM
+ \fi
+ \fi
+ }
+\def\XeKo@startCM#1{%
+ \begingroup
+ \XeTeXinterchartokenstate\z@
+ \ifnum\lastnodetype=\@ne % hbox (charraise box)
+ \setbox\XeKo@box@=\lastbox
+ \XeKo@char@raise@start \unhbox\XeKo@box@ #1\XeKo@char@raise@stop
+ \else
+ #1\relax
+ \fi
+ \endgroup
+ \XeKo@insert@kerns
+ }
+
%%% josa selection
\begingroup
\catcode`A=11\relax \global\let\XeKo@catcode@letter=A
@@ -1569,7 +1585,7 @@
\endgroup
}
-%
+% other commands
\let\enablecjksymbolspacing\compresspunctuations
\let\disablecjksymbolspacing\nocompresspunctuations
\protected\def\disablekoreanfonts{%
@@ -1647,37 +1663,65 @@
%%% plain
\ifcsname ver@xetexko.sty\endcsname \else
- \protected\def\hangulfont{\afterassignment\XeKo@hangul@font@setup\font\XeKo@hangul@font}
- \def\XeKo@hangul@font@setup{%
- \begingroup
- \XeKo@hangul@font
- \xdef\xetexkohanguloption{%
+ \protected\def\hangulfont{%
+ \afterassignment\XeKo@hangulfont@setup\font\XeKo@hangul@font
+ }
+ \def\XeKo@hangulfont@setup{%
+ \expandafter\let\expandafter\XeKo@latin@font\the\font
+ \edef\XeKo@hangul@font{%
+ \the\XeKo@hangul@font
\ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
\ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
\ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
- }
- \edef\x{%
- \endgroup
- \def\noexpand\XeKo@hangul@font{\the\font
- \unexpanded\expandafter{\xetexkohanguloption}}}\x
+ }%
}
- \protected\def\hanjafont{\afterassignment\XeKo@hanja@font@setup\font\XeKo@hanja@font}
- \def\XeKo@hanja@font@setup{%
- \begingroup
- \XeKo@hanja@font
- \xdef\xetexkohanjaoption{%
+ \protected\def\sethangulfont#1{%
+ \def\@tempa{#1}%
+ \edef\@tempb{\string#1}%
+ \expandafter\afterassignment\expandafter\XeKo@sethangulfont@setup
+ \expandafter\font\csname XeKo@hangul@font@\@tempb\endcsname
+ }
+ \def\XeKo@sethangulfont@setup{%
+ \expandafter\edef\@tempa{%
+ \let\noexpand\XeKo@latin@font=\the\font
+ \def\noexpand\XeKo@hangul@font{%
+ \csname XeKo@hangul@font@\@tempb\endcsname
+ \ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
+ \ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
+ \ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
+ }%
+ }%
+ }
+ \protected\def\hanjafont{%
+ \afterassignment\XeKo@hanjafont@setup\font\XeKo@hanja@font
+ }
+ \def\XeKo@hanjafont@setup{%
+ \expandafter\let\expandafter\XeKo@latin@font\the\font
+ \edef\XeKo@hanja@font{%
+ \the\XeKo@hanja@font
\ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
\ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
\ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
- }
- \edef\x{\endgroup
- \def\noexpand\XeKo@hanja@font{\the\font
- \unexpanded\expandafter{\xetexkohanjaoption}}}\x
+ }%
}
- \protected\def\hanjabyhangulfont{%
- \let\XeKo@hanja@font\XeKo@hangul@font
- \let\xetexkohanjaoption\xetexkohanguloption
+ \protected\def\sethanjafont#1{%
+ \def\@tempa{#1}%
+ \edef\@tempb{\string#1}%
+ \expandafter\afterassignment\expandafter\XeKo@sethanjafont@setup
+ \expandafter\font\csname XeKo@hanja@font@\@tempb\endcsname
}
+ \def\XeKo@sethanjafont@setup{%
+ \expandafter\edef\@tempa{%
+ \let\noexpand\XeKo@latin@font=\the\font
+ \def\noexpand\XeKo@hanja@font{%
+ \csname XeKo@hanja@font@\@tempb\endcsname
+ \ifdefined\xetexkohu \def\noexpand\xetexkohu{\xetexkohu}\fi
+ \ifdefined\xetexkointerhchar \def\noexpand\xetexkointerhchar{\xetexkointerhchar}\fi
+ \ifdefined\xetexkocharraise \def\noexpand\xetexkocharraise{\xetexkocharraise}\fi
+ }%
+ }%
+ }
+ \protected\def\hanjabyhangulfont{\let\XeKo@hanja@font\XeKo@hangul@font }
% math hangul
\newfam\symmathhangul
\protected\def\setmathhangulfonts#1#2#3{% font identifiers
@@ -1745,17 +1789,18 @@
}
\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
}
}
-
\def\XeKo@hangul@selectfont{%
\ifdefined\XeKo@in@selectfont\else
\ifdefined\xetexkohangulfont
@@ -1765,8 +1810,8 @@
\edef\x{\endgroup
\def\noexpand\XeKo@hangul@font{\the\font
\unexpanded\expandafter{\xetexkohanguloption}}%
- \noexpand\xetexkohanguloption % for 영문자-한글 interlatincjk
- }\x
+ }\x
+ \xetexkohanguloption % for 영문자-한글 interlatincjk
\else
\let\XeKo@hangul@font\XeKo@undefined
\fi
@@ -1781,12 +1826,22 @@
\edef\x{\endgroup
\def\noexpand\XeKo@hanja@font{\the\font
\unexpanded\expandafter{\xetexkohanjaoption}}%
- \noexpand\xetexkohanjaoption
- }\x
+ }\x
+ \xetexkohanjaoption
\else
\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
@@ -1855,6 +1910,7 @@
\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
@@ -1874,6 +1930,7 @@
\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
@@ -1893,6 +1950,7 @@
\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
@@ -1979,6 +2037,7 @@
\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
@@ -1998,6 +2057,7 @@
\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
@@ -2017,10 +2077,12 @@
\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
}
+ \XeKo@latin@selectfont
\DeclareDocumentCommand \newhanjafontfamily { m O{} m O{} }
{
\__xtxko_assign_font_opts:n { #2, #4 }