diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/cjk-ko/cjkutf8-ko.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/cjk-ko/cjkutf8-ko.sty | 149 |
1 files changed, 102 insertions, 47 deletions
diff --git a/Master/texmf-dist/tex/latex/cjk-ko/cjkutf8-ko.sty b/Master/texmf-dist/tex/latex/cjk-ko/cjkutf8-ko.sty index 4aa112bb661..67f8cef50fd 100644 --- a/Master/texmf-dist/tex/latex/cjk-ko/cjkutf8-ko.sty +++ b/Master/texmf-dist/tex/latex/cjk-ko/cjkutf8-ko.sty @@ -17,7 +17,7 @@ % Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, % MA 02110-1301 USA -\ProvidesPackage{cjkutf8-ko}[2013/07/03 v1.2 Hangul typesetting on CJKutf8] +\ProvidesPackage{cjkutf8-ko}[2013/11/28 v1.3 Hangul typesetting on CJKutf8] \ifx\eTeXversion\relax \let\eTeXversion\undefined \fi \ifx\eTeXversion\undefined @@ -35,37 +35,72 @@ \DeclareOption{usecjkt1font}{\let\usecjk@@font\empty\@hangultrue} \DeclareOption{usedotemph}{\let\usedot@mph\empty} \DeclareOption{nojosa}{\let\use@josa\undefined} +\DeclareOption*{\expandafter\CJKKO@userfont@option\CurrentOption=\end} +\def\CJKKO@userfont@option#1=#2\end{% + \ifx\empty#2\empty + \PackageError{cjkutf8-ko}{Option not used: #1}{} + \else + \def\reserved@a{mj}\def\reserved@b{gt}\def\reserved@c{#1} + \ifx\reserved@a\reserved@c + \edef\CJKKO@mjfont{\CJKKO@removetrailingEQ#2} + \IfFileExists{c70\CJKKO@mjfont.fd}{}{% + \PackageError{cjkutf8-ko}{`c70\CJKKO@mjfont.fd' does not exist}{} + \let\CJKKO@mjfont\undefined + } + \else + \ifx\reserved@b\reserved@c + \edef\CJKKO@gtfont{\CJKKO@removetrailingEQ#2} + \IfFileExists{c70\CJKKO@gtfont.fd}{}{% + \PackageError{cjkutf8-ko}{`c70\CJKKO@gtfont.fd' does not exist}{} + \let\CJKKO@gtfont\undefined + } + \else + \PackageError{cjkutf8-ko} + {Unknown hangul font type: #1} + {Allowed font types are `mj' and `gt'} + \fi + \fi + \fi +} +\def\CJKKO@removetrailingEQ#1={#1} \ProcessOptions\relax +\ifx\CJKKO@mjfont\undefined \def\CJKKO@mjfont{nanummj}\fi +\ifx\CJKKO@gtfont\undefined \def\CJKKO@gtfont{nanumgt}\fi + %%%%%%%%%%%%%%%%%%%%%%%%% % font settings \ifx\usecjk@@font\undefined\else \RequirePackage[T1]{fontenc} \RequirePackage{textcomp} - \def\rmdefault{nanummj} - \def\sfdefault{nanumgt} + \IfFileExists{t1\CJKKO@mjfont.fd}{\let\rmdefault\CJKKO@mjfont}{} + \IfFileExists{t1\CJKKO@gtfont.fd}{\let\sfdefault\CJKKO@gtfont}{} \fi \RequirePackage{CJKutf8} -\g@addto@macro\rmfamily{\CJKfamily{nanummj}} -\g@addto@macro\sffamily{\CJKfamily{nanumgt}} -\g@addto@macro\ttfamily{\CJKfamily{nanumgt}} +\g@addto@macro\rmfamily{\CJKfamily{\CJKKO@mjfont}} +\g@addto@macro\sffamily{\CJKfamily{\CJKKO@gtfont}} +\g@addto@macro\ttfamily{\CJKfamily{\CJKKO@gtfont}} \AtBeginDocument{ \edef\reserved@a{\familydefault} \edef\reserved@b{\rmdefault} \ifx\reserved@a\reserved@b - \CJKfamily{nanummj} - \g@addto@macro\normalfont{\CJKfamily{nanummj}} + \CJKfamily{\CJKKO@mjfont} + \g@addto@macro\normalfont{\CJKfamily{\CJKKO@mjfont}} \if@hangul\ifx\usecjk@@font\undefined - \CJKKO@hangulspaceglue{t1nanummjm}% get space glue from hangul font + \IfFileExists{t1\CJKKO@mjfont m}{% + \CJKKO@hangulspaceglue{t1\CJKKO@mjfont m}% space glue from hangul font + }{} \fi\fi \else - \CJKfamily{nanumgt} - \g@addto@macro\normalfont{\CJKfamily{nanumgt}} + \CJKfamily{\CJKKO@gtfont} + \g@addto@macro\normalfont{\CJKfamily{\CJKKO@gtfont}} \if@hangul\ifx\usecjk@@font\undefined - \CJKKO@hangulspaceglue{t1nanumgtm}% get space glue from hangul font + \IfFileExists{t1\CJKKO@gtfont m}{% + \CJKKO@hangulspaceglue{t1\CJKKO@gtfont m}% space glue from hangul font + }{} \fi\fi \fi \let\reset@font\normalfont @@ -102,7 +137,7 @@ \CJKunderanysymbol{-\dotemphraise}{\dotemphchar}} \AtBeginDocument{ \@ifpackageloaded{hyperref}{\g@addto@macro\pdfstringdefPreHook{% - \let\dotemph\@firstofone + \let\dotemph\@firstofone }}{} } \fi @@ -114,10 +149,29 @@ \def\CJKglue{\HangulPenalty\HangulGlue} \def\CJKpostmathglue{\HangulPenalty\hskip.25ex plus.1ex minus.05ex } \CJKspace -\CJK@envStart{}{UTF8}{nanummj} +\CJK@envStart{}{UTF8}{\CJKKO@mjfont} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%% +% italic correction after cjk +\edef\maybe@ic@{% + \unexpanded{% + \let\CJKKO@wasCJK\undefined + \ifnum\lastkern=\@ne + \unkern\unkern + \let\CJKKO@wasCJK\empty + \fi + }% + \unexpanded\expandafter{\maybe@ic@ + \ifx\CJKKO@wasCJK\empty + \CJK@CJK + \CJKKO@check@next@tok@ + \let\CJKKO@wasCJK\undefined + \fi + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%% %%% CJKscale: scale CJK char size \def\CJKscale#1{% \ifx\usecjk@@font\undefined @@ -139,32 +193,32 @@ \@tempdimb\CJK@scale\@tempdimb %%% inserted \ifx\optional@arg \@empty \else - \expandafter\ifx - \csname CJK@\mandatory@arg/\f@size/\the\@tempdimb\endcsname \relax - \@tempdimb \optional@arg\@tempdimb - #1{Font\space shape\space `\curr@fontshape'\space - will\space be\MessageBreak - scaled\space to\space size\space \the\@tempdimb}% - \expandafter - \gdef\csname CJK@\mandatory@arg/\f@size/\the\@tempdimb\endcsname{}% - \fi + \expandafter\ifx + \csname CJK@\mandatory@arg/\f@size/\the\@tempdimb\endcsname \relax + \@tempdimb \optional@arg\@tempdimb + #1{Font\space shape\space `\curr@fontshape'\space + will\space be\MessageBreak + scaled\space to\space size\space \the\@tempdimb}% + \expandafter + \gdef\csname CJK@\mandatory@arg/\f@size/\the\@tempdimb\endcsname{}% + \fi \fi \edef\external@font{% - \mandatory@arg\CJK@plane\space at \the\@tempdimb}% + \mandatory@arg\CJK@plane\space at \the\@tempdimb}% \xdef\font@name{% - \csname \curr@fontshape/\f@size/\CJK@plane\endcsname}% + \csname \curr@fontshape/\f@size/\CJK@plane\endcsname}% \expandafter\global\expandafter\let \csname \CJK@curr@fontshape\expandafter\endcsname - \csname \curr@fontshape\endcsname} + \csname \curr@fontshape\endcsname} \if@hangul % hangul is main language % scale space glue \bgroup \@for\reserved@a:=,\small,\footnotesize,\large,\Large,\LARGE\do{% - \reserved@a - \fontdimen2\font=\CJK@scale\fontdimen2\font - \fontdimen3\font=\CJK@scale\fontdimen3\font - \fontdimen4\font=\CJK@scale\fontdimen4\font - \fontdimen7\font=\CJK@scale\fontdimen7\font} + \reserved@a + \fontdimen2\font=\CJK@scale\fontdimen2\font + \fontdimen3\font=\CJK@scale\fontdimen3\font + \fontdimen4\font=\CJK@scale\fontdimen4\font + \fontdimen7\font=\CJK@scale\fontdimen7\font} \egroup % scale parindent, footnotesep, footins \parindent\CJK@scale\parindent @@ -225,13 +279,13 @@ \ifnum\lastpenalty=\z@ % last node is not penalty (?) \ifnum\spacefactor=998 \else % last char is not opening ascii \ifx\CJK@plane\undefined\else - \CJK@testPostPunct{\CJK@@@enc}{\CJK@plane}{\CJK@gtemp}% + \CJK@testPostPunct{\CJK@@@enc}{\CJK@plane}{\CJK@gtemp}% \fi \ifCJK@ - \global\CJK@false + \global\CJK@false \else % this char is not closing cjk - \ifnum\lastnodetype=10 \CJKpostmathglue % after math-off - \else \CJKglue \fi + \ifnum\lastnodetype=10 \CJKpostmathglue % after math-off + \else \CJKglue \fi \fi \fi\fi\fi\fi\fi %%% end of inserted @@ -285,8 +339,10 @@ \fi} \def\CJKKO@opening@punct#1{\leavevmode\hbox to.5em{\hss\CJKsymbol{#1}}} \def\CJKKO@normal@punct#1{\leavevmode\hbox to.5em{\CJKsymbol{#1}\hss}} -\DeclareUnicodeCharacter{00B7} +\AtBeginDocument{ + \DeclareUnicodeCharacter{00B7} {\leavevmode\kern.25em \Unicode{0}{"B7}\hskip.25em\relax} +} %%%%%%%%%%%%%%%%%%%%%%%%% %%% lowercjkchar: eg, \lowercjkchar{-0.1em} @@ -309,11 +365,11 @@ \ifx\CJK@charlower\undefined\else \DeclareRobustCommand{\CJKsymbol}[1]{% \leavevmode\lower\CJK@charlower\hbox{% inserted - \symbol{#1}% - \ifCJK@bold@ - \hbox to \CJKboldshift{\hss\symbol{#1}}% - \hbox to \CJKboldshift{\hss\symbol{#1}}% - \fi + \symbol{#1}% + \ifCJK@bold@ + \hbox to \CJKboldshift{\hss\symbol{#1}}% + \hbox to \CJKboldshift{\hss\symbol{#1}}% + \fi }% inserted } \fi\fi @@ -321,7 +377,10 @@ %%%%%%%%%%%%%%%%%%%%%%%%% %%% nanummj has no hanja : texlive only -\RequirePackage{cjkutf8-nanummjhanja} +\def\CJKKO@mjdefault{nanummj} +\ifx\CJKKO@mjfont\CJKKO@mjdefault + \RequirePackage{cjkutf8-nanummjhanja} +\fi %%%%%%%%%%%%%%%%%%%%%%%%% %%% auto-josa, light version @@ -359,10 +418,6 @@ %%% cause: memoir appempts to write index entries to a file %%% at the end of document without protecting active characters. %%% spotted by Juho Lee. thanks to him. -\@ifclassloaded{memoir}{ - \AtEndDocument{\edef\@sanitize{\unexpanded\expandafter{\@sanitize - \let\protect\string - }}} -}{} +\AtEndDocument{\CJK@makeInactive} \endinput |