summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty58
1 files changed, 39 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
index 88945d08f1a..1e31e24c9e1 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{9363}
+%% \CheckSum{9408}
%% \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{v17.7}
-\def\xepersiandate{2017/02/20}
+\def\xepersianversion{v17.9}
+\def\xepersiandate{2017/02/21}
\ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space
Persian typesetting in XeLaTeX]
\RequirePackage{fontspec}
@@ -319,12 +319,12 @@ Persian typesetting in XeLaTeX]
\@nonlatinfalse%
\let\normalfont\latinfont%
\let\reset@font\normalfont%
-\latinfont}
+\latinfont\normalsize}
\def\setpersianfont{%
\@nonlatintrue%
\let\normalfont\persianfont%
\let\reset@font\normalfont%
-\persianfont}
+\persianfont\normalsize}
\bidi@newrobustcmd*{\lr}[1]{\LRE{\resetlatinfont#1}}
\bidi@newrobustcmd*{\rl}[1]{\RLE{\setpersianfont#1}}
\def\latin{\LTR\LatinAlphs\@RTL@footnotefalse\resetlatinfont}
@@ -359,24 +359,23 @@ Persian typesetting in XeLaTeX]
\renewcommand*{\bidi@font@@outputpage}{\if@RTLmain\setpersianfont\else\resetlatinfont\fi}
+\newif\if@xepersian@@computeautoilg
\newcount\xepersian@tcl
\newdimen\xepersian@ilg
\newdimen\xepersian@strutilg
-\newbox\xepersian@wbox
-\newcommand*{\computeautoilg}{% compute the interline glue
- \xepersian@tcl=1536\xepersian@ilg=0pt\xepersian@strutilg=0pt
- \loop\setbox\xepersian@wbox=\hbox{\char\xepersian@tcl}
- \ifdim\ht\xepersian@wbox>\xepersian@ilg\xepersian@ilg=\ht\xepersian@wbox\fi
- \ifdim\dp\xepersian@wbox>\xepersian@strutilg\xepersian@strutilg=\dp\xepersian@wbox\fi
- \advance\xepersian@tcl by 1
- \ifnum\xepersian@tcl<1792\repeat
- \advance\xepersian@strutilg by \xepersian@ilg
- \ifdim\xepersian@strutilg>\baselineskip
- \PackageInfo{xepersian}{character with height+depth greater than current baselineskip found in font}
- \PackageInfo{xepersian}{baselineskip changed to that height+depth!}
- \linespread{\strip@pt\dimexpr 1pt * \xepersian@strutilg / \baselineskip\relax}
- \selectfont
+\chardef\f@ur=4
+\newcommand*{\xepersian@computeautoilg}{% compute the interline glue
+ \xepersian@tcl=1536\xepersian@ilg\z@\xepersian@strutilg\z@
+ \loop
+ \ifdim\XeTeXglyphbounds\tw@ \the\XeTeXcharglyph\xepersian@tcl>\xepersian@ilg
+ \xepersian@ilg=\XeTeXglyphbounds\tw@ \the\XeTeXcharglyph\xepersian@tcl
\fi
+ \ifdim\XeTeXglyphbounds\f@ur \the\XeTeXcharglyph\xepersian@tcl>\xepersian@strutilg
+ \xepersian@strutilg=\XeTeXglyphbounds\f@ur \the\XeTeXcharglyph\xepersian@tcl
+ \fi
+ \advance\xepersian@tcl\@ne
+ \ifnum\xepersian@tcl<1792\repeat
+ \advance\xepersian@strutilg\xepersian@ilg
}
\newcommand\twocolumnstableofcontents{%
@@ -860,6 +859,13 @@ number is 999,999,999.}%
{#1}
}
+\define@choicekey{xepersian.sty}{computeautoilg}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{%
+ \ifcase\xepersian@tempb\relax
+ \@xepersian@@computeautoilgtrue
+ \or
+ \@xepersian@@computeautoilgfalse
+ \fi}
+
\ExecuteOptionsX{%
documentdirection=righttoleft,
tabledirection=righttoleft,
@@ -876,6 +882,20 @@ number is 999,999,999.}%
\input{extrafootnotefeatures-xepersian.def}
\fi
+\if@xepersian@@computeautoilg
+\bidi@patchcmd{\set@fontsize}{%
+\baselineskip\f@baselineskip\relax
+}{%
+\baselineskip\f@baselineskip\relax
+\xepersian@computeautoilg
+ \ifdim\xepersian@strutilg>\baselineskip
+ \PackageInfo{xepersian}{character with height+depth greater than current baselineskip found in font}
+ \PackageInfo{xepersian}{baselineskip changed to that height+depth!}
+ \baselineskip\xepersian@strutilg
+ \fi
+}{}{}
+\fi
+
\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular},SlantedFont={lmromanslant10-regular},BoldSlantedFont={lmromanslant10-bold}]{lmroman10-regular}%
\PersianAlphs
\endinput