diff options
author | Karl Berry <karl@freefriends.org> | 2014-09-21 21:00:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-09-21 21:00:28 +0000 |
commit | aebdde957627075387b7925dc4a67ec44413d87a (patch) | |
tree | 74df23ad71401151c62ebabfe96f50cd9900b485 /Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty | |
parent | 21fe8b8ecfb2cb7c2d3c552a1eb8b0ed10d468c6 (diff) |
xepersian (21sep14)
git-svn-id: svn://tug.org/texlive/trunk@35224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty | 258 |
1 files changed, 150 insertions, 108 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty index dc32cf70b4b..277c678c6f6 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty @@ -7,7 +7,7 @@ %% xepersian.dtx (with options: `table,xepersian.sty') %% %% __________________________________________________ -%% Copyright © 2008–2013 Vafa Khalighi <tex.ctan@gmail.com> +%% Copyright © 2008–2014 Vafa Khalighi <tex.ctan@gmail.com> %% %% It may be distributed and/or modified under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of @@ -17,7 +17,7 @@ %% by Vafa Khalighi. %% %% -%% \CheckSum{9842} +%% \CheckSum{9899} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -35,11 +35,12 @@ %% Right brace \} Tilde \~} %% \NeedsTeXFormat{LaTeX2e} -\def\xepersianversion{v14.6} -\def\xepersiandate{2014/09/10} +\def\xepersianversion{v14.9} +\def\xepersiandate{2014/09/21} \ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space Persian typesetting in XeLaTeX] \RequirePackage{fontspec} +\RequirePackage{xkeyval} \RequirePackage{xepersian-persiancal} \RequirePackage{xepersian-mathsdigitspec} \RequirePackage[RTLdocument]{bidi} @@ -51,7 +52,7 @@ Persian typesetting in XeLaTeX] * typesetting, using fonts provided in the^^J% * distribution.^^J% * ^^J% -* Copyright © 2008–2013 Vafa Khalighi^^J% +* Copyright © 2008–2014 Vafa Khalighi^^J% * ^^J% * \xepersianversion, \xepersiandate^^J% * ^^J% @@ -95,46 +96,58 @@ Persian typesetting in XeLaTeX] \newfontscript{Parsi}{arab} \newfontlanguage{Parsi}{FAR} \ExplSyntaxOn -\DeclareDocumentCommand \settextfont { O{} m } { - \fontspec_select:nn{Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N \persianfont { +\DeclareDocumentCommand \settextfont { O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N \persianfont _family } {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N \persianfont + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N \persianfont _family} } \exp_not:N \selectfont + } + } \cs_set_eq:NN \rmdefault \l_fontspec_family_tl \normalfont -} -\DeclareDocumentCommand \setlatintextfont { O{} m } { - \fontspec_select:nn{Mapping=tex-text,#1}{#2} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N \latinfont { + } +\DeclareDocumentCommand \setlatintextfont { O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N \latinfont _family } {Mapping=tex-text,#1,#3} {#2} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N \latinfont + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N \latinfont _family} } \exp_not:N \selectfont + } + } + } \cs_set_eq:NN \setlatinsansfont \setsansfont \cs_set_eq:NN \setlatinmonofont \setmonofont -\DeclareDocumentCommand \defpersianfont { m O{} m } { - \fontspec_select:nn{Script=Parsi,Language=Parsi,Mapping=parsidigits,#2}{#3} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N #1 { +\DeclareDocumentCommand \defpersianfont { m O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {Script=Parsi,Language=Parsi,Mapping=parsidigits,#2,#4} {#3} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N #1 + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} -\DeclareDocumentCommand \deflatinfont { m O{} m } { - \fontspec_select:nn{Mapping=tex-text,#2}{#3} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N #1 { + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont + } + } + } +\DeclareDocumentCommand \deflatinfont { m O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {Mapping=tex-text,#2,#4} {#3} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N #1 + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont + } + } + } \newcommand\persiansfdefault{} \newcommand\persianttdefault{} \newcommand\iranicdefault{} @@ -165,30 +178,42 @@ Persian typesetting in XeLaTeX] \DeclareTextFontCommand{\textnavar}{\navarfamily} \DeclareTextFontCommand{\textpook}{\pookfamily} \DeclareTextFontCommand{\textsayeh}{\sayehfamily} -\DeclareDocumentCommand \setpersiansansfont { O{} m } { - \fontspec_set_family:Nnn \persiansfdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} +\DeclareDocumentCommand \setpersiansansfont { O{} m O{} } + { + \fontspec_set_family:Nnn \persiansfdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setpersianmonofont { O{} m } { - \fontspec_set_family:Nnn \persianttdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setpersianmonofont { O{} m O{} } + { + \fontspec_set_family:Nnn \persianttdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setnavarfont { O{} m } { - \fontspec_set_family:Nnn \navardefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setnavarfont { O{} m O{} } + { + \fontspec_set_family:Nnn \navardefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setpookfont { O{} m } { - \fontspec_set_family:Nnn \pookdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setpookfont { O{} m O{} } + { + \fontspec_set_family:Nnn \pookdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setsayehfont { O{} m } { - \fontspec_set_family:Nnn \sayehdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setsayehfont { O{} m O{} } + { + \fontspec_set_family:Nnn \sayehdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setiranicfont { O{} m } { - \fontspec_set_family:Nnn \iranicdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setiranicfont { O{} m O{} } + { + \fontspec_set_family:Nnn \iranicdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} + \ignorespaces + } \ExplSyntaxOff \def\resetlatinfont{% \let\normalfont\latinfont% @@ -627,59 +652,76 @@ or load the package with `preloadedlatintextfont' option.}% \@ifclassloaded{refrep}{\input{refrep-xepersian.def}}{} \@ifclassloaded{memoir}{\input{memoir-xepersian.def}}{} \@ifclassloaded{imsproc}{\input{imsproc-xepersian.def}}{} -\DeclareOption{Kashida}{\input{kashida-xepersian.def}} -\DeclareOption{localise}{\input{localise-xepersian.def}} -\DeclareOption{extrafootnotefeatures}{\@extrafootnotefeaturestrue} -\DeclareOption{quickindex}{% -\PackageWarning{xepersian}{Obsolete option}% -\ifwritexviii% -\@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% -\renewcommand\printindex{\newpage% -\immediate\closeout\@indexfile -\immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} -\@input@{\jobname.ind}}}% -\else -\PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} -\fi} -\DeclareOption{quickindex-variant1}{% -\ifwritexviii% -\@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% -\renewcommand\printindex{\newpage% -\immediate\closeout\@indexfile -\immediate\write18{xindy -L persian-variant1 -C utf8 -M texindy -M page-ranges \jobname.idx} -\@input@{\jobname.ind}}}% -\else -\PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} -\fi} -\DeclareOption{quickindex-variant2}{% -\ifwritexviii% -\@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% -\renewcommand\printindex{\newpage% -\immediate\closeout\@indexfile -\immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} -\@input@{\jobname.ind}}}% -\else -\PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} -\fi} -\DeclareOption{preloadedtextfont}{% -\settextfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique}]{parisa-regular}% -} -\DeclareOption{preloadeddigitfont}{% -\setdigitfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique}]{parisa-regular}% -} -\DeclareOption{preloadedpookfont}{% -\setpookfont[ExternalLocation,ItalicFont={parisa-italicoutline},SlantedFont={parisa-obliqueoutline}]{parisa-outline}% -} -\DeclareOption{preloadedsayehfont}{% -\setsayehfont[ExternalLocation,ItalicFont={parisa-italicshadow},SlantedFont={parisa-obliqueshadow}]{parisa-shadow}% -} -\DeclareOption{preloadediranicfont}{% -\setiranicfont[ExternalLocation,BoldFont={parisa-boldoblique}]{parisa-oblique}% -} -\DeclareOption{preloadedlatintextfont}{% -\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular},SlantedFont={lmromanslant10-regular},BoldSlantedFont={lmromanslant10-bold}]{lmroman10-regular}% -} -\ProcessOptions +\define@choicekey{xepersian.sty}{Kashida}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \input{kashida-xepersian.def} + \fi} +\define@choicekey{xepersian.sty}{localise}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \input{localise-xepersian.def} + \fi} +\define@choicekey{xepersian.sty}{extrafootnotefeatures}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \@extrafootnotefeaturestrue + \or + \@extrafootnotefeaturesfalse + \fi} +\define@choicekey{xepersian.sty}{quickindex}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \PackageWarning{xepersian}{Obsolete option}% + \ifwritexviii% + \@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% + \renewcommand\printindex{\newpage% + \immediate\closeout\@indexfile + \immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} + \@input@{\jobname.ind}}}% + \else + \PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} + \fi + \fi} +\define@choicekey{xepersian.sty}{quickindex-variant1}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \ifwritexviii% + \@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% + \renewcommand\printindex{\newpage% + \immediate\closeout\@indexfile + \immediate\write18{xindy -L persian-variant1 -C utf8 -M texindy -M page-ranges \jobname.idx} + \@input@{\jobname.ind}}}% + \else + \PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} + \fi + \fi} +\define@choicekey{xepersian.sty}{quickindex-variant2}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \ifwritexviii% + \@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% + \renewcommand\printindex{\newpage% + \immediate\closeout\@indexfile + \immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} + \@input@{\jobname.ind}}}% + \else + \PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} + \fi + \fi} +\DeclareOptionX{preloadedtextfont}{% +\settextfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique},#1]{parisa-regular}% +} +\DeclareOptionX{preloadeddigitfont}{% +\setdigitfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique},#1]{parisa-regular}% +} +\DeclareOptionX{preloadedpookfont}{% +\setpookfont[ExternalLocation,ItalicFont={parisa-italicoutline},SlantedFont={parisa-obliqueoutline},#1]{parisa-outline}% +} +\DeclareOptionX{preloadedsayehfont}{% +\setsayehfont[ExternalLocation,ItalicFont={parisa-italicshadow},SlantedFont={parisa-obliqueshadow},#1]{parisa-shadow}% +} +\DeclareOptionX{preloadediranicfont}{% +\setiranicfont[ExternalLocation,BoldFont={parisa-boldoblique},#1]{parisa-oblique}% +} +\DeclareOptionX{preloadedlatintextfont}{% +\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular},SlantedFont={lmromanslant10-regular},BoldSlantedFont={lmromanslant10-bold},#1]{lmroman10-regular}% +} +\ProcessOptionsX \if@extrafootnotefeatures \input{extrafootnotefeatures-xetex-bidi.def} |