diff options
author | Karl Berry <karl@freefriends.org> | 2009-09-15 00:42:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-09-15 00:42:27 +0000 |
commit | 9b5c0be75f6856d930bda2f309319b167a6ea2fb (patch) | |
tree | 634dc72a8f8a7422675947d0837020332cd76f05 /Master/texmf-dist/tex | |
parent | ecbaa3a13d808b7db882290d1ffe9e3c45db774d (diff) |
xecjk 2.3.8 (14sep09)
git-svn-id: svn://tug.org/texlive/trunk@15287 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 294 |
1 files changed, 164 insertions, 130 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index e0244c40305..06a4d0cae47 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.3.5 (2-Aug-2009) +%% Version 2.3.8 (12-Sept-2009) %% %% 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.3.5} -\def\filedate{2009/08/02} +\def\fileversion{2.3.8} +\def\filedate{2009/09/12} \ProvidesPackage{xeCJK}[\filedate\space\fileversion] \RequirePackage{ifxetex} \RequireXeTeX @@ -336,7 +336,7 @@ \def\xeCJK@cclv@{ \ifnum\lastkern=\@ne - \CJKecglue + \@sptoken%\CJKecglue \fi} \let\xeCJK@cclv@iv\xeCJK@cclv@ @@ -345,7 +345,7 @@ \CJKglue \else \ifnum\lastkern=\xeCJK@four - \CJKecglue + \@sptoken%\CJKecglue \else \ifnum\lastnodetype=\xeCJK@ten \CJKecglue @@ -401,7 +401,14 @@ \def\xeCJK@@@checknext{ \ifx $\@let@token - \CJKecglue + \@sptoken%\CJKecglue + \else + \if\relax\noexpand\@let@token + \ifx\@let@token\xeCJK@par + \else + \@sptoken + \fi + \fi \fi \let\xeCJK@nexttoken\relax} @@ -437,8 +444,9 @@ \expandafter\xeCJK@setcurrentchar@ii \fi} +\let\xeCJK@par\par \def\xeCJK@checkpar{ - \@ifnextchar\par{\xeCJK@setcurrentnobreakchar@ii}{\xeCJK@setcurrentchar@ii}} + \@ifnextchar\xeCJK@par{\xeCJK@setcurrentnobreakchar@ii}{\xeCJK@setcurrentchar@ii}} \def\xeCJKsetecglue#1{ \def\CJK@ecglue{#1} @@ -721,7 +729,6 @@ \def\setCJKfamilyfont#1{ \xeCJK@newfontfamily{#1}} - \DeclareRobustCommand\rmfamily {\not@math@alphabet\rmfamily\mathrm \fontfamily\rmdefault\CJKfamily{rm}\selectfont} @@ -733,7 +740,6 @@ \DeclareRobustCommand\ttfamily {\not@math@alphabet\ttfamily\mathtt \fontfamily\ttdefault\CJKfamily{tt}\selectfont} - \newcommand*\xeCJK@newfontfamily[1]{ \@ifnextchar[ {\xeCJK@newfontfamily@{#1}} @@ -742,117 +748,41 @@ \def\xeCJK@newfontfamily@#1[#2]#3{ % % Get user defined options - \def\xeCJK@temp{#2} - \expandafter - \xeCJK@getBoldFont\xeCJK@temp BoldFont={}{}\relax - \expandafter - \xeCJK@getBoldItalicFont\xeCJK@temp BoldItalicFont={}{}\relax - \expandafter - \xeCJK@getItalicFont\xeCJK@temp ItalicFont={}{}\relax - - \expandafter - \xeCJK@getBoldItalicFeatures\xeCJK@temp BoldItalicFeatures={}{}\relax - \expandafter - \xeCJK@getBoldFeatures\xeCJK@temp BoldFeatures={}{}\relax - \expandafter - \xeCJK@getItalicFeatures\xeCJK@temp ItalicFeatures={}{}\relax - + \def\xeCJK@temp{#2,} \expandafter - \xeCJK@getRawFeature\xeCJK@BoldFeatures RawFeature={}{}\relax - \edef\xeCJK@Bold@RawFeature{\xeCJK@tempRawFeature} - + \xeCJK@getBoldFont\xeCJK@temp BoldFont={},{}\relax \expandafter - \xeCJK@getRawFeature\xeCJK@BoldItalicFeatures RawFeature={}{}\relax - \edef\xeCJK@BoldItalic@RawFeature{\xeCJK@tempRawFeature} - + \xeCJK@getBoldItalicFont\xeCJK@temp BoldItalicFont={},{}\relax \expandafter - \xeCJK@getRawFeature\xeCJK@ItalicFeatures RawFeature={}{}\relax - \edef\xeCJK@Italic@RawFeature{\xeCJK@tempRawFeature} + \xeCJK@getItalicFont\xeCJK@temp ItalicFont={},{}\relax \edef\xeCJK@Features{} \ifxeCJK@BoldFont@ \ifx\xeCJK@BoldFont\@empty - - \ifx\xeCJK@Bold@RawFeature\@empty - \def\xeCJK@Bold@RawFeature{ - embolden=\xeCJK@emboldenfactor} - \else - \edef\xeCJK@Bold@RawFeature{ - embolden=\xeCJK@emboldenfactor, - \xeCJK@Bold@RawFeature} - \fi - - \ifx\xeCJK@BoldFeatures\@empty - \edef\xeCJK@Features{ - BoldFeatures={ - RawFeature={\xeCJK@Bold@RawFeature}}} - \else - \edef\xeCJK@Features{ - BoldFeatures={ - \xeCJK@BoldFeatures, - RawFeature={\xeCJK@Bold@RawFeature}}} - \fi - - \ifx\xeCJK@BoldItalic@RawFeature\@empty - \def\xeCJK@BoldItalic@RawFeature{ - embolden=\xeCJK@emboldenfactor} - \else - \edef\xeCJK@BoldItalic@RawFeature{ - embolden=\xeCJK@emboldenfactor, - \xeCJK@BoldItalic@RawFeature} - \fi + \edef\xeCJK@Features{BoldFont={#3}, + BoldFeatures={RawFeature={embolden=\xeCJK@emboldenfactor}}} \fi \fi \ifxeCJK@SlantFont@ \ifx\xeCJK@ItalicFont\@empty - - \ifx\xeCJK@Italic@RawFeature\@empty - \edef\xeCJK@Italic@RawFeature{ - slant=\xeCJK@slantfactor} - \else - \edef\xeCJK@Italic@RawFeature{ - slant=\xeCJK@slantfactor, - \xeCJK@Italic@RawFeature} - \fi - - \ifx\xeCJK@ItalicFeatures\@empty - \edef\xeCJK@ItalicFeatures{ - RawFeature={\xeCJK@Italic@RawFeature}} - \else - \edef\xeCJK@ItalicFeatures{ - \xeCJK@ItalicFeatures, - RawFeature={\xeCJK@Italic@RawFeature}} - \fi - - \ifx\xeCJK@BoldItalic@RawFeature\@empty - \edef\xeCJK@BoldItalic@RawFeature{ - slant=\xeCJK@slantfactor} - \else - \edef\xeCJK@BoldItalic@RawFeature{ - slant=\xeCJK@slantfactor, - \xeCJK@BoldItalic@RawFeature} - \fi - - \ifx\xeCJK@BoldItalicFeatures\@empty - \edef\xeCJK@BoldItalicFeatures{ - RawFeature={\xeCJK@BoldItalic@RawFeature}} + \ifx\xeCJK@Features\@empty + \edef\xeCJK@Features{ItalicFont={#3}, + ItalicFeatures={RawFeature={slant=\xeCJK@slantfactor}}} \else - \edef\xeCJK@BoldItalicFeatures{ - \xeCJK@BoldItalicFeatures, - RawFeature={\xeCJK@BoldItalic@RawFeature}} + \edef\xeCJK@Features{\xeCJK@Features,ItalicFont={#3}, + ItalicFeatures={RawFeature={slant=\xeCJK@slantfactor}}} \fi + \fi - \ifx\xeCJK@Features\@empty - \edef\xeCJK@Features{ - ItalicFeatures={\xeCJK@ItalicFeatures}, - BoldItalicFeatures={\xeCJK@BoldItalicFeatures}} + \ifx\xeCJK@BoldItalicFont\@empty + \ifx\xeCJK@BoldFont\@empty + \edef\xeCJK@Features{\xeCJK@Features,BoldItalicFont={#3}, + BoldItalicFeatures={RawFeature={embolden=\xeCJK@emboldenfactor,slant=\xeCJK@slantfactor}}} \else - \edef\xeCJK@Features{ - \xeCJK@Features, - ItalicFeatures={\xeCJK@ItalicFeatures}, - BoldItalicFeatures={\xeCJK@BoldItalicFeatures}} + \edef\xeCJK@Features{\xeCJK@Features,BoldItalicFont={\xeCJK@BoldFont}, + BoldItalicFeatures={RawFeature={slant=\xeCJK@slantfactor}}} \fi \fi \fi @@ -860,53 +790,153 @@ \edef\xeCJK@temp{#2} \ifx\xeCJK@temp\@empty \else - \edef\xeCJK@temp{,#2} - \fi - - \ifx\xeCJK@Features\@empty - \else - \edef\xeCJK@Features{,\xeCJK@Features} + \ifx\xeCJK@Features\@empty + \edef\xeCJK@Features{#2} + \else + \edef\xeCJK@Features{\xeCJK@Features,#2} + \fi \fi - \edef\xeCJK@Features{ - [BoldFont={#3}, - ItalicFont={#3}, - BoldItalicFont={#3}% The first three parameters can be overridden by - % user defined parameters in #2 - \xeCJK@temp\xeCJK@Features]} - - \expandafter - \newfontfamily@i\csname xeCJK@font@#1\expandafter\endcsname - \xeCJK@Features - {#3} - \expandafter\edef\csname xeCJK@nsff\xeCJK@family\endcsname{\zf@family}} + \edef\@tempa{\noexpand\zf@fontspec{\xeCJK@Features}{#3}} + \@tempa + \edef\@tempa{ + \noexpand\DeclareRobustCommand\expandafter\noexpand\csname xeCJK@font@#1\endcsname + {\noexpand\fontfamily{\zf@family}\noexpand\selectfont}} + \@tempa + \expandafter\edef\csname xeCJK@nsff#1\endcsname{\zf@family}} \def\xeCJK@setmacro@getkey#1{ - \expandafter\def\csname xeCJK@get#1\endcsname ##1#1=##2##3\relax{ + \expandafter\def\csname xeCJK@get#1\endcsname ##1#1=##2,##3\relax{ \expandafter\edef\csname xeCJK@#1\endcsname{##2} \edef\xeCJK@temp{##1##3}}} \xeCJK@setmacro@getkey{BoldFont} \xeCJK@setmacro@getkey{ItalicFont} \xeCJK@setmacro@getkey{BoldItalicFont} -\xeCJK@setmacro@getkey{ItalicFeatures} -\xeCJK@setmacro@getkey{BoldFeatures} -\xeCJK@setmacro@getkey{BoldItalicFeatures} - -\def\xeCJK@getRawFeature#1RawFeature=#2#3\relax{ - \edef\xeCJK@tempRawFeature{#2}} \define@key[zf]{preparse}{ItalicFeatures}{ \edef\zf@it@feat{,#1} \edef\zf@family@long{\zf@family@long itfeat:#1}} +\renewcommand*\zf@fontspec[2]{% + \begingroup + \zf@init + \edef\zf@fontname{#2}% + \let\zf@family@long\zf@fontname + \setkeys*[zf]{prepreparse}{#1}% + \let\zf@up\zf@fontname + \edef\@tempa{\noexpand\setkeys*[zf]{preparse}{\XKV@rm}}\@tempa + \let\zf@fontname\zf@up + \let\zf@font@feat\XKV@rm + \font\zf@basefont="\zf@font@wrap\zf@fontname\zf@suffix" at \f@size pt + \unless\ifzf@icu + \zf@set@font@type + \fi + \ifx\zf@suffix\@empty + \ifzf@atsui + \def\zf@suffix{/AAT}% + \else + \ifzf@icu + \def\zf@suffix{/ICU}% + \fi + \fi + \font\zf@basefont="\zf@font@wrap\zf@fontname\zf@suffix" at \f@size pt + \fi + \zf@firsttimetrue + \zf@get@feature@requests{\zf@font@feat}% + \zf@firsttimefalse + \unless\ifcsname zf@UID@\zf@family@long\endcsname + \edef\@tempa{#2}% + \ifcsname c@zf@famc@\@tempa\endcsname + \expandafter\stepcounter\else + \expandafter\newcounter\fi + {zf@famc@\@tempa}% + \gdef@cx{zf@UID@\zf@family@long}{% + \expandafter\expandafter\expandafter + \zap@space\expandafter\@tempa\space\@empty + (\expandafter\the\csname c@zf@famc@\@tempa\endcsname)}% + \fi + \xdef\zf@family{\@nameuse{zf@UID@\zf@family@long}}% + \unless\ifcsname zf@family@fontname\zf@family\endcsname + \zf@PackageInfo{Defining font family for '#2' + with options [\zf@default@options #1]}% + \gdef@cx{zf@family@fontname\zf@family}{\zf@fontname}% + \gdef@cx{zf@family@options\zf@family}{\zf@default@options #1}% + \gdef@cx{zf@family@fontdef\zf@family} + {\zf@fontname\zf@suffix:\zf@pre@ff\zf@ff}% + \DeclareFontFamily{\zf@enc}{\zf@family}{}% + \zf@make@font@shapes{\zf@fontname} + {\mddefault}{\updefault}{\zf@font@feat\zf@up@feat}% + \unless\ifzf@nobf + \ifx\zf@bf\@empty + \zf@make@font@shapes[\zf@fontname]{/B} + {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat}% + \else + \zf@make@font@shapes{\zf@bf} + {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat}% + \fi + \fi + \unless\ifzf@noit + \ifx\zf@it\@empty + \zf@make@font@shapes[\zf@fontname]{/I} + {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat}% + \else + \zf@make@font@shapes{\zf@it} + {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat}% + \fi + \fi + \@tempswatrue + \ifzf@nobf\@tempswafalse\fi + \ifzf@noit\@tempswafalse\fi + \if@tempswa + \ifx\zf@bfit\@empty + \ifx\zf@bf\@empty + \ifx\zf@it\@empty + \zf@make@font@shapes[\zf@fontname]{/BI} + {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}% + \else + \zf@make@font@shapes[\zf@it]{/B} + {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}% + \fi + \else + \zf@make@font@shapes[\zf@bf]{/I} + {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}% + \fi + \else + \zf@make@font@shapes{\zf@bfit} + {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat}% + \fi + \fi + \ifxeCJK@SlantFont@ + \zf@make@font@shapes{\zf@fontname}{\mddefault}{\sldefault} + {\zf@font@feat,RawFeature={slant=0.167}} + \ifx\zf@bf\@empty + \ifzf@nobf + \zf@make@font@shapes{\zf@fontname}{\bfdefault}{\sldefault} + {\zf@font@feat,RawFeature={embolden=4,slant=0.167}} + \else + \zf@make@font@shapes[\zf@fontname]{/B} + {\bfdefault}{\sldefault}{\zf@font@feat\zf@bf@feat,RawFeature={slant=0.167}} + \fi + \else + \ifx\zf@fontname\zf@bf + \zf@make@font@shapes{\zf@fontname}{\bfdefault}{\sldefault} + {\zf@font@feat,RawFeature={embolden=4,slant=0.167}} + \else + \zf@make@font@shapes{\zf@bf}{\bfdefault}{\sldefault} + {\zf@font@feat\zf@bf@feat,RawFeature={slant=0.167}} + \fi + \fi + \fi + \fi + \endgroup} + \newcount\xeCJK@featureadded \xeCJK@featureadded=0 \let\xeCJK@addfontfeatures\addfontfeatures -\def\addfontfeatures#1{ +\def\addCJKfontfeatures#1{ \global\advance\xeCJK@featureadded\@ne - \xeCJK@addfontfeatures{#1} \ifcsname xeCJK@family\endcsname \edef\xeCJK@temp{\csname xeCJK@nsff\xeCJK@family\endcsname} \edef\xeCJK@Features{[\csname zf@family@options\xeCJK@temp\endcsname,#1]} @@ -918,6 +948,10 @@ \CJKfamily{\xeCJK@family @\the\xeCJK@featureadded} \fi} +\def\addfontfeatures#1{ + \xeCJK@addfontfeatures{#1} + \addCJKfontfeatures{#1}} + \def\xeCJK@font@rm{} |