diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty | 103 |
1 files changed, 65 insertions, 38 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty index 1cbc58ae993..df8e113de6c 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty @@ -17,7 +17,7 @@ %% by Vafa Khalighi. %% %% -%% \CheckSum{10521} +%% \CheckSum{10569} %% \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,8 +35,8 @@ %% Right brace \} Tilde \~} %% \NeedsTeXFormat{LaTeX2e} -\def\xepersianversion{v20.5} -\def\xepersiandate{2018/01/04} +\def\xepersianversion{v20.6} +\def\xepersiandate{2018/01/08} \ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space Persian typesetting in XeLaTeX] \RequirePackage{fontspec} @@ -120,11 +120,11 @@ Persian typesetting in XeLaTeX] \DeclareDocumentCommand \settextfont { O{} m O{} } { - \__xepersian_main_settextfont:nnn {#1} {#2} {#3} + \__xepersian_main_settextfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_settextfont:nnn +\cs_new:Nn \__xepersian_main_settextfont:nn { - \fontspec_set_family:Nnn \g__xepersian_persianfont_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_persianfont_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \rmdefault \g__xepersian_persianfont_family \use:x { \exp_not:n { \DeclareRobustCommand \persianfont } { @@ -135,17 +135,20 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_settextfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_settextfont_hook:nn \use_none:nn + \DeclareDocumentCommand \settextdigitfont { O{} m O{} } { - \__xepersian_main_settextdigitfont:nnn {#1} {#2} {#3} + \__xepersian_main_settextdigitfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_settextdigitfont:nnn +\cs_new:Nn \__xepersian_main_settextdigitfont:nn { - \fontspec_set_family:Nnn \g__xepersian_textdigitfont_family {Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_textdigitfont_family {Mapping=parsidigits,#1} {#2} \use:x { \exp_not:n { \DeclareRobustCommand \xepersian@textdigitfont } @@ -155,6 +158,7 @@ Persian typesetting in XeLaTeX] \exp_not:N \selectfont } } + \__xepersian_settextdigitfont_hook:nn {#1} {#2} \XeTeXinterchartoks \e@alloc@intercharclass@top \bidi@digits@charclass = {\xepersian@@start@switch@textdigitfont} \XeTeXinterchartoks \bidi@digits@charclass \e@alloc@intercharclass@top = {\xepersian@@stop@switch@textdigitfont} \XeTeXinterchartoks \z@ \bidi@digits@charclass = {\xepersian@@start@switch@textdigitfont} @@ -177,19 +181,21 @@ Persian typesetting in XeLaTeX] \newcommand*{\xepersian@@stop@switch@textdigitfont}{\ifx\f@family\ttdefault\else\if@nonlatin\if@@textdigitfont@on\egroup\else\fi\fi\fi} } +\cs_set_eq:NN \__xepersian_settextdigitfont_hook:nn \use_none:nn + \DeclareDocumentCommand \setdigitfont { O{} m O{} } { - \__xepersian_main_settextdigitfont:nnn {#1} {#2} {#3} - \__xepersian_main_setmathdigitfont:nnn {#1} {#2} {#3} + \__xepersian_main_settextdigitfont:nn {#1,#3} {#2} + \__xepersian_main_setmathdigitfont:nn {#1,#3} {#2} } \DeclareDocumentCommand \setlatintextfont { O{} m O{} } { - \__xepersian_main_setlatintextfont:nnn {#1} {#2} {#3} + \__xepersian_main_setlatintextfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setlatintextfont:nnn +\cs_new:Nn \__xepersian_main_setlatintextfont:nn { - \fontspec_set_family:Nnn \g__xepersian_latinfont_family {Mapping=tex-text,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_latinfont_family {Mapping=tex-text,#1} {#2} \use:x { \exp_not:n { \DeclareRobustCommand \latinfont } { \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } @@ -199,20 +205,23 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setlatintextfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setlatintextfont_hook:nn \use_none:nn + \tl_set_eq:NN \setlatinsansfont \setsansfont \tl_set_eq:NN \setlatinmonofont \setmonofont \DeclareDocumentCommand \defpersianfont { m O{} m O{} } { - \__xepersian_main_defpersianfont:nnnn {#1} {#2} {#3} {#4} + \__xepersian_main_defpersianfont:nnn {#1} {#2,#4} {#3} } -\cs_set:Nn \__xepersian_main_defpersianfont:nnnn +\cs_new:Nn \__xepersian_main_defpersianfont:nnn { - \fontspec_set_family:cnn { g__xepersian_ \cs_to_str:N #1 _family } {Script=Parsi,Language=Parsi,Mapping=parsidigits,#2,#4} {#3} + \fontspec_set_family:cnn { g__xepersian_ \cs_to_str:N #1 _family } {Script=Parsi,Language=Parsi,Mapping=parsidigits,#2} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 @@ -226,11 +235,11 @@ Persian typesetting in XeLaTeX] \DeclareDocumentCommand \deflatinfont { m O{} m O{} } { - \__xepersian_main_deflatinfont:nnnn {#1} {#2} {#3} {#4} + \__xepersian_main_deflatinfont:nnn {#1} {#2,#4} {#3} } -\cs_set:Nn \__xepersian_main_deflatinfont:nnnn +\cs_new:Nn \__xepersian_main_deflatinfont:nnn { - \fontspec_set_family:cnn { g__xepersian_ \cs_to_str:N #1 _family } {Mapping=tex-text,#2,#4} {#3} + \fontspec_set_family:cnn { g__xepersian_ \cs_to_str:N #1 _family } {Mapping=tex-text,#2} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 @@ -275,11 +284,11 @@ Persian typesetting in XeLaTeX] \DeclareDocumentCommand \setpersiansansfont { O{} m O{} } { - \__xepersian_main_setpersiansansfont:nnn {#1} {#2} {#3} + \__xepersian_main_setpersiansansfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setpersiansansfont:nnn +\cs_new:Nn \__xepersian_main_setpersiansansfont:nn { - \fontspec_set_family:Nnn \g__xepersian_persiansffamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_persiansffamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \persiansfdefault \g__xepersian_persiansffamily_family \use:x { \exp_not:n { \DeclareRobustCommand \persiansffamily } { @@ -290,17 +299,20 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\persiansfdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setpersiansansfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setpersiansansfont_hook:nn \use_none:nn + \DeclareDocumentCommand \setpersianmonofont { O{} m O{} } { - \__xepersian_main_setpersianmonofont:nnn {#1} {#2} {#3} + \__xepersian_main_setpersianmonofont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setpersianmonofont:nnn +\cs_new:Nn \__xepersian_main_setpersianmonofont:nn { - \fontspec_set_family:Nnn \g__xepersian_persianttfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_persianttfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \persianttdefault \g__xepersian_persianttfamily_family \use:x { \exp_not:n { \DeclareRobustCommand \persianttfamily } { @@ -311,17 +323,20 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\persianttdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setpersianmonofont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setpersianmonofont_hook:nn \use_none:nn + \DeclareDocumentCommand \setnavarfont { O{} m O{} } { - \__xepersian_main_setnavarfont:nnn {#1} {#2} {#3} + \__xepersian_main_setnavarfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setnavarfont:nnn +\cs_new:Nn \__xepersian_main_setnavarfont:nn { - \fontspec_set_family:Nnn \g__xepersian_navarfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_navarfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \navardefault \g__xepersian_navarfamily_family \use:x { \exp_not:n { \DeclareRobustCommand \navarfamily } { @@ -332,17 +347,20 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\navardefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setnavarfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setnavarfont_hook:nn \use_none:nn + \DeclareDocumentCommand \setpookfont { O{} m O{} } { - \__xepersian_main_setpookfont:nnn {#1} {#2} {#3} + \__xepersian_main_setpookfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setpookfont:nnn +\cs_new:Nn \__xepersian_main_setpookfont:nn { - \fontspec_set_family:Nnn \g__xepersian_pookfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_pookfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \pookdefault \g__xepersian_pookfamily_family \use:x { \exp_not:n { \DeclareRobustCommand \pookfamily } { @@ -353,17 +371,20 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\pookdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setpookfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setpookfont_hook:nn \use_none:nn + \DeclareDocumentCommand \setsayehfont { O{} m O{} } { - \__xepersian_main_setsayehfont:nnn {#1} {#2} {#3} + \__xepersian_main_setsayehfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setsayehfont:nnn +\cs_new:Nn \__xepersian_main_setsayehfont:nn { - \fontspec_set_family:Nnn \g__xepersian_sayehfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_sayehfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \sayehdefault \g__xepersian_sayehfamily_family \use:x { \exp_not:n { \DeclareRobustCommand \sayehfamily } { @@ -374,17 +395,20 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\sayehdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setsayehfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setsayehfont_hook:nn \use_none:nn + \DeclareDocumentCommand \setiranicfont { O{} m O{} } { - \__xepersian_main_setiranicfont:nnn {#1} {#2} {#3} + \__xepersian_main_setiranicfont:nn {#1,#3} {#2} } -\cs_set:Nn \__xepersian_main_setiranicfont:nnn +\cs_new:Nn \__xepersian_main_setiranicfont:nn { - \fontspec_set_family:Nnn \g__xepersian_iranicfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \fontspec_set_family:Nnn \g__xepersian_iranicfamily_family {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1} {#2} \tl_set_eq:NN \iranicdefault \g__xepersian_iranicfamily_family \use:x { \exp_not:n { \DeclareRobustCommand \iranicfamily } { @@ -395,10 +419,13 @@ Persian typesetting in XeLaTeX] } \str_if_eq_x:nnT {\familydefault} {\iranicdefault} { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } + \__xepersian_setiranicfont_hook:nn {#1} {#2} \normalfont \ignorespaces } +\cs_set_eq:NN \__xepersian_setiranicfont_hook:nn \use_none:nn + \ExplSyntaxOff \def\resetlatinfont{% \let\@xepersian@@fontsize@scale\xepersian@@fontsize@scale% |