summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx')
-rw-r--r--Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx155
1 files changed, 91 insertions, 64 deletions
diff --git a/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx b/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx
index a20a99cb379..89e3c8ff4b7 100644
--- a/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx
+++ b/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx
@@ -5,7 +5,7 @@
%<*readme>
____________________
The XePersian package
-v22.8
+v22.9
The xepersian package provides a convenient interface for
typesetting Persian and English texts in LaTeX, using XeTeX
@@ -16,18 +16,16 @@ documentation, or ask for any new features, or suggest any
improvements, or ask any questions about the package, then
please use the issue tracker:
- <https://github.com/bidi-tex/xepersian/issues>
+ <https://github.com/persiantex/xepersian/issues>
In doing so, please always explain your issue well enough, and always
include a minimal working example showing the issue.
-Current version release date: 2020-01-31
-______________
-
-Copyright (c) Vafa Khalighi 2007-2019
- bidi-tex GitHub Organisation 2018-2020
-
+Current version release date: 2020/05/14
+___________________________________________
+Copyright (c) Vafa Khalighi 2008--2020
+Copyright (c) bidi-tex GitHub Organization 2018--2020
Distributed under the LaTeX Project Public License
It may be distributed and/or modified under the LaTeX Project Public License,
@@ -35,7 +33,7 @@ version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
This work is “author-maintained” (as per LPPL maintenance status)
-by bidi-tex GitHub Organisation.
+by Vafa Khalighi.
%</readme>
%<*internal>
\fi
@@ -48,18 +46,15 @@ by bidi-tex GitHub Organisation.
\preamble
__________________________________________________
-
- Copyright (c) Vafa Khalighi 2007-2019
- bidi-tex GitHub Organisation 2018-2020
-
-
+ Copyright (c) 2008--2020 Vafa Khalighi
+ Copyright (c) 2018--2020 bidi-tex GitHub Organization
It may be distributed and/or modified under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
This work is “author-maintained” (as per LPPL maintenance status)
- by bidi-tex GitHub Organisation.
+ by Vafa Khalighi.
\endpreamble
@@ -94,7 +89,7 @@ by bidi-tex GitHub Organisation.
\generate{\file{extrafootnotefeatures-xepersian.def}{\from{\jobname.dtx}{table,extrafootnotefeatures-xepersian.def}}}
\generate{\file{extreport-xepersian.def}{\from{\jobname.dtx}{table,extreport-xepersian.def}}}
\generate{\file{fancyref-xepersian.def}{\from{\jobname.dtx}{table,fancyref-xepersian.def}}}
-%\generate{\file{fontspec-xepersian.def}{\from{\jobname.dtx}{table,fontspec-xepersian.def}}}
+\generate{\file{fontspec-xepersian.def}{\from{\jobname.dtx}{table,fontspec-xepersian.def}}}
\generate{\file{footnote-xepersian.def}{\from{\jobname.dtx}{table,footnote-xepersian.def}}}
\generate{\file{framed-xepersian.def}{\from{\jobname.dtx}{table,framed-xepersian.def}}}
\generate{\file{glossaries-xepersian.def}{\from{\jobname.dtx}{table,glossaries-xepersian.def}}}
@@ -149,13 +144,16 @@ by bidi-tex GitHub Organisation.
\generate{\file{test-solution-form.tex}{\from{\jobname.dtx}{test-solution-form.tex}}}
\generate{\file{xepersian-logo.tex}{\from{\jobname.dtx}{xepersian-logo.tex}}}
\endgroup
+\immediate\write18{mv README.txt README}
+\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
+\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
%</internal>
%
%<*driver>
\documentclass{ltxdoc}
\input{xepersian-doc-preamble.ltx}
\hypersetup{%
- pdftitle={Source documentation for version 22.8 of the XePersian
+ pdftitle={Source documentation for version 22.9 of the XePersian
package}%
}
\EnableCrossrefs
@@ -174,8 +172,8 @@ by bidi-tex GitHub Organisation.
% \GetFileInfo{\jobname.dtx}
% \title{\textcolor{blue!65!black}{\Huge The \textsf{\XePersian} \textit{Package}}\\
%\LARGE Persian for \LaTeXe, using {\XeTeX} engine\\[5pt]
-%\large Source documentation for \textcolor{blue!65!black}{version 22.8}}
-% \author{Vafa Khalighi\thanks{Maintained by bidi-tex \url{https://github.com/bidi-tex}}}
+%\large Source documentation for \textcolor{blue!65!black}{version 22.9}}
+% \author{Vafa Khalighi\thanks{Thanks to the bidi-tex GitHub organization consisted of David Carlisle and other members of the {\LaTeX} team to maintain the package in the period 2018--2020.}}
%\setcounter{page}{0}
%\thispagestyle{empty}
%\includegraphics[width=.3\textwidth]{xepersian-logo}\qquad
@@ -184,7 +182,7 @@ by bidi-tex GitHub Organisation.
%\textcolor{blue!65!black}{\Huge The \textsf{\XePersian} \textit{Package}}
%
%\Large
-%Source documentation for \textcolor{blue!65!black}{version 22.8}}
+%Source documentation for \textcolor{blue!65!black}{version 22.9}}
%
%\vskip 0pt plus 3fill
%\textit{\large to my Master, \textbf{Ferdowsi The Great}}
@@ -195,7 +193,7 @@ by bidi-tex GitHub Organisation.
%or ask for any new features, or suggest any improvements, or ask any questions about the package, then please use the issue tracker:
%
%\medskip
-% \centerline{\url{https://github.com/bidi-tex/xepersian/issues}}
+% \centerline{\url{https://github.com/persiantex/xepersian/issues}}
%
%\medskip
%In doing so, please always explain your issue well enough, and always include
@@ -205,8 +203,9 @@ by bidi-tex GitHub Organisation.
%
%\vskip 0pt plus 3fill
%
-%Copyright (c) 2008-2019 Vafa Khalighi
-% 2018-2020 bidi-tex GitHub Organisation
+%Copyright (c) 2008--2020 Vafa Khalighi
+%
+%Copyright (c) 2018--2020 bidi-tex GitHub Organization
%
%\medskip
%Permission is granted to distribute and/or modify \emph{both the documentation and the code} under the conditions of the \LaTeX{} Project Public License, either version 1.3c of this license or (at your option) any later version.
@@ -219,6 +218,23 @@ by bidi-tex GitHub Organisation.
%\iffalse
%<*table>
%\fi
+%% \CheckSum{10968}
+%% \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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%
% \iffalse
%</table>
%<*algorithmic-xepersian.def>
@@ -1888,7 +1904,7 @@ by bidi-tex GitHub Organisation.
%\fi
% \section{File \texttt{fontspec-xepersian.def}}
% \begin{macrocode}
-\ProvidesFile{fontspec-xepersian.def}[2020-01-31 v0.4 fontspec changes]
+\ProvidesFile{fontspec-xepersian.def}[2019/05/01 v0.4 fontspec changes]
\ExplSyntaxOn
\cs_new:Npn \__xepersian_error:nx { \msg_error:nnx {xepersian} }
\char_set_catcode_space:n {32}
@@ -1917,7 +1933,7 @@ by bidi-tex GitHub Organisation.
{
\__fontspec_primitive_font_set:NnnF \l__fontspec_test_font
- { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} }
+ { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } { \l__fontspec_pre_feat_sclist } }
{ \f@size pt - 2sp }
{ \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} }
\__xepersian_font_if_cannot_be_loaded:NnT \l__fontspec_fontname_up_tl { HM }
@@ -1927,8 +1943,8 @@ by bidi-tex GitHub Organisation.
}
\__fontspec_set_font_type:N \l__fontspec_test_font
\__fontspec_primitive_font_gset:Onn \l__fontspec_fontface_cs_tl
- { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} }
- { \f@size pt }
+ { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } { \l__fontspec_pre_feat_sclist } }
+ { \f@size pt + 2sp }
\l__fontspec_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly
@@ -1941,7 +1957,7 @@ by bidi-tex GitHub Organisation.
{ \clist_clear:N \l__fontspec_fontopts_clist }
\keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist
\__fontspec_primitive_font_set:OnnF \l__fontspec_fontface_cs_tl
- { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt }
+ { \__fontspec_construct_font_call:nn {#1} { \l__fontspec_pre_feat_sclist } } { \f@size pt + 2sp }
{ \__fontspec_error:nx {font-not-found} {#2} }
\__xepersian_font_if_cannot_be_loaded:NnT #2 { HM }
{
@@ -2070,7 +2086,24 @@ by bidi-tex GitHub Organisation.
%\fi
% \section{File \texttt{kashida-xepersian.def}}
% \begin{macrocode}
-\ProvidesFile{kashida-xepersian.def}[2018/01/04 v0.6 implementation of Kashida for xepersian package]
+\ProvidesFile{kashida-xepersian.def}[2020/05/14 v0.7 implementation of Kashida for xepersian package]
+%
+% The new changes is minimal and only cosmetic; To resolve the
+% issue properly, I will be studying TeX line breaking algorithms and
+% experiment to see how much of it I can mimic. The idea of using
+% a rule or even a box is awful and it breaks a lot of things. The ideal
+% solution is to insert Kashida without any rules or boxes or if
+% the font offers the alternative forms, it can be used for Kashida.
+% Unfortunately, computing the stretch using the \pdfsavepos and
+% \pdflastxpos primitives from the PDFTeX engine is bad and
+% impractical for several reasons.The process is extremely
+% slow and requires at least two runs of TeX. On a particular line,
+% we need to write to the aux file at least 10 times, on a page we
+% have on average around 10 lines and hence, for a 100 pages
+% document, we have to do this 10,000 times. These statistics are
+% very modest. On the other hand, if we reach max count (which is
+% very likely), then we have to do some devious things.
+%
\chardef\xepersian@zwj="200D % zero-width joiner
\chardef\xepersian@kashidachar="0640 % kashida
@@ -2078,12 +2111,16 @@ by bidi-tex GitHub Organisation.
\chardef\xepersian@L=11 % lam
\chardef\xepersian@R=12 % right-joiner
\chardef\xepersian@A=13 % alef
-\chardef\xepersian@H=14 % heh
\chardef\xepersian@V=4096 % vowel or other combining mark (to be ignored)
\newif\if@Kashida@on
-\newif\if@Kashida@XB@fix
\def\xepersian@kashida{\if@Kashida@on\xepersian@zwj\nobreak%
- \leaders\hrule height \XeTeXglyphbounds\tw@ \the\XeTeXcharglyph\xepersian@kashidachar depth \XeTeXglyphbounds\f@ur \the\XeTeXcharglyph\xepersian@kashidachar \hskip0pt plus 0.5em \xepersian@zwj\fi}
+ \leaders\hrule height \XeTeXglyphbounds\tw@ \the\XeTeXcharglyph\xepersian@kashidachar depth \XeTeXglyphbounds\f@ur \the\XeTeXcharglyph\xepersian@kashidachar \hskip0pt plus
+ \dimexpr \fontcharwd\font\xepersian@kashidachar -
+ \XeTeXglyphbounds\@ne
+ \the\XeTeXcharglyph\xepersian@kashidachar -
+ \XeTeXglyphbounds\thr@@
+ \the\XeTeXcharglyph\xepersian@kashidachar \relax
+\xepersian@zwj\fi}
\def\setclass#1#2{\def\theclass{#1}\def\charlist{#2}%
\expandafter\dosetclass\charlist,\end}
@@ -2099,33 +2136,23 @@ by bidi-tex GitHub Organisation.
\setclass \xepersian@R {0624,0629,062F,0630,0631,0632,0648,0698}
\setclass \xepersian@D {0626,0628,062A,062B,062C,062D,062E}
\setclass \xepersian@D {0633,0634,0635,0636,0637,0638,0639,063A}
-%\setclass \xepersian@D {0640,0641,0642,0643,0645,0646,0647,0649,064A}
-\setclass \xepersian@D {0640,0641,0642,0643,0645,0646,0649,064A}
-\setclass \xepersian@H {0647}
+\setclass \xepersian@D {0640,0641,0642,0643,0645,0646,0647,0649,064A}
\setclass \xepersian@D {067E,0686,06A9,06AF,06CC}
\setclass \xepersian@L {0644}
\setclass \xepersian@V {064B,064C,064D,064E,064F,0650,0651,0652}
\XeTeXinterchartoks \xepersian@D \xepersian@D = {\xepersian@kashida}
-\XeTeXinterchartoks \xepersian@H \xepersian@D = {\if@Kashida@XB@fix\else\xepersian@kashida\fi}
-\XeTeXinterchartoks \xepersian@D \xepersian@H = {\xepersian@kashida}
\XeTeXinterchartoks \xepersian@L \xepersian@D = {\xepersian@kashida}
\XeTeXinterchartoks \xepersian@D \xepersian@L = {\xepersian@kashida}
-\XeTeXinterchartoks \xepersian@L \xepersian@H = {\xepersian@kashida}
-\XeTeXinterchartoks \xepersian@H \xepersian@L = {\if@Kashida@XB@fix\else\xepersian@kashida\fi}
\XeTeXinterchartoks \xepersian@L \xepersian@L = {\xepersian@kashida}
\XeTeXinterchartoks \xepersian@D \xepersian@R = {\xepersian@kashida}
-\XeTeXinterchartoks \xepersian@H \xepersian@R = {\if@Kashida@XB@fix\else\xepersian@kashida\fi}
\XeTeXinterchartoks \xepersian@D \xepersian@A = {\xepersian@kashida}
-\XeTeXinterchartoks \xepersian@H \xepersian@A = {\if@Kashida@XB@fix\else\xepersian@kashida\fi}
\XeTeXinterchartoks \xepersian@L \xepersian@R = {\xepersian@kashida}
\XeTeXinterchartoks \xepersian@L \xepersian@A = {}
\newcommand{\KashidaOn}{\@Kashida@ontrue}
\newcommand{\KashidaOff}{\@Kashida@onfalse}
-\newcommand{\KashidaXBFixOn}{\@Kashida@XB@fixtrue}
-\newcommand{\KashidaXBFixOff}{\@Kashida@XB@fixfalse}
\KashidaOn
% \end{macrocode}
% \iffalse
@@ -3450,8 +3477,8 @@ U+003E U+003E <> U+00BB ; >> -> RIGHT POINTING GUILLEMET
% \section{File \texttt{xepersian.sty}}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\def\xepersian@version{22.8}
-\def\xepersiandate{2020-01-31}
+\def\xepersian@version{22.9}
+\def\xepersiandate{2020/05/14}
\ProvidesPackage{xepersian}[\xepersiandate\space v\xepersian@version\space
Persian typesetting in XeLaTeX]
\RequirePackage{fontspec}
@@ -3466,8 +3493,8 @@ Persian typesetting in XeLaTeX]
* typesetting, using fonts provided in the^^J%
* distribution.^^J%
* ^^J%
-* Copyright (c) 2008-2019 Vafa Khalighi^^J%
-* 2018-2020 bidi-tex GitHub Organisation^^J%
+* Copyright (c) 2008--2020 Vafa Khalighi^^J%
+* Copyright (c) 2018--2020 bidi-tex GitHub Organization^^J%
* ^^J%
* v\xepersian@version, \xepersiandate^^J%
* ^^J%
@@ -3476,7 +3503,7 @@ Persian typesetting in XeLaTeX]
* ^^J%
* Location on CTAN: /macros/xetex/latex/xepersian^^J%
* ^^J%
-* Issue tracker: https://github.com/bidi-tex/xepersian/issues^^J%
+* Issue tracker: https://github.com/persiantex/xepersian/issues^^J%
* ^^J%
****************************************************}
\typeout{\@xepersian@info}
@@ -3536,9 +3563,8 @@ Persian typesetting in XeLaTeX]
\keys_define:nn {fontspec-opentype}
{
Ligatures / PersianTeX .code:n = { \tl_set:Nn \l__fontspec_mapping_tl {persian-tex-text} },
- Ligatures / PersianTeX .groups:n = {opentype},
+ Ligatures / PersianTeXOff .code:n = { \tl_clear:N \l__fontspec_mapping_tl },
Ligatures / PersianTeXReset .code:n = { \tl_clear:N \l__fontspec_mapping_tl },
- Ligatures / PersianTeXReset .groups:n = {opentype},
}
\keys_define:nn {fontspec-aat}
@@ -3606,8 +3632,6 @@ Persian typesetting in XeLaTeX]
\XeTeXinterchartoks \bidi@digits@charclass \xepersian@A = {\xepersian@@stop@switch@textdigitfont}
\XeTeXinterchartoks \xepersian@R \bidi@digits@charclass = {\xepersian@@start@switch@textdigitfont}
\XeTeXinterchartoks \bidi@digits@charclass \xepersian@R = {\xepersian@@stop@switch@textdigitfont}
- \XeTeXinterchartoks \xepersian@H \bidi@digits@charclass = {\xepersian@@start@switch@textdigitfont}
- \XeTeXinterchartoks \bidi@digits@charclass \xepersian@H = {\xepersian@@stop@switch@textdigitfont}
}
}
@@ -4284,7 +4308,7 @@ Persian typesetting in XeLaTeX]
\newcommand*{\@xepersian@pdfcustomproperties}{%
This is the xepersian package, Version \xepersian@version,
- Released May 1, 2019.
+ Released May 14, 2020.
}
\newcommand\twocolumnstableofcontents{%
@@ -4743,12 +4767,6 @@ number is 999,999,999.}%
\ifcase\xepersian@tempb\relax
\input{kashida-xepersian.def}
\fi}
-\define@choicekey{xepersian.sty}{KashidaXBFix}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{%
- \ifcase\xepersian@tempb\relax
- \@Kashida@XB@fixtrue
- \or
- \@Kashida@XB@fixfalse
- \fi}
\define@choicekey{xepersian.sty}{localise}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{%
\ifcase\xepersian@tempb\relax
\input{localise-xepersian.def}
@@ -4891,15 +4909,13 @@ number is 999,999,999.}%
\@bidi@perpage@footnotefalse
\fi}
-\ExplSyntaxOn
-\bool_new:N \l__xepersian_fontsloadable_bool
+\newif\if@xepersian@fontsloadable@bool
\define@choicekey{xepersian.sty}{fontsloadable}[\xepersian@tempa\xepersian@tempb]{true,false}[true]{%
\ifcase\xepersian@tempb\relax
- \bool_set_true:N \l__xepersian_fontsloadable_bool
+ \@xepersian@fontsloadable@booltrue
\or
- \bool_set_false:N \l__xepersian_fontsloadable_bool
+ \@xepersian@fontsloadable@boolfalse
\fi}
-\ExplSyntaxOff
\ExecuteOptionsX{%
fontsloadable=false,
@@ -4924,6 +4940,17 @@ number is 999,999,999.}%
\input{extrafootnotefeatures-xepersian.def}%
\fi
+\if@xepersian@fontsloadable@bool
+ \PackageWarningNoLine{xepersian}{%
+ The option `fontsloadable' should only be used in exceptional
+ cases.
+ You are not allowed to use the option `fontsloadable' unless
+ you have a written permission from the primary author of the
+ xepersian package}%
+\else
+ \input{fontspec-xepersian.def}%
+\fi
+
\bidi@patchcmd{\set@fontsize}{\@tempdimb#2pt}{%
\@tempdimb\xepersian@@fontsize@scale\dimexpr#2pt\relax
}{}{}