diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-17 23:00:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-17 23:00:04 +0000 |
commit | 4c3d942ca695f11236ecee35e9ac3cbe3c28d452 (patch) | |
tree | 0074f8974539ae098b1f3ede47122cbb15fe5757 /Master/texmf-dist/tex/xelatex | |
parent | ae2491a03dcd2036d8879409d6fe624854f27e3f (diff) |
xecjk (17sep11)
git-svn-id: svn://tug.org/texlive/trunk@23994 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 118 |
1 files changed, 96 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index 7fce8d8f86e..441dc0605fe 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `xeCJK') %% -%% Version 2.4.2 (12-June-2011) +%% Version 2.4.4 (17-Sep-2011) %% %% Copyright (C) Wenchang Sun <sunwch@hotmail.com> %% @@ -18,8 +18,8 @@ %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% -\def\fileversion{2.4.2} -\def\filedate{2011/06/12} +\def\fileversion{2.4.4} +\def\filedate{2011/09/17} \ProvidesPackage{xeCJK}[\filedate\space\fileversion\space package for typesetting CJK scripts with XeLaTeX] \RequirePackage{ifxetex} \RequireXeTeX @@ -68,13 +68,19 @@ \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{fontspec}} \ProcessOptions\relax +\RequirePackage{xkeyval} +\RequirePackage{expl3} \RequirePackage{fontspec} -\relax \ifxeCJK@indentfirst \let\@afterindentfalse\relax \fi \endlinechar \m@ne +\def\xeCJK@patch#1#2#3{ + \edef#1{ + \unexpanded{#2} + \unexpanded\expandafter{#1} + \unexpanded{#3}}} \def\makexeCJKactive{ \XeTeXinterchartokenstate=1\relax} @@ -171,15 +177,15 @@ \normalspacedchars{/} \AtBeginDocument{% - \let\xeCJK@save@textellipsis\textellipsis - \def\textellipsis{\begingroup\makexeCJKinactive - \xeCJK@save@textellipsis\endgroup} - \let\xeCJK@save@textperiodcentered\textperiodcentered - \def\textperiodcentered{\begingroup\makexeCJKinactive - \xeCJK@save@textperiodcentered\endgroup} - \let\xeCJK@save@textcentereddot\textcentereddot - \def\textcentereddot{\begingroup\makexeCJKinactive - \xeCJK@save@textcentereddot\endgroup} + \xeCJK@patch\textellipsis {\begingroup\makexeCJKinactive}{\endgroup} + \xeCJK@patch\textperiodcentered {\begingroup\makexeCJKinactive}{\endgroup} + \xeCJK@patch\textcentereddot {\begingroup\makexeCJKinactive}{\endgroup} + \xeCJK@patch\tipaencoding {\makexeCJKinactive}{} % tipa package in T3 encoding + \let\xeCJK@save@r\r + \def\r#1{{\makexeCJKinactive\xeCJK@save@r{#1}}} % \r{u} in T1 encoding + \@ifpackageloaded{pifont}{ % pifont package in U encoding + \renewcommand\Pifont[1]{\fontfamily{#1}\fontencoding{U}% + \fontseries{m}\fontshape{n}\selectfont\makexeCJKinactive}}{} } \XeTeXinterchartoks 1 0{\egroup\CJKecglue} \XeTeXinterchartoks 1 1{\xeCJK@i@i} @@ -844,13 +850,17 @@ \fi} \def\xeCJK@setfont{ - \ifcsname\xeCJK@family/\f@series/\f@shape/\f@size\endcsname - \csname\xeCJK@family/\f@series/\f@shape/\f@size\endcsname + \ifcsname xeCJK@\xeCJK@family/\f@series/\f@shape/\f@size\endcsname + \csname xeCJK@\xeCJK@family/\f@series/\f@shape/\f@size\endcsname \else + \edef\xeCJK@currentcoor{xeCJK@\xeCJK@family/\f@series/\f@shape/\f@size} \csname xeCJK@font@\xeCJK@family\endcsname - \get@external@font + \begingroup + \get@external@font + \edef\xeCJK@temp{\def\noexpand\external@font{\external@font}} + \expandafter\endgroup\xeCJK@temp \expandafter\global\expandafter\font - \csname\xeCJK@family/\f@series/\f@shape/\f@size\endcsname=\external@font + \csname\xeCJK@currentcoor\endcsname=\external@font \fi} \def\CJKrmdefault{rm} @@ -864,8 +874,6 @@ \xeCJK@newfontfamily{\CJKsfdefault}} \providecommand\CJKttdefault{tt} -\def\setCJKmonofont{ - \xeCJK@newfontfamily{\CJKttdefault}} \def\setCJKfamilyfont#1{ \xeCJK@newfontfamily{#1}} @@ -887,9 +895,6 @@ {\not@math@alphabet\sffamily\mathsf \fontfamily\sfdefault\CJKfamily{\CJKsfdefault}\selectfont} -\DeclareRobustCommand\ttfamily - {\not@math@alphabet\ttfamily\mathtt - \fontfamily\ttdefault\CJKfamily{\CJKttdefault}\selectfont} \newcommand*\xeCJK@newfontfamily[1]{ \@ifnextchar[ {\xeCJK@newfontfamily@{#1}} @@ -1003,6 +1008,75 @@ \xeCJKsetslantfactor{0.17} \xeCJKsetemboldenfactor{4} +\ExplSyntaxOn + +\fp_new:N \g_xecjk_monoscale_fp +\fp_gset_eq:NN \g_xecjk_monoscale_fp \c_one_fp + +\dim_new:N \g_xecjk_exspace_dim +\dim_gset_eq:NN \g_xecjk_exspace_dim \c_zero_dim + +\cs_new:Nn \xecjk_setmonoscale: +{ + \dim_gset_eq:NN \g_xecjk_exspace_dim \c_zero_dim + \group_begin: + \fontfamily\ttdefault\selectfont + \fp_gset_from_dim:Nn \g_xecjk_monoscale_fp {\c_two\fontdimen\c_two\font} + \fp_gdiv:Nn \g_xecjk_monoscale_fp {\f@size} + \group_end: +} + +\newcommand*\setCJKmonoscale{ + \xecjk_setmonoscale: + \addCJKfontfeatures{Scale=\fp_use:N\g_xecjk_monoscale_fp} +} + +\DeclareRobustCommand\setCJKmonoscalefont[2][]{ + \xecjk_setmonoscale: + \xeCJK@newfontfamily{\CJKttdefault}[#1,Scale=\fp_use:N \g_xecjk_monoscale_fp]{#2}} + +\cs_new:Nn \xecjk_set_monoexspace: +{ + \fp_gset_eq:NN \g_xecjk_monoscale_fp \c_one_fp + \group_begin: + \fontfamily\ttdefault\selectfont + \dim_gset:Nn \g_xecjk_exspace_dim {\c_two\fontdimen\c_two\font - \f@size\p@} + \group_end: +} + +\newcommand*\setCJKmonoexspace{ + \xecjk_set_monoexspace: + \CJKsetecglue{\skip_horizontal:N .5\g_xecjk_exspace_dim} + \def\CJKglue{\skip_horizontal:N \g_xecjk_exspace_dim} +} + +\DeclareRobustCommand\setCJKmonoexspacefont[2][]{ + \setCJKmonoexspace + \xeCJK@newfontfamily{\CJKttdefault}[#1]{#2}} + +\def\xeCJK@ifplus#1{\@ifnextchar +{\@firstoftwo{#1}}} + +\DeclareRobustCommand\setCJKmonofont{\@ifstar + {\setCJKmonoscalefont} + {\xeCJK@ifplus + {\setCJKmonoexspacefont} + {\xeCJK@newfontfamily{\CJKttdefault}}}} + +\DeclareRobustCommand\ttfamily + {\not@math@alphabet\ttfamily\mathtt + \fontfamily\ttdefault\CJKfamily{\CJKttdefault}\selectfont + \CJKsetecglue{\skip_horizontal:N .5\g_xecjk_exspace_dim} + \def\CJKglue{\skip_horizontal:N \g_xecjk_exspace_dim}} + +\AtBeginDocument{ + \tl_put_right:Nn \verbatim@font { + \punctstyle{plain} + \CJKsetecglue{\skip_horizontal:N \g_xecjk_exspace_dim} + \def\CJKglue{\skip_horizontal:N \g_xecjk_exspace_dim}} +} + +\ExplSyntaxOff + \ifxeCJK@num \edef\CJK@UnicodeEnc{UTF8} |