diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-04 21:02:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-04 21:02:55 +0000 |
commit | 486ab78fef46708a628b3ac2495e8ca3097a1644 (patch) | |
tree | 0126dcd086935b6d0b2729968e479bbe62e67455 | |
parent | e051965438c691eccc079f700016b2ea475e2fa5 (diff) |
xepersian-hm (4sep20)
git-svn-id: svn://tug.org/texlive/trunk@56264 c570f23f-e606-0410-a88d-b1316a301751
31 files changed, 1284 insertions, 860 deletions
diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt b/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt index 0487956ac2d..5b8ffa45844 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt @@ -1,7 +1,7 @@ xepersian-hm -- INSTALL ====================== - Source: xepersian-hm.dtx (2020-08-05 v1.0d) + Source: xepersian-hm.dtx (2020-09-04 v1.1a) Author: Hossein Movahhedian Info: filecontents + macro + verbatim License: LPPL 1.3c @@ -17,7 +17,8 @@ Files should then be moved to appropriate locations. -- *.ins -> TEXMF/source/xelatex/xepersian-hm/ -- *.sty -> TEXMF/tex/xelatex/xepersian-hm/ --- *.def -> TEXMF/tex/xelatex/xepersian-hm/ +-- xepersian-hm-kashida.tex -> TEXMF/tex/xelatex/xepersian-hm/ +-- xepersian-hm-common-kashida.tex -> TEXMF/tex/xelatex/xepersian-hm/ -- *.pdf -> TEXMF/doc/xelatex/xepersian-hm/ -- *.tex -> TEXMF/doc/xelatex/xepersian-hm/ @@ -28,10 +29,10 @@ Don't forget to run 'texconfig rehash' afterwards. The example files - kashida-glyph-example.tex - kashida-leaders-glyph-example.tex - kashida-leaders-hrule-example.tex - kashida-xep-XB-example.tex + xepersian-hm-glyph.tex + xepersian-hm-leaders-glyph.tex + xepersian-hm-leaders-hrule.tex + xepersian-XB.tex illustrate some features of the package and are an addendum to the user documentation xepersian-hm-doc.pdf and the source documentation diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt b/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt index 30f6d3240c7..6e5a3b75fe6 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt @@ -1,14 +1,20 @@ The XEPERSIAN-HM package ------------------------ -Kashida feature in 'xepersian' has problems with some fonts such as 'HM Series' -available at 'https://dma8hm1334.bitbucket.io' and 'X Series 2' available at -'http://wiki.irmug.com/index.php/X_Series_2'. The 'xepersian-hm' package fixes -these problems. +In some cursive scripts such as Persian or Arabic, kashida is used to create +justification. In this type of justification characters are elongated rather +than expanding spaces between words. -The files 'kashida-glyph-example.tex' and 'kashida-hrule-example.tex' in -the directory 'texmf-dist/doc/xelatex/xepersian-hm/' can be used as simple -examples of the usage of the package. +The kashida justification in 'xepersian' has many bugs. Also it has problems +with some fonts such as 'HM Series' available at +'https://dma8hm1334.bitbucket.io' and 'X Series 2' available at +'http://wiki.irmug.com/index.php/X_Series_2'. + +This package fixes the known bugs in 'xepersian' which uses the xetex engine. + +The files 'xepersian-hm-*.tex' in the directory +'texmf-dist/doc/xelatex/xepersian-hm/' can be used as simple examples of +the usage of the package. Please use the Bitbucket issue tracker: 'https://bitbucket.org/dma8hm1334/xepersian-hm/issues' to report a bug, request @@ -17,6 +23,3 @@ a feature or if you have a comment. I will do my best to fix all the bugs you report, but, unfortunately, time is a big hurdle to overcome; so, my apologies in advance for those which I cannot make time to fix. -%% -%% -%% End of file `README.txt'. diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf Binary files differindex c02b5b5a5c0..492174f0efb 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xepersian-hm.pdf Binary files differindex ea5822c8d92..6f0d6b76736 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xepersian-hm.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-glyph.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-glyph.pdf Binary files differindex 35eb72dd7ae..a1f815f380e 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-glyph.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-glyph.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-hrule.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-hrule.pdf Binary files differindex 783decc2cd1..cc48f5bd55b 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-hrule.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-hrule.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-xep.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-xep.pdf Binary files differindex 37ae4f5e1c3..2b09ad655c6 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-xep.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-samples-xep.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.pdf Binary files differdeleted file mode 100644 index 144600ad08b..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.tex deleted file mode 100644 index 1cf5a029c52..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.tex +++ /dev/null @@ -1,131 +0,0 @@ -% \PassOptionsToPackage{debugfootnotedirection=off,localise=off}{xepersian} % Load xepersian with a few options -\documentclass{report} -% \textwidth=345.0pt -% \textheight=550.0pt -% \textheight=620pt -% \usepackage[Kashida]{xepersian} % Fails -% \usepackage{xepersian-hm} % Succeeds -% \usepackage[Kashida=hrule,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=hrule,kashidastretch=0.14 em plus 5.5 em]{xepersian-hm} % Succeeds -\usepackage[Kashida=glyph,linebreakpenalty=8,kashidastretch=0.14 em plus 5.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=glyph,kashidastretch=kayhan]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=noskip]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=default]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=kayhan]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=khorramshahr]{xepersian-hm} % Succeeds - -% \settextfont[Scale=4.5,Colour=darkgray]{XB Kayhan} -\settextfont[Scale=4.5]{HM XKayhan} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XNiloofar} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XYas} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XZar} -% \settextfont[Scale=1,Colour=darkgray]{HM XKayhan} - -% \setlatintextfont[Scale=2.5,Colour=0000FF]{XB Kayhan} -\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan} - -\defpersianfont\HMXKayhanIt[Scale=4.5]{HM XKayhan Italic} -\defpersianfont\HMXKayhanOb[Scale=4.5]{HM XKayhanOb Oblique} -\defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline} -\defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow} -\defpersianfont\HMXKayhanPo[Scale=4.5]{HM XKayhan Pook} -\defpersianfont\HMXKayhanSa[Scale=4.5]{HM XKayhan Sayeh} -\defpersianfont\HMXKayhanNa[Scale=4.5]{HM XKayhan Navaar} - -% \def\SampleText{\discouragebadlinebreaks[8][0.14 em plus 5.5 em]{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -% \def\SampleText{\discouragebadlinebreaks[10][0.12 em plus 5.5 em]{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -\def\SampleText{\discouragebadlinebreaks{ - راهی جایی تابی چاپی چاههی تلاشهایی - شتابهایی تابی چاپی راهی تلاشهــایی - که کتابهایی که کلاههایی که کتابهایی }} - -% \def\SampleText{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی } - -\setlength\parindent{0pt} -\pagestyle{empty} - -\begin{document} - -\begin{latin} -\begin{center} -\Huge\textsf{xepersian-hm}\\ \vspace{20pt} Example of Use\vspace{20pt}\\ \texttt{Kashida=glyph} \vspace{40pt} - -{\Large -\begin{tabular}{ll} - \textsf{Font:} & \textsf{HM XKayhan} \\ - \textsf{Font Scale:} & \texttt{4.5} \\ - \textsf{linebreakpenalty:} & \texttt8 \\ - \textsf{kashidastretch:} & \texttt{0.14em plus 5.5em} -\end{tabular} -} -\end{center} - -\end{latin} - -\newpage - -\KashidaOff{\hfill\lr{(Kashida Off, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Italic)}\hfill} - -{\HMXKayhanIt \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Oblique)}\hfill} - -{\HMXKayhanOb \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Outline)}\hfill} - -{\HMXKayhanOl \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Shadow)}\hfill} - -{\HMXKayhanSd \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Pook)}\hfill} - -{\HMXKayhanPo \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Sayeh)}\hfill} - -{\HMXKayhanSa \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Navaar)}\hfill} - -{\HMXKayhanNa \SampleText} - -\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-glyph-example.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-glyph-example.pdf Binary files differdeleted file mode 100644 index 49280769e07..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-glyph-example.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-glyph-example.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-glyph-example.tex deleted file mode 100644 index 41ecd9f013d..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-glyph-example.tex +++ /dev/null @@ -1,131 +0,0 @@ -% \PassOptionsToPackage{debugfootnotedirection=off,localise=off}{xepersian} % Load xepersian with a few options -\documentclass{report} -% \textwidth=345.0pt -% \textheight=550.0pt -% \textheight=620pt -% \usepackage[Kashida]{xepersian} % Fails -% \usepackage{xepersian-hm} % Succeeds -% \usepackage[Kashida=On,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -\usepackage[Kashida=leaders+glyph,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=hrule,kashidastretch=0.14 em plus 5.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=glyph,linebreakpenalty=8,kashidastretch=0.14 em plus 5.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=glyph,kashidastretch=kayhan]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=noskip]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=default]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=kayhan]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=khorramshahr]{xepersian-hm} % Succeeds - -% \settextfont[Scale=4.5,Colour=darkgray]{XB Kayhan} -\settextfont[Scale=4.5]{HM XKayhan} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XNiloofar} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XYas} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XZar} -% \settextfont[Scale=1,Colour=darkgray]{HM XKayhan} - -% \setlatintextfont[Scale=2.5,Colour=0000FF]{XB Kayhan} -\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan} - -\defpersianfont\HMXKayhanIt[Scale=4.5]{HM XKayhan Italic} -\defpersianfont\HMXKayhanOb[Scale=4.5]{HM XKayhanOb Oblique} -\defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline} -\defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow} -\defpersianfont\HMXKayhanPo[Scale=4.5]{HM XKayhan Pook} -\defpersianfont\HMXKayhanSa[Scale=4.5]{HM XKayhan Sayeh} -\defpersianfont\HMXKayhanNa[Scale=4.5]{HM XKayhan Navaar} - -% \def\SampleText{\discouragebadlinebreaks[8][0.14 em plus 5.5 em]{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -% \def\SampleText{\discouragebadlinebreaks[10][0.12 em plus 5.5 em]{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -% \def\SampleText{\discouragebadlinebreaks{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -\def\SampleText{ - راهی جایی تابی چاپی چاههی تلاشهایی - شتابهایی تابی چاپی راهی تلاشهــایی - که کتابهایی که کلاههایی که کتابهایی } - -\setlength\parindent{0pt} -\pagestyle{empty} - -\begin{document} - -\begin{latin} -\begin{center} -\Huge\textsf{xepersian-hm}\vspace{20pt}\\ Example of Use\vspace{20pt}\\ \texttt{Kashida=leaders+glyph} \vspace{40pt} - -{\Large -\begin{tabular}{ll} - \textsf{Font:} & \textsf{HM XKayhan} \\ - \textsf{Font Scale:} & \texttt{4.5} \\ - \textsf{kashidastretch:} & \texttt{0.14em plus 0.5em} -\end{tabular} -} -\end{center} - -\end{latin} - -\newpage - -\KashidaOff{\hfill\lr{(Kashida Off, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Italic)}\hfill} - -{\HMXKayhanIt \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Oblique)}\hfill} - -{\HMXKayhanOb \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Outline)}\hfill} - -{\HMXKayhanOl \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Shadow)}\hfill} - -{\HMXKayhanSd \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Pook)}\hfill} - -{\HMXKayhanPo \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Sayeh)}\hfill} - -{\HMXKayhanSa \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Navaar)}\hfill} - -{\HMXKayhanNa \SampleText} - -\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-hrule-example.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-hrule-example.pdf Binary files differdeleted file mode 100644 index e7a50aa8971..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-hrule-example.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-hrule-example.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-hrule-example.tex deleted file mode 100644 index ea0f19e1e4a..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-leaders-hrule-example.tex +++ /dev/null @@ -1,130 +0,0 @@ -% \PassOptionsToPackage{debugfootnotedirection=off,localise=off}{xepersian} % Load xepersian with a few options -\documentclass{report} -% \textwidth=345.0pt -% \textheight=550.0pt -% \textheight=620pt -% \usepackage[Kashida]{xepersian} % Fails -% \usepackage{xepersian-hm} % Succeeds -\usepackage[Kashida=leaders+hrule,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=hrule,kashidastretch=0.14 em plus 5.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=glyph,linebreakpenalty=8,kashidastretch=0.14 em plus 5.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida=glyph,kashidastretch=kayhan]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=0.14 em plus 0.5 em]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=noskip]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=default]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=kayhan]{xepersian-hm} % Succeeds -% \usepackage[Kashida,kashidastretch=khorramshahr]{xepersian-hm} % Succeeds - -% \settextfont[Scale=4.5,Colour=darkgray]{XB Kayhan} -\settextfont[Scale=4.5]{HM XKayhan} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XNiloofar} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XYas} -% \settextfont[Scale=4.5,Colour=darkgray]{HM XZar} -% \settextfont[Scale=1,Colour=darkgray]{HM XKayhan} - -% \setlatintextfont[Scale=2.5,Colour=0000FF]{XB Kayhan} -\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan} - -\defpersianfont\HMXKayhanIt[Scale=4.5]{HM XKayhan Italic} -\defpersianfont\HMXKayhanOb[Scale=4.5]{HM XKayhanOb Oblique} -\defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline} -\defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow} -\defpersianfont\HMXKayhanPo[Scale=4.5]{HM XKayhan Pook} -\defpersianfont\HMXKayhanSa[Scale=4.5]{HM XKayhan Sayeh} -\defpersianfont\HMXKayhanNa[Scale=4.5]{HM XKayhan Navaar} - -% \def\SampleText{\discouragebadlinebreaks[8][0.14 em plus 5.5 em]{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -% \def\SampleText{\discouragebadlinebreaks[10][0.12 em plus 5.5 em]{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -% \def\SampleText{\discouragebadlinebreaks{ -% راهی جایی تابی چاپی چاههی تلاشهایی -% شتابهایی تابی چاپی راهی تلاشهــایی -% که کتابهایی که کلاههایی که کتابهایی }} - -\def\SampleText{ - راهی جایی تابی چاپی چاههی تلاشهایی - شتابهایی تابی چاپی راهی تلاشهــایی - که کتابهایی که کلاههایی که کتابهایی } - -\setlength\parindent{0pt} -\pagestyle{empty} - -\begin{document} - -\begin{latin} -\begin{center} -\Huge\textsf{xepersian-hm}\vspace{20pt}\\ Example of Use\vspace{20pt}\\ \texttt{Kashida=leaders+hrule} \vspace{40pt} - -{\Large -\begin{tabular}{ll} - \textsf{Font:} & \textsf{HM XKayhan} \\ - \textsf{Font Scale:} & \texttt{4.5} \\ - \textsf{kashidastretch:} & \texttt{0.14em plus 0.5em} -\end{tabular} -} -\end{center} - -\end{latin} - -\newpage - -\KashidaOff{\hfill\lr{(Kashida Off, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Italic)}\hfill} - -{\HMXKayhanIt \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Oblique)}\hfill} - -{\HMXKayhanOb \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Outline)}\hfill} - -{\HMXKayhanOl \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Shadow)}\hfill} - -{\HMXKayhanSd \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Pook)}\hfill} - -{\HMXKayhanPo \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Sayeh)}\hfill} - -{\HMXKayhanSa \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Navaar)}\hfill} - -{\HMXKayhanNa \SampleText} - -\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.pdf Binary files differdeleted file mode 100644 index 9e233e6ab7f..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.tex deleted file mode 100644 index ad9f1932391..00000000000 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.tex +++ /dev/null @@ -1,92 +0,0 @@ -\documentclass{report} -\usepackage[Kashida=on]{xepersian} -\settextfont[Scale=4.5]{XB Kayhan} -\setlatintextfont[Scale=1.5,Colour=0000FF]{XB Kayhan} - -\defpersianfont\XBKayhanIt[Scale=4.5]{XB Kayhan Italic} -\defpersianfont\XBKayhanOb[Scale=4.5]{XB Zar Oblique} -\defpersianfont\XBKayhanOl[Scale=4.5]{XB Kayhan Pook} -\defpersianfont\XBKayhanSd[Scale=4.5]{XB Kayhan Sayeh} -\defpersianfont\XBKayhanPo[Scale=4.5]{XB Kayhan Pook} -\defpersianfont\XBKayhanSa[Scale=4.5]{XB Kayhan Sayeh} -\defpersianfont\XBKayhanNa[Scale=4.5]{XB Kayhan Navaar} - -\def\SampleText{ - راهی جایی تابی چاپی چاههی تلاشهایی - شتابهایی تابی چاپی راهی تلاشهــایی - که کتابهایی که کلاههایی که کتابهایی } - -\setlength\parindent{0pt} -\pagestyle{empty} - -\begin{document} - -\begin{latin} -\begin{center} -\Huge\textsf{xepersian}\vspace{20pt}\\ Example of Use\vspace{20pt}\\ \texttt{Kashida=On} \vspace{40pt} - -{\Large -\begin{tabular}{ll} - \textsf{Font:} & \textsf{XB Kayhan} \\ - \textsf{Font Scale:} & \texttt{4.5} \\ -\end{tabular} -} -\end{center} - -\end{latin} - -\newpage - -\KashidaOff{\hfill\lr{(Kashida Off, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Regular)}\hfill} - -\SampleText - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Italic)}\hfill} - -{\XBKayhanIt \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Oblique)}\hfill} - -{\XBKayhanOb \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Pook)}\hfill} - -{\XBKayhanOl \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Sayeh)}\hfill} - -{\XBKayhanSd \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Pook)}\hfill} - -{\XBKayhanPo \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Sayeh)}\hfill} - -{\XBKayhanSa \SampleText} - -\newpage - -\KashidaOn{\hfill\lr{(Kashida On, Navaar)}\hfill} - -{\XBKayhanNa \SampleText} - -\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-XB.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-XB.pdf Binary files differnew file mode 100644 index 00000000000..c99730530bf --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-XB.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-XB.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-XB.tex new file mode 100644 index 00000000000..76afdcf3546 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-XB.tex @@ -0,0 +1,72 @@ +\PassOptionsToPackage{fontsloadable=true}{xepersian} % Load xepersian with a few options +\documentclass{report} +\usepackage{xcolor} +\usepackage[Kashida=on]{xepersian} +\settextfont[Scale=4.5,Colour=000001]{XB Kayhan} +\setlatintextfont[Scale=1.5,Colour=0000FF]{XB Kayhan} + +\defpersianfont\XBKayhanEn[Scale=1.2,Colour=000001]{XB Kayhan} +\defpersianfont\XBKayhanIt[Scale=4.5,Colour=000001]{XB Kayhan Italic} +\defpersianfont\XBKayhanOb[Scale=4.5,Colour=000001]{XB Zar Oblique} +\defpersianfont\XBKayhanOl[Scale=4.5,Colour=000001]{XB Kayhan Pook} +\defpersianfont\XBKayhanSd[Scale=4.5,Colour=000001]{XB Kayhan Sayeh} +\defpersianfont\XBKayhanPo[Scale=4.5,Colour=000001]{XB Kayhan Pook} +\defpersianfont\XBKayhanSa[Scale=4.5,Colour=000001]{XB Kayhan Sayeh} +\defpersianfont\XBKayhanNa[Scale=4.5,Colour=000001]{XB Kayhan Navaar} + +\def\SampleText{ + راهی جایی تابی چاپی چاههی تلاشهایی + شتابهایی تابی چاپی راهی تلاشهــایی + که کتابهایی که کلاههایی که کتابهایی } + +\def\SampleTitle#1#2#3{{{\begin{latin}\XBKayhanEn Engine: {\color{blue}\texttt{#1,}} \\ + Style: {\color{blue}\texttt{#2,}} \\ Kashida: {\color{blue}\texttt{#3}}\end{latin}}}\hbox{}\vskip 5mm} + +\setlength\parindent{0pt} +% \pagestyle{empty} +\setcounter{page}{16} +\let\tmppage=\thepage +\gdef\thepage{\scriptsize\lr\tmppage} + +\begin{document} + +\begin{latin} +\begin{center} +{\Huge\textsf{\XePersian} \\ + \vspace{20pt} Example of Use \\ + \vspace{20pt}\texttt{Engine: XeTeX {\normalsize using xepersian}} \\ + \vspace{20pt}\texttt{Kashida=leaders+hrule}} \\ + \vspace{20pt}\makebox{\textsf{File:} \texttt{TEXMFDIST/doc/latex/texnegar/xepersian-XB.tex}} \\ + \vspace{20pt} + +{\Large +\begin{tabular}{ll} + \textsf{Font:} & \textsf{XB Kayhan} \\ + \textsf{Font Scale:} & \texttt{4.5} \\ + \textsf{color:} & \texttt{red} +\end{tabular} +} +\end{center} + +\end{latin} + +\color{red} +\newpage \KashidaOff \SampleTitle{XeTeX using xepersian}{Regular}{Off} \par \SampleText + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Regular}{leaders+hrule On} \par \SampleText + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Italic}{leaders+hrule On} \par {\XBKayhanIt \SampleText} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Oblique}{leaders+hrule On} \par {\XBKayhanOb \SampleText} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Outline}{leaders+hrule On} \par {\XBKayhanOl \SampleText} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Sayeh}{leaders+hrule On} \par {\XBKayhanSd \SampleText} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Pook}{leaders+hrule On} \par {\XBKayhanPo \SampleText} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Sayeh}{leaders+hrule On} \par {\XBKayhanSa \SampleText} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian}{Navaar}{leaders+hrule On} \par {\XBKayhanNa \SampleText} + +\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex new file mode 100644 index 00000000000..e8f18375b6e --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex @@ -0,0 +1,87 @@ +%% +%% This is file `xepersian-hm-common-kashida.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xepersian-hm.dtx (with options: `xepersian-hm-common-kashida-tex') +%% +%% Copyright (C) 2020 Hossein Movahhedian +%% +%% 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 +%% +\ProvidesExplFile {xepersian-hm-common-kashida.tex} {2020-09-04} {1.1a} { Fixes~implementation~of~Kashida~in~xepersian~package } + +\bool_if:NT \l_xephm_ligature_bool +{ + \clist_new:N \l_xephm_ligatures_clist + \int_new:N \l_xephm_lig_names_len_int + \int_set:Nn \l_xephm_lig_names_len_int { \clist_count:N \l_xephm_lig_names_clist } + \int_step_inline:nnnn { 1 } { 2 } { \l_xephm_lig_names_len_int } + { + \int_set:Nn \l_tmpa_int { #1 } + \int_set:Nn \l_tmpb_int { \int_eval:n { \l_tmpa_int + 1 } } + \tl_set:Nf \l_tmpa_tl { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpa_int } } + \clist_set:Nx \l_tmpa_clist { { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpb_int } } } + \bool_if:nT { \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_tmpa_tl || \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_xephm_lig_default_tl } + { + \clist_put_left:Nx \l_xephm_ligatures_clist { \l_tmpa_clist } + } + } + \clist_map_inline:Nn \l_xephm_ligatures_clist + { + \seq_set_split:Nnn \l_tmpa_seq { = } { #1 } + \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl { } { } + \seq_pop_left:NN \l_tmpa_seq \l_tmpb_tl { } { } + \tl_const:cx { \tl_use:N \l_tmpb_tl } { \char"\l_tmpa_tl \ } + } +} + +\bool_if:NT \l_xephm_linebreakpenalty_bool +{ + %% Partly adapted from LaTeX2e source + \cs_new:Nn \xephm_line_break: { + \if_mode_vertical: + \GenericError{ + \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space + }{ + LaTeX Error: There’s no line here to end + }{ + See the LaTeX manual or LaTeX Companion for explanation. + }{ + Your command was ignored.\MessageBreak + Type \space I <command> <return> \space to replace it~ + with another command,\MessageBreak + or \space <return> \space to continue without it.} + \else: + \l_tmpa_skip \tex_lastskip:D + \tex_unskip:D + \tex_penalty:D -\l_xephm_line_break_penalty_int + \dim_compare:nT { \l_tmpa_skip > \c_zero_skip } + { \skip_horizontal:N \l_tmpa_skip \tex_ignorespaces:D } + \fi: + } + + \NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m } + { + \IfNoValueF {#1} + { \int_set:Nn \l_xephm_line_break_penalty_int {#1} } + \IfNoValueF {#2} + { \tl_set:Nn \l_xephm_skip_default_tl {#2} } + \xephm_put_line_breaks:n { #3 } + } + + \cs_new_protected:Nn \xephm_put_line_breaks:n + { + \tl_set:Nn \l_xephm_line_break_tl { #1 } + \regex_replace_all:nnN { ([ابپتثجحخچدذرزژسشعغصضفقطظکگلمنوهیـ])+ } { \ \0 \ \c{xephm_line_break:}\ } \l_xephm_line_break_tl + \tl_use:N \l_xephm_line_break_tl + } +} + + \endinput +%% +%% +%% End of file `xepersian-hm-common-kashida.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx index 9eaae03396a..ca8050dcc36 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx @@ -7,12 +7,48 @@ %% version 1.3c or higher (your choice). The latest version of %% this license is at: http://www.latex-project.org/lppl.txt %% + \documentclass{ltxdoc} +\usepackage{fontspec} \usepackage{graphicx} +\usepackage{pdfpages} \usepackage{longtable} -\usepackage{hypdoc} -\usepackage{xepersian-hm} -\settextfont[Scale=1]{HM XKayhan} +\usepackage[colorlinks]{hyperref} +\usepackage{hologo} +\usepackage{xcolor} +\usepackage{iftex} +\usepackage{enumitem} + +\setfontfamily\PeFont[Script=Arabic,Language=Persian]{HM XKayhan} + +\def\XePersianHM{XePersianHM} + +\usepackage{multicol,makeidx} +\makeindex %%% + +% Partly adapted from the code provided by Maroš Beťko in: +% https://tex.stackexchange.com/questions/404820/create-2-column-index-in-1-column-document-on-the-same-page +% Redefine theindex enviroment so it won't place index on new page +% This also makes the index 1 columns, which I don't want +\makeatletter +\renewenvironment{theindex} + {\section*{\indexname}\begin{multicols}{2}% + \@mkboth{\MakeUppercase\indexname}% + {\MakeUppercase\indexname}% + \thispagestyle{plain}\parindent\z@ + \parskip\z@ \@plus .3\p@\relax + \columnseprule \z@ + \columnsep 35\p@ + \let\item\@idxitem} + {\end{multicols}} +\makeatother + +\ifluatex + \def\RtoL#1{\PeFont\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT #1} +\fi +\ifxetex + \def\RtoL#1{\PeFont\TeXXeTstate=1 \beginR #1 \endR} +\fi \title{ The \textsf{xepersian-hm} package\\Fixing kashida in xepersian\\User Documentation @@ -27,29 +63,74 @@ } } -\date{Released \quad 2020-08-05 \quad v1.0d} +\date{Released \quad 2020-09-04 \quad v1.1a} + +\definecolor{HMhighlightBlueI}{rgb}{0,0,1} +\definecolor{HMhighlightbgYellowII}{rgb}{1,1,1} +\definecolor{HMhighlightbgPinkI}{rgb}{1,1,1} +\definecolor{HMhighlightbgPinkII}{rgb}{1,1,1} +\definecolor{HMhighlightbgPinkIII}{rgb}{1,1,1} + +\definecolor{HMcitecolor}{rgb}{1,0,1} + +\definecolor{HMnotecolor}{rgb}{0.6,0,0} + +\def\indexterm#1#2{{\color{HMhighlightBlueI} #2}\index{#1@#2}} +\def\indextermsub#1#2#3{{\color{HMhighlightBlueI} #3}\index{#1@#2!#3}} +\def\indextermsubsub#1#2#3#4{{\color{HMhighlightBlueI} #4}\index{#1@#2!#3!#4}} +\def\ccsterm#1{{\color{HMhighlightBlueI}\tt \textbackslash #1}\index{#1@\tt \textbackslash #1}} +\def\ccstermsub#1#2#3{{\color{HMhighlightBlueI}\tt \textbackslash #3}\index{#1@#2!\tt \textbackslash #3}} -\let\tmpthepage\thepage -\renewcommand{\thepage}{\lr{\Large\textbf\tmpthepage}} \begin{document} -\begin{latin} \maketitle -Kashida feature in \textsf{xepersian} has problems with some fonts such as \mbox{\textsf{HM Series}} -available at -\href{https://dma8hm1334.bitbucket.io}{\texttt{https://dma8hm1334.bitbucket.io}} -and \mbox{\textsf{X Series 2}} available at -\href{http://wiki.irmug.com/index.php/X_Series_2}{\texttt{http://wiki.irmug.com/index.php/X\_Series\_2}}. -The \textsf{xepersian-hm} package fixes these problems. +\vskip 50mm +\newbox\hnegar +\setbox\hnegar\hbox{\texttt{HM:}} +\newbox\vnegar +\setbox\vnegar\vbox{ +\hbox{\leaders\hrule\hskip \the\wd\hnegar} +\hbox to -\the\wd\hnegar{\texttt{HM:}}\vskip-0.6em +\hbox{\leaders\hrule\hskip \the\wd\hnegar}} +\unvbox\vnegar +\vskip -\the\baselineskip +\hskip 3em +\begin{minipage}{0.65\linewidth} + \textit{\noindent + HM is an initialism for ``Hossein Movahhedian'' -- the author's name and family. + } +\end{minipage} + +\newpage + +\tableofcontents + +\newpage + +\section{Introduction} + +\indexterm{Kashida}{Kashida} is used in Persian and Arabic typography to justify the text regardless +of the number of the words on the line by elongating characters at certain +points instead of expanding spaces between words or individual letters. + +Kashida feature in \hyperref[HM:Brief-outline-of-the-issues]{\indexterm{xepersian}{\textsf{xepersian}} has problems with some fonts such as \mbox{\textsf{HM Series}}} +% available at +% \href{https://dma8hm1334.bitbucket.io}{\texttt{https://dma8hm1334.bitbucket.io}} +% and \mbox{\textsf{X Series 2}} available at +% \href{http://wiki.irmug.com/index.php/X_Series_2}{\texttt{http://wiki.irmug.com/index.php/X\_Series\_2}}. +% The \hyperref[HM:Brief-outline-of-the-issues-2]{\indexterm{xepersian-hm}{\textsf{xepersian-hm}}} package fixes these problems. The following files in the directory \texttt{texmf-dist/doc/xelatex/xepersian-hm/} can be used as simple examples of the usage of the package: \newcounter{beanx} \begin{list}{\arabic{beanx}.}{\usecounter{beanx}\setlength{\rightmargin}{\leftmargin}} - \item \texttt{kashida-glyph-example.tex} - \item \texttt{kashida-leaders-glyph-example.tex} - \item \texttt{kashida-leaders-hrule-example.tex} + \item \texttt{xepersian-hm-glyph.tex} \\ + See pages 26 -- 35 for PDF output. + \item \texttt{xepersian-hm-leaders-glyph.tex} \\ + See pages 36 -- 45 for PDF output. + \item \texttt{xepersian-hm-leaders-hrule.tex} \\ + See pages 46 -- 55 for PDF output. \end{list} Please use the Bitbucket issue tracker: @@ -60,48 +141,63 @@ I will do my best to fix all the bugs you report, but, unfortunately, time is a big hurdle to overcome; so, my apologies in advance for those which I cannot make time to fix. -\section{Brief outline of the issues} +\section{Brief outline of the issues}\label{HM:Brief-outline-of-the-issues} Kashida is one of the most important features that must be included in any -Persian typesetter. In xepersian this feature is implemented but with some -problems. These problems along with the fixes in \textsf{xepersian-hm} are briefly: +Persian typesetter. In \textsf{xepersian} this feature is implemented but with some +problems. See pages 16 -- 25 for pictorial illustrations for various font styles. +These problems along with the fixes in \textsf{xepersian-hm} are briefly: \newcounter{bean} \begin{list}{P-\Roman{bean}}{\usecounter{bean}\setlength{\rightmargin}{\leftmargin}} - \item In \textsf{xepersian} overlapping of glyphs occurs in letter - combinations such as "\rl{ب + ی}", "\rl{ت + ی}", and - "\rl{پ + ی}" because the character - \textsf{U+FEF0 (ARABIC LETTER FARSI YEH FINAL FORM)} is replaced with - another character. This is fixed by modifying the fixed part of the - glue inserted between the consecutive characters. Furthermore, both, - the fixed and the stretchable parts of the glue can be changed by the - user. - \item In letter combinations such as "\rl{ه + ی}", in \textsf{xepersian}, - the character \textsf{U+FEEB (ARABIC LETTER HEH INITIAL FORM)} is - replaced with \textsf{U+06BE (ARABIC LETTER HEH DOACHASHEMEE)}. This - is fixed by inserting the character \textsf{U+200E} before the - combination "\textsf{U+200D + hrule + U+200D}" which is used as - stretching item. + \item In \textsf{xepersian} \indexterm{overlapping of glyphs}{overlapping of glyphs} occurs in letter + combinations such as "{\RtoL{ﺑ + ﻰ}}", "{\RtoL{ﺗ + ﻰ}}", and + "{\RtoL{ﭘ + ﻰ}}" because the character + \textsf{U+FEF0 (ARABIC LETTER FARSI YEH FINAL FORM)} is replaced with + another character. This is fixed by modifying the fixed part of the + glue inserted between the consecutive characters. Furthermore, both, + the fixed and the stretchable parts of the glue can be changed by the + user. + \item In \indexterm{letter combinations}{letter combinations} such as "{\RtoL{ﻫ + ﻰ}}", in \textsf{xepersian}, + the character \textsf{U+FEEB (ARABIC LETTER HEH INITIAL FORM)} is + replaced with \textsf{U+06BE (ARABIC LETTER HEH DOACHASHEMEE)}. This + is fixed by inserting the character \textsf{U+200E} before the + combination "\textsf{U+200D + hrule + U+200D}" which is used as + stretching item. + + {\color{gray} + Note: \indexterm{Vafa Khalighi}{Vafa Khalighi} has fixed this problem in + \href{https://tug.org/svn/texlive/trunk/Master/texmf-dist/tex/xelatex/xepersian/kashida-xepersian.def?revision=55165&view=co}% + {\texttt{xepersian-23.0}}, + by copying the corresponding code from + \href{http://www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def?revision=55123&view=co}% + {\texttt{xepersian-hm-0.5e}}. + Consequently, the + option \texttt{KashidaXBFix} along with the commands \linebreak[4] + \texttt{\textbackslash KashidaXBFixOn} and + \texttt{\textbackslash KashidaXBFixOff} has been removed in \linebreak[4] + \texttt{xepersian-23.0} and the later versions.} + \item In \textsf{xepersian} when outline or shadow fonts are used, the gaps - filled by horizontal rule appears as a solid box. This is fixed by - using the \textsf{kashida} glyph instead of the horizontal rule in - \textsf{xepersian-hm}. - \item Activating kashida in \textsf{xepersian} disturbs ligatures. This is - fixed in \textsf{xepersian-hm} by escaping the components of the - ligature which form the glyph, i.e. by inserting an escape character - before Persian letters joined to form the ligature without any empty - characters, blank characters, invisible characters and whitespace - characters which form the glyph. See - \mbox{Figures \ref{fig:ligatures-xep} and \ref{fig:ligatures-xephm}}. - Currently only 3 ligature glyphs are available in - \textsf{xepersian-hm}, but you can add as many as you want or let - me know the ligature glyphs that you need, so that I can add them in - the next release of the package. Of course, this is not the best - solution, but it works. + filled by horizontal rule appears as a solid box. This is fixed by + using the \textsf{kashida} glyph instead of the horizontal rule in + \textsf{xepersian-hm}. + \item Activating kashida in \textsf{xepersian} disturbs \indexterm{ligatures}{ligatures}. This is + fixed in \textsf{xepersian-hm} by escaping the components of the + ligature which form the glyph, i.e. by inserting an escape character + before Persian letters joined to form the ligature without any empty + characters, blank characters, invisible characters and whitespace + characters which form the glyph. See + \mbox{Figures \ref{fig:ligatures-xep} and \ref{fig:ligatures-xephm}}. + Currently only 3 ligature glyphs are available in + \textsf{xepersian-hm}, but you can add as many as you want or let + me know the ligature glyphs that you need, so that I can add them in + the next release of the package. Of course, this is not the best + solution, but it works. \item If italic or oblique style of some fonts such as \textsf{X Series 2} - is used in \textsf{xepersian}, an extra gap is left between the - stretched characters. This is fixed in \textsf{HM Series} fonts. + is used in \textsf{xepersian}, an extra \indexterm{gap}{gap} is left between the + stretched characters. This is fixed in \textsf{HM Series} fonts. \end{list} For comparing the outputs of \textsf{xepersian} and \textsf{xepersian-hm} with @@ -115,7 +211,7 @@ a variety of options available to these packages, please see the \end{figure} \begin{figure} - \centerline{\fbox{\includegraphics[scale=1]{doc-ligature-xephm.pdf}}} + \centerline{\fbox{\includegraphics[scale=1]{doc-ligature-xepersian-hm.pdf}}} \caption{Package: \textsf{xeprsian-hm}, Font: \textsf{Noto Sans Arabic}, \textsf{Scale=1.1}, \textsf{Kashida=glyph}} \label{fig:ligatures-xephm} \end{figure} @@ -152,28 +248,40 @@ so you may only pass options to the package using the command \end{verbatim} The options available in \textsf{xepersian-hm} are: + \begin{itemize} \item \texttt{Kashida}: \\ which implements kashida feature with three possible values: \begin{itemize} \item \texttt{glyph}: \\ - which uses the \texttt{kashida} character to stretch the text. + which uses the \texttt{kashida} character to stretch the text. \\ + With this option you should run \texttt{xelatex} thrice. For example: \\ - \texttt{rm -f kashida-example.aux \\ - xelatex kashida-example.tex \\ - xelatex kashida-example.tex \\ - xelatex kashida-example.tex} + {\color{magenta} + Imortant notes for \hologo{XeLaTeX} users: \\ - Please note that this feature is still experimental and is not regarded as stable. - If you are going to use this option be ready for unpredictable results. + \begin{itemize} + \item + If you are going to use this option then you should run \texttt{xelatex} thrice. For example: \\ - Also note that with this option, for each gap which is to be filled with kashida, - some commands, current position on the page, and references are saved in the - \texttt{\bslash jobname.aux} file and if the text is long, the file size may get - too large. + \texttt{rm -f kashida-example.aux \\ + xelatex kashida-example.tex \\ + xelatex kashida-example.tex \\ + xelatex kashida-example.tex} \\ - \item \texttt{leaders+glyph}: \\ + \item + This feature is still experimental in \hologo{XeLaTeX} and is not regarded as stable, + so, if you are going to use this option be ready for unpredictable results. + + \item + With this option, for each gap which is to be filled with kashida, + some commands, current position on the page, and references are saved in the + \texttt{\bslash jobname.aux} file and if the text is long, the file size may get + too large. + \end{itemize}} + + \item \indexterm{leaders+glyph}{\texttt{leaders+glyph}}: \\ which uses kashida glyph leaders to stretch the text. Please note that the option `Kashida=leaders+glyph' is currently only supported by \mbox{\textsf{HM Series}} fonts available at @@ -184,7 +292,7 @@ The options available in \textsf{xepersian-hm} are: Contrary to the option \texttt{Kashida=glyph}, in this case nothing is saved in \texttt{.aux} files. - \item \texttt{leaders+hrule}: \\ + \item \indexterm{leaders+hrule}{\texttt{leaders+hrule}}: \\ which uses horizontal rule (\verb|\hrule|) leaders to stretch the text. \item \texttt{Off}: \\ @@ -199,7 +307,7 @@ The options available in \textsf{xepersian-hm} are: and \linebreak[4] \texttt{Kashida=leaders+glyph} inserts \texttt{kashida} leaders wherever it is needed. - \item \texttt{linebreakpenalty}: \\ + \item \indexterm{linebreakpenalty}{\texttt{linebreakpenalty}}: \\ which specifies the amount of penalty for preventing bad line-breaking. You may strictly specify the value of this option. For example you may either set % \linebreak[4] \texttt{'linebreakpenalty=8'} or @@ -214,7 +322,35 @@ The options available in \textsf{xepersian-hm} are: \texttt{max}: & \texttt{10000} \end{longtable} - \item \texttt{kashidastretch}: \\ + \item \indexterm{ligatures}{\texttt{ligatures}}: \\ + which fixes the disturbance of ligatures caused by activation of kashida in + \textsf{xepersian}. You may strictly specify the value of this option. + For example \texttt{'ligatures=dlig'} or you may use the default value. + The available values are: + + \begin{longtable}{ll} + \texttt{aalt}: & Access All Alternatives \\ + \texttt{ccmp}: & Glyph Composition/Decomposition \\ + \texttt{dlig}: & Discretionary Ligatures \\ + \texttt{fina}: & Final (Terminal) Forms \\ + \texttt{init}: & Initial Forms \\ + \texttt{locl}: & Localized Forms \\ + \texttt{medi}: & Medial Forms \\ + \texttt{rlig}: & Required Ligatures \\ + \texttt{default}: & All the above features + \end{longtable} + Please note that this feature is still experimental and is not regarded as stable. + + \item \indexterm{color}{\texttt{color}}: \\ + which colorize the stretched parts of the text for checking the quality of kashida + justification. Color must be one of a named color declared in \textsf{xcolor} package. + For example: \texttt{color=blue} or \texttt{color=Blue}. + + Default color name is: \texttt{magenta} + + Please note that activating this option increases system resource and disk usage. + + \item \indexterm{kashidastretch}{\texttt{kashidastretch}}: \\ which specifies the amount of extra stretching for some combinations of characters. You may strictly specify the value of this option. For example \texttt{'kashidastretch=0.14 em plus 0.5 em'} or you @@ -257,31 +393,19 @@ The options available in \textsf{xepersian-hm} are: For example: \mbox{\texttt{'kashidastretch=titr'}} is equivalent to\linebreak \mbox{\texttt{'kashidastretch=0.12 em plus 0.5 em'}} - \item \texttt{ligatures}: \\ - which fixes the disturbance of ligatures caused by activation of kashida in - \textsf{xepersian}. You may strictly specify the value of this option. - For example \texttt{'ligatures=dlig'} or you may use the default value. - The available values are: - - \begin{longtable}{ll} - \texttt{aalt}: & Access All Alternatives \\ - \texttt{ccmp}: & Glyph Composition/Decomposition \\ - \texttt{dlig}: & Discretionary Ligatures \\ - \texttt{fina}: & Final (Terminal) Forms \\ - \texttt{init}: & Initial Forms \\ - \texttt{locl}: & Localized Forms \\ - \texttt{medi}: & Medial Forms \\ - \texttt{rlig}: & Required Ligatures \\ - \texttt{default}: & All the above features - \end{longtable} - Please note that this feature is still experimental and is not regarded as stable. \end{itemize} \section{Commands} \begin{description} - \item \verb|\discouragebadlinebreaks[linebreakpenalty][kashidastretch]{|{\it text}\verb|}|: + \item \ccstermsub{Commands}{\textbf{Commands}}{KashidaOff}: \\ + disables kashida justification. + + \item \ccstermsub{Commands}{\textbf{Commands}}{KashidaOn}: \\ + enables kashida justification. If the option Kashida is activated + stretching the text is the default behavior. + \item \ccstermsub{Commands}{\textbf{Commands}}{discouragebadlinebreaks}{\color{HMhighlightBlueI}\verb|[linebreakpenalty][kashidastretch]{|{\it text}\verb|}|}: \\ {\it text} may not contain paragraph breaks. This command puts a penalty after each Persian word. The optional arguments \texttt{linebreakpenalty} and \texttt{kashidastretch} locally @@ -301,8 +425,174 @@ The options available in \textsf{xepersian-hm} are: the ligature. This is fixed in \textsf{xepersian-hm}, but it is not well developed yet. \end{description} -\end{latin} +\section{Acknowledgments} +In the first place I have to thank Donald Knuth for inventing TeX. +During the development of this package I refered to Stack Exchange network of +question-and-answer (Q\&A) websites to solve problems for which I am grateful. +I also would like to thank the developer teams of TeX's friends especially LaTeX, LuaTeX and XeTeX teams. + +\section{Change History} + +\def\SubSecItem#1{\subsubsection*{\hskip 2em\large #1}\addcontentsline{toc}{subsection}{[#1]}} +\newenvironment{Itemize}{\begin{itemize}[leftmargin=4em]}{\end{itemize}} + +\SubSecItem{2020-03-17~v0.1} +\begin{Itemize} + \item First standalone version. +\end{Itemize} + +\SubSecItem{2020-03-19~v0.2} +\begin{Itemize} + \item Some minor changes. +\end{Itemize} + +\SubSecItem{2020-03-23~v0.3} +\begin{Itemize} + \item Added documentation +\end{Itemize} + +\SubSecItem{2020-03-26~v0.4} +\begin{Itemize} + \item Added DTX and INS files +\end{Itemize} + +\SubSecItem{2020-04-20~v0.5a} +\begin{Itemize} + \item Added Kashida=glyph to the package options + \item Added \bslash discouragebadlinebreaks to prevent bad line breaks in a text (less than a paragragraph). +\end{Itemize} + +\SubSecItem{2020-04-26~v0.5b} +\begin{Itemize} + \item If the kashida glyph is used to stretch the text, then the main font is checked for availability of the kashida character. + \item Two optional arguments added in \bslash discouragebadlinebreaks macro. +\end{Itemize} + +\SubSecItem{2020-05-01~v0.5c} +\begin{Itemize} + \item The documentation is divided into two parts: User documentation and Source code documentation. + \item The example file is divided into two parts: An example for the option Kashida=glyph and the other one for Kashida=hrule. +\end{Itemize} + +\SubSecItem{2020-05-07~v0.5d} +\begin{Itemize} + \item Added a new section to the user documentation titled: Brief outline of the issues. + \item An error is trigerred if the value of Kashida option is not specified. +\end{Itemize} + +\SubSecItem{2020-05-12~v0.5e} +\begin{Itemize} + \item Disturbance of ligatures caused by activation of kashida is fixed. +\end{Itemize} + +\SubSecItem{2020-05-20~v0.5f} +\begin{Itemize} + \item Reduced the length of items created by zref package in \bslash jobname.aux file. + \item If the option Kashida=glyph is used, a warning message is added to the log file + which emphasizes that the option is experimental. +\end{Itemize} + +\SubSecItem{2020-05-31~v1.0a} +\begin{Itemize} + \item The option 'Kashida=hrule' is changed to 'Kashida=leaders+hrule'. + \item The option 'Kashida=leaders+glyph' is added. Since with this option kashida glyph + leaders are used to stretch the text, nothing is saved in .aux files. +\end{Itemize} + +\SubSecItem{2020-06-04~v1.0b} +\begin{Itemize} + \item Added two options Kashida=On and Kashida=Off. +\end{Itemize} + +\SubSecItem{2020-07-20~v1.0c} +\begin{Itemize} + \item Fixed the problem with the option ligatures=default. +\end{Itemize} + +\SubSecItem{2020-08-05~v1.0d} +\begin{Itemize} + \item In the new version of LaTeX3, the name of some of the XeTeX control sequences has changed. + These changes are applied in this version of xepersion-hm. +\end{Itemize} + +\SubSecItem{2020-09-04~v1.1a} +\begin{Itemize} + \item Added the color option. + \item Added a few sections to the User Documentation. + \item Split the file containing kashida code. +\end{Itemize} + +\section*{To Do's} + +To do + +\renewcommand{\refname}{References: \\ {\normalsize\it Actually, this is not a ``References'' nor a ``Literature'', but the most important + although not a complete list of ``Resources Used'' to develop this package.}} + +\begin{thebibliography}{9} + + \bibitem{DEK-TTB} Donald E. Knuth, + \emph{The \hologo{TeX} book}, + Addison-Wesley, 1986. + + \bibitem{VE-TBT} Victor Eijkhout, + \emph{\hologo{TeX} BY TOPIC}, + Addison-Wesley, 2013. + + \bibitem{PWA-KAH-KB-TFI} Paul W. Abrahams, Kathryn A. Hargreaves, and Karl Berry, + \emph{\hologo{TeX} for the Impatient}, + Addison-Wesley, 2013. + + \bibitem{LL-LADPS} Leslie Lamport, + \emph{\hologo{LaTeX}, A document preparation System}, + Addison-Wesley, 1986. + + \bibitem{FM-MG-JB-DC-CR-TLC} Frank Mittelbach and Michel Goossens with Johannes Braams, David Carlisle, and Chris Rowley, + \emph{The \hologo{LaTeX} Companion}, + Addison-Wesley, second edition, 2004. + + \bibitem{TLT-TLS} Package \texttt{latex}: The LaTeX Team, + \emph{The \hologo{LaTeX2e} Sources}, + \href{http://mirrors.ctan.org/macros/latex/base/source2e.pdf}{\texttt{CTAN:macros/latex/base/source2e.pdf}}, 2020-02-02 + + \bibitem{TL3T-TLS} Package \texttt{l3kernel}: The LaTeX3 Team, + \emph{The \hologo{LaTeX}3 Sources}, + \href{http://mirrors.ctan.org/macros/latex/contrib/l3kernel/source3.pdf}{\texttt{CTAN:macros/latex/contrib/l3kernel/source3.pdf}}, 2020-07-17 + + \bibitem{TL3T-TLI} Package \texttt{l3kernel}: The LaTeX3 Team, + \emph{The \hologo{LaTeX}3 Interfaces}, + \href{http://mirrors.ctan.org/macros/latex/contrib/l3kernel/interface3.pdf}{\texttt{CTAN:macros/latex/contrib/l3kernel/interface3.pdf}}, 2020-07-17 + + \bibitem{WR-KH-KB-XRG} Package \texttt{xetexref}: Will Robertson, Khaled Hosny, and Karl Berry, + \hologo{XeTeX} reference guide, + \href{http://mirrors.ctan.org/info/xetexref/xetex-reference.pdf}{\texttt{CTAN:info/xetexref/xetex-reference.pdf}}, 2019-12-09 + + \bibitem{JQ-AX} Package \texttt{xetex}: Jonathan Kew, + About \hologo{XeTeX}, + \href{http://mirrors.ctan.org/systems/doc/xetex/XeTeX-notes.pdf}{\texttt{CTAN:systems/doc/xetex/XeTeX-notes.pdf}}, 2005-10-17 + + \bibitem{NG-TXC} Package \texttt{xetex}: Michel Goossens, + The \hologo{XeTeX} Companion, + \href{http://xml.web.cern.ch/XML/lgc2/xetexmain.pdf}{\texttt{http://xml.web.cern.ch/XML/lgc2/xetexmain.pdf}}, 2009-08-19 + + \bibitem{TEX-STACKEXCHANGE} Website: Stack Exchange: Hot Questions, + \hologo{TeX}-\hologo{LaTeX} Q\&A for users of TeX, LaTeX, ConTeXt, and related typesetting systems, + \href{https://tex.stackexchange.com}{\texttt{tex.stackexchange.com}} + +\end{thebibliography} + +\newpage + +\printindex +\addcontentsline{toc}{section}{Index} + +\includepdf[pages={1-},scale=0.75]{xepersian-XB.pdf} + +\includepdf[pages={1-},scale=0.75]{xepersian-hm-glyph.pdf} +\includepdf[pages={1-},scale=0.75]{xepersian-hm-leaders-glyph.pdf} +\includepdf[pages={1-},scale=0.75]{xepersian-hm-leaders-hrule.pdf} + \end{document} -%% +%% %% %% End of file `xepersian-hm-doc.ltx'. diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.pdf Binary files differindex dba4eee9aea..9417c8152ab 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-glyph.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-glyph.pdf Binary files differnew file mode 100644 index 00000000000..71a80092d43 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-glyph.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-glyph.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-glyph.tex new file mode 100644 index 00000000000..7e24c81fee9 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-glyph.tex @@ -0,0 +1,83 @@ +\PassOptionsToPackage{fontsloadable=true}{xepersian} % Load xepersian with a few options +\documentclass{report} + +\usepackage[Kashida=glyph,linebreakpenalty=8,kashidastretch=0.14 em plus 5.5 em,color=red]{xepersian-hm} % Succeeds +% \settextfont[Scale=4.5,Colour=darkgray]{XB Kayhan} +\settextfont[Scale=4.5]{HM XKayhan} +\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan} + +\deflatinfont\HMXKayhanEn[Scale=1.2]{HM XKayhan} +\defpersianfont\HMXKayhanRm[Scale=4.5]{HM XKayhan} +\defpersianfont\HMXKayhanIt[Scale=4.5]{HM XKayhan Italic} +\defpersianfont\HMXKayhanOb[Scale=4.5]{HM XKayhanOb Oblique} +\defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline} +\defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow} +\defpersianfont\HMXKayhanPo[Scale=4.5]{HM XKayhan Pook} +\defpersianfont\HMXKayhanSa[Scale=4.5]{HM XKayhan Sayeh} +\defpersianfont\HMXKayhanNa[Scale=4.5]{HM XKayhan Navaar} + +\def\SampleText#1#2{\discouragebadlinebreaks[#1][#2]{ + راهی جایی تابی چاپی چاههی تلاشهایی + شتابهایی تابی چاپی راهی تلاشهــایی + که کتابهایی که کلاههایی که کتابهایی }} + +\def\SampleTitle#1#2#3{{{\HMXKayhanEn\LTR Engine: {\color{blue}\texttt{#1}}, \\ + Style: {\color{blue}\texttt{#2}}, \\ Kashida: {\color{blue}\texttt{#3}}}}\hbox{}\vskip 5mm} + +\pretolerance = 10000 +% \exhyphenpenalty=10000 +% \hyphenpenalty=10000 +% \penalty -10000 +% \tolerance=10000 +% \tolerance = -10000 +% \looseness = 10000 + +\setlength\parindent{0pt} +% \pagestyle{empty} +\setcounter{page}{26} +\let\tmppage=\thepage +\gdef\thepage{\scriptsize\lr\tmppage} + +\begin{document} + +\begin{latin} +\begin{center} +{\Huge\textsf{\XePersianHM} \\ + \vspace{20pt} Example of Use \\ + \vspace{20pt}\texttt{Engine: XeTeX {\normalsize using xepersian-hm}} \\ + \vspace{20pt}\texttt{Kashida=glyph}} \\ + \vspace{20pt}\makebox{\textsf{File:} \texttt{TEXMFDIST/doc/xelatex/xepersian-hm/xepersian-hm-glyph.tex}} \\ + \vspace{20pt} + +{\Large +\begin{tabular}{ll} + \textsf{Font:} & \textsf{HM XKayhan} \\ + \textsf{Font Scale:} & \texttt{4.5} \\ + \textsf{linebreakpenalty:} & \texttt8 \\ + \textsf{kashidastretch:} & \texttt{0.14em plus 5.5em} \\ + \textsf{color:} & \texttt{red} +\end{tabular} +} +\end{center} + +\end{latin} + +\newpage \KashidaOff \SampleTitle{XeTeX using xepersian-hm}{Regular}{Off} \par {\HMXKayhanRm \SampleText{8}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Regular}{glyph (On)} \par {\HMXKayhanRm \SampleText{15}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Italic}{glyph (On)} \par {\HMXKayhanIt \SampleText{20}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Oblique}{glyph (On)} \par {\HMXKayhanOb \SampleText{20}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Outline}{glyph (On)} \par {\HMXKayhanOl \SampleText{25}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Shadow}{glyph (On)} \par {\HMXKayhanSd \SampleText{30}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Pook}{glyph (On)} \par {\HMXKayhanPo \SampleText{200}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Sayeh}{glyph (On)} \par {\HMXKayhanSa \SampleText{200}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Navaar}{glyph (On)} \par {\HMXKayhanNa \SampleText{200}{0.14 em plus 0.5 em}} + +\end{document} diff --git a/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-kashida.tex index ff6a4d7366e..56bf3319d6c 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-kashida.tex @@ -1,10 +1,10 @@ %% -%% This is file `kashida-xepersian-hm.def', +%% This is file `xepersian-hm-kashida.tex', %% generated with the docstrip utility. %% %% The original source files were: %% -%% xepersian-hm.dtx (with options: `kashida-xepersian-hm-def') +%% xepersian-hm.dtx (with options: `xepersian-hm-kashida-tex') %% %% Copyright (C) 2020 Hossein Movahhedian %% @@ -12,8 +12,9 @@ %% version 1.3c or higher (your choice). The latest version of %% this license is at: http://www.latex-project.org/lppl.txt %% -\ExplSyntaxOn -\ProvidesExplFile {kashida-xepersian-hm.def} {2020-08-05} {1.0d} { Fixes~implementation~of~Kashida~in~xepersian~package } +\ProvidesExplFile {xepersian-hm-kashida.tex} {2020-09-04} {1.1a} { Fixes~implementation~of~Kashida~in~xepersian~package } + +\tex_input:D { xepersian-hm-common-kashida.tex } \newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class \newXeTeXintercharclass \c_xephm_l_charclass % lam @@ -21,78 +22,23 @@ \newXeTeXintercharclass \c_xephm_a_charclass % alef \newXeTeXintercharclass \c_xephm_y_charclass % yeh -\bool_if:NT \l_xephm_ligature_bool -{ - \clist_new:N \l_xephm_ligatures_clist - \int_new:N \l_xephm_lig_names_len_int - \int_set:Nn \l_xephm_lig_names_len_int { \clist_count:N \l_xephm_lig_names_clist } - \int_step_inline:nnnn { 1 } { 2 } { \l_xephm_lig_names_len_int } - { - \int_set:Nn \l_tmpa_int { #1 } - \int_set:Nn \l_tmpb_int { \int_eval:n { \l_tmpa_int + 1 } } - \tl_set:Nf \l_tmpa_tl { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpa_int } } - \clist_set:Nx \l_tmpa_clist { { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpb_int } } } - \bool_if:nT { \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_tmpa_tl || \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_xephm_lig_default_tl } - { - \clist_put_left:Nx \l_xephm_ligatures_clist { \l_tmpa_clist } - } - } - \clist_map_inline:Nn \l_xephm_ligatures_clist - { - \seq_set_split:Nnn \l_tmpa_seq { = } { #1 } - \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl { } { } - \seq_pop_left:NN \l_tmpa_seq \l_tmpb_tl { } { } - \tl_const:cx { \tl_use:N \l_tmpb_tl } { \char"\l_tmpa_tl \ } - } -} - -\bool_if:NT \l_xephm_linebreakpenalty_bool -{ - %% Partly adapted from LaTeX2e source - \cs_new:Nn \xephm_line_break: { - \if_mode_vertical: - \GenericError{ - \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space - }{ - LaTeX Error: There’s no line here to end - }{ - See the LaTeX manual or LaTeX Companion for explanation. - }{ - Your command was ignored.\MessageBreak - Type \space I <command> <return> \space to replace it~ - with another command,\MessageBreak - or \space <return> \space to continue without it.} - \else: - \l_tmpa_skip \tex_lastskip:D - \tex_unskip:D - \tex_penalty:D -\l_xephm_line_break_penalty_int - \dim_compare:nT { \l_tmpa_skip > \c_zero_skip } - { \skip_horizontal:N \l_tmpa_skip \tex_ignorespaces:D } - \fi: +\tl_set:Nn \l_xephm_use_color_tl + { + \bool_if:NTF \l_xephm_color_bool + { + \colorlet{default}{\l_xephm_color_tl} + } + { + \colorlet{default}{.} + } + \color{default} } - \NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m } - { - \IfNoValueF {#1} - { \int_set:Nn \l_xephm_line_break_penalty_int {#1} } - \IfNoValueF {#2} - { \tl_set:Nn \l_xephm_skip_default_tl {#2} } - \xephm_put_line_breaks:n { #3 } - } - - \cs_new_protected:Nn \xephm_put_line_breaks:n - { - \tl_set:Nn \l_xephm_line_break_tl { #1 } - \regex_replace_all:nnN { ([ابپتثجحخچدذرزژسشعغصضفقطظکگلمنوهیـ])+ } { \ \0 \ \c{xephm_line_break:}\ } \l_xephm_line_break_tl - \tl_use:N \l_xephm_line_break_tl - } -} - %% Partly adapted from the code provided by David Carlisle in: %% https://tex.stackexchange.com/questions/356709/how-to-know-the-width-and-fill-the-glue-space-between-two-characters-when-using/356721#356721 \cs_new:Npn \xephm_kashida_glyph #1 { - \bool_if:NT \l_xephm_kashida_hm_fix_bool + \bool_if:NT \l_xephm_kashida_fix_bool { \c_xephm_lrm_int\tex_penalty:D 10000 \mode_leave_vertical: @@ -130,14 +76,14 @@ } \dim_compare:nTF { \l_xephm_diff_pos_dim == 0sp } { } - { \llap { \resizebox { \l_xephm_diff_pos_dim \tex_relax:D } { \height } { \c_xephm_ksh_int } } } + { \llap { \resizebox { \l_xephm_diff_pos_dim \tex_relax:D } { \height } { \l_xephm_use_color_tl \c_xephm_ksh_int } } } \fi: } } \cs_new:Npn \xephm_kashida_leaders #1 { - \bool_if:NT \l_xephm_kashida_hm_fix_bool + \bool_if:NT \l_xephm_kashida_fix_bool { \tl_if_eq:NNTF \l_xephm_gap_filler_tl \l_xephm_stretch_leaders_glyph_tl { @@ -149,7 +95,7 @@ \tl_set:Nn \l_tmpb_tl { HMX } \bool_if:nTF { \str_if_eq_p:NN { \l_xephm_font_init_tl } { \l_tmpa_tl } || \str_if_eq_p:NN { \l_xephm_font_init_tl } { \l_tmpb_tl } } { - \hbox_set:Nn \l_xephm_ksh_box { \XeTeXglyph\XeTeXglyphindex"kashida" } + \hbox_set:Nn \l_xephm_ksh_box { \l_xephm_use_color_tl \XeTeXglyph\XeTeXglyphindex"kashida" } \c_xephm_zwj_int \tex_penalty:D 10000 \tex_leaders:D \copy\l_xephm_ksh_box \skip_horizontal:n { #1 } \c_xephm_zwj_int @@ -166,10 +112,12 @@ %% the earlier versions of this package I made a mistake and acknowledged %% Vafa Khalighi instead of Jonathan Kew. A sincere thank you to Jonathan Kew %% for his excellent code. - \c_xephm_lrm_int\c_xephm_zwj_int\tex_penalty:D 10000 + \c_xephm_lrm_int\c_xephm_zwj_int + {\l_xephm_use_color_tl\tex_penalty:D 10000 \tex_leaders:D \tex_hrule:D height \XeTeXglyphbounds \c_xephm_two_int \int_use:N \XeTeXcharglyph \c_xephm_ksh_int depth \XeTeXglyphbounds \c_xephm_four_int \int_use:N \XeTeXcharglyph \c_xephm_ksh_int \skip_horizontal:n { #1 } + } \c_xephm_zwj_int } } @@ -209,12 +157,12 @@ \tl_if_eq:NNTF \l_xephm_gap_filler_tl \l_xephm_stretch_glyph_tl { \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int } { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int } } \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int } { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int } } @@ -235,12 +183,12 @@ } { \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \xephm_kashida_leaders \l_xephm_skip_default_tl } { \xephm_kashida_leaders \c_xephm_skip_a_tl } } \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \xephm_kashida_leaders \l_xephm_skip_default_tl } { \xephm_kashida_leaders \c_xephm_skip_a_tl } } @@ -259,31 +207,7 @@ } } -\NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_hm_fix_bool } -\NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_hm_fix_bool } - -\tex_let:D \KashidaOn \KashidaHMFixOn -\tex_let:D \KashidaOff \KashidaHMFixOff - -\bool_if:NTF \l_xephm_kashida_hm_fix_bool - { - \tl_if_empty:NT \l_xephm_skip_default_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.14 em plus 0.5 em } } - } - { - \tl_set:NV \l_xephm_skip_default_tl \c_xephm_skip_a_tl - } - -\ExplSyntaxOff - -\makeatletter -\newif\if@Kashida@on -%% Becuase Vafa Khalighi has copied the above code (injecting the character uni+200E) in xepersian-23.0 -%% (https://tug.org/svn/texlive/trunk/Master/texmf-dist/tex/xelatex/xepersian/kashida-xepersian.def?revision=55165&view=co), -%% the following line of code is not needed in xepersian anymore. -%% % \newif\if@Kashida@XB@fix -\makeatother - \endinput %% %% -%% End of file `kashida-xepersian-hm.def'. +%% End of file `xepersian-hm-kashida.tex'. diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.pdf Binary files differnew file mode 100644 index 00000000000..316a6c7a6b5 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.tex new file mode 100644 index 00000000000..179aad142f0 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.tex @@ -0,0 +1,83 @@ +\PassOptionsToPackage{fontsloadable=true}{xepersian} % Load xepersian with a few options +\documentclass{report} + +\usepackage[Kashida=leaders+glyph,linebreakpenalty=8,kashidastretch=0.14 em plus 0.5 em,color=red]{xepersian-hm} % Succeeds +% \settextfont[Scale=4.5,Colour=darkgray]{XB Kayhan} +\settextfont[Scale=4.5]{HM XKayhan} +\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan} + +\deflatinfont\HMXKayhanEn[Scale=1.2]{HM XKayhan} +\defpersianfont\HMXKayhanRm[Scale=4.5]{HM XKayhan} +\defpersianfont\HMXKayhanIt[Scale=4.5]{HM XKayhan Italic} +\defpersianfont\HMXKayhanOb[Scale=4.5]{HM XKayhanOb Oblique} +\defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline} +\defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow} +\defpersianfont\HMXKayhanPo[Scale=4.5]{HM XKayhan Pook} +\defpersianfont\HMXKayhanSa[Scale=4.5]{HM XKayhan Sayeh} +\defpersianfont\HMXKayhanNa[Scale=4.5]{HM XKayhan Navaar} + +\def\SampleText#1#2{\discouragebadlinebreaks[#1][#2]{ + راهی جایی تابی چاپی چاههی تلاشهایی + شتابهایی تابی چاپی راهی تلاشهــایی + که کتابهایی که کلاههایی که کتابهایی }} + +\def\SampleTitle#1#2#3{{{\HMXKayhanEn\LTR Engine: {\color{blue}\texttt{#1}}, \\ + Style: {\color{blue}\texttt{#2}}, \\ Kashida: {\color{blue}\texttt{#3}}}}\hbox{}\vskip 5mm} + +\pretolerance = 10000 +% \exhyphenpenalty=10000 +% \hyphenpenalty=10000 +% \penalty -10000 +% \tolerance=10000 +% \tolerance = -10000 +% \looseness = 10000 + +\setlength\parindent{0pt} +% \pagestyle{empty} +\setcounter{page}{36} +\let\tmppage=\thepage +\gdef\thepage{\scriptsize\lr\tmppage} + +\begin{document} + +\begin{latin} +\begin{center} +{\Huge\textsf{\XePersianHM} \\ + \vspace{20pt} Example of Use \\ + \vspace{20pt}\texttt{Engine: XeTeX {\normalsize using xepersian-hm}} \\ + \vspace{20pt}\texttt{Kashida=leaders+glyph}} \\ + \vspace{20pt}\makebox{\textsf{File:} \texttt{TEXMFDIST/doc/xelatex/xepersian-hm/xepersian-hm-leaders-glyph.tex}} \\ + \vspace{20pt} + +{\Large +\begin{tabular}{ll} + \textsf{Font:} & \textsf{HM XKayhan} \\ + \textsf{Font Scale:} & \texttt{4.5} \\ + \textsf{linebreakpenalty:} & \texttt8 \\ + \textsf{kashidastretch:} & \texttt{0.14em plus 5.5em} \\ + \textsf{color:} & \texttt{red} +\end{tabular} +} +\end{center} + +\end{latin} + +\newpage \KashidaOff \SampleTitle{XeTeX using xepersian-hm}{Regular}{Off} \par {\HMXKayhanRm \SampleText{8}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Regular}{glyph (On)} \par {\HMXKayhanRm \SampleText{15}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Italic}{glyph (On)} \par {\HMXKayhanIt \SampleText{20}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Oblique}{glyph (On)} \par {\HMXKayhanOb \SampleText{20}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Outline}{glyph (On)} \par {\HMXKayhanOl \SampleText{25}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Shadow}{glyph (On)} \par {\HMXKayhanSd \SampleText{30}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Pook}{glyph (On)} \par {\HMXKayhanPo \SampleText{200}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Sayeh}{glyph (On)} \par {\HMXKayhanSa \SampleText{200}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Navaar}{glyph (On)} \par {\HMXKayhanNa \SampleText{200}{0.14 em plus 0.5 em}} + +\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.pdf Binary files differnew file mode 100644 index 00000000000..247fb747510 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.pdf diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.tex new file mode 100644 index 00000000000..a10a8848031 --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.tex @@ -0,0 +1,83 @@ +\PassOptionsToPackage{fontsloadable=true}{xepersian} % Load xepersian with a few options +\documentclass{report} + +\usepackage[Kashida=leaders+hrule,linebreakpenalty=8,kashidastretch=0.14 em plus 0.5 em,color=red]{xepersian-hm} % Succeeds +% \settextfont[Scale=4.5,Colour=darkgray]{XB Kayhan} +\settextfont[Scale=4.5]{HM XKayhan} +\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan} + +\deflatinfont\HMXKayhanEn[Scale=1.2]{HM XKayhan} +\defpersianfont\HMXKayhanRm[Scale=4.5]{HM XKayhan} +\defpersianfont\HMXKayhanIt[Scale=4.5]{HM XKayhan Italic} +\defpersianfont\HMXKayhanOb[Scale=4.5]{HM XKayhanOb Oblique} +\defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline} +\defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow} +\defpersianfont\HMXKayhanPo[Scale=4.5]{HM XKayhan Pook} +\defpersianfont\HMXKayhanSa[Scale=4.5]{HM XKayhan Sayeh} +\defpersianfont\HMXKayhanNa[Scale=4.5]{HM XKayhan Navaar} + +\def\SampleText#1#2{\discouragebadlinebreaks[#1][#2]{ + راهی جایی تابی چاپی چاههی تلاشهایی + شتابهایی تابی چاپی راهی تلاشهــایی + که کتابهایی که کلاههایی که کتابهایی }} + +\def\SampleTitle#1#2#3{{{\HMXKayhanEn\LTR Engine: {\color{blue}\texttt{#1}}, \\ + Style: {\color{blue}\texttt{#2}}, \\ Kashida: {\color{blue}\texttt{#3}}}}\hbox{}\vskip 5mm} + +\pretolerance = 10000 +% \exhyphenpenalty=10000 +% \hyphenpenalty=10000 +% \penalty -10000 +% \tolerance=10000 +% \tolerance = -10000 +% \looseness = 10000 + +\setlength\parindent{0pt} +% \pagestyle{empty} +\setcounter{page}{46} +\let\tmppage=\thepage +\gdef\thepage{\scriptsize\lr\tmppage} + +\begin{document} + +\begin{latin} +\begin{center} +{\Huge\textsf{\XePersianHM} \\ + \vspace{20pt} Example of Use \\ + \vspace{20pt}\texttt{Engine: XeTeX {\normalsize using xepersian-hm}} \\ + \vspace{20pt}\texttt{Kashida=leaders+hrule}} \\ + \vspace{20pt}\makebox{\textsf{File:} \texttt{TEXMFDIST/doc/xelatex/xepersian-hm/xepersian-hm-leaders-hrule.tex}} \\ + \vspace{20pt} + +{\Large +\begin{tabular}{ll} + \textsf{Font:} & \textsf{HM XKayhan} \\ + \textsf{Font Scale:} & \texttt{4.5} \\ + \textsf{linebreakpenalty:} & \texttt8 \\ + \textsf{kashidastretch:} & \texttt{0.14em plus 5.5em} \\ + \textsf{color:} & \texttt{red} +\end{tabular} +} +\end{center} + +\end{latin} + +\newpage \KashidaOff \SampleTitle{XeTeX using xepersian-hm}{Regular}{Off} \par {\HMXKayhanRm \SampleText{8}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Regular}{glyph (On)} \par {\HMXKayhanRm \SampleText{15}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Italic}{glyph (On)} \par {\HMXKayhanIt \SampleText{20}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Oblique}{glyph (On)} \par {\HMXKayhanOb \SampleText{20}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Outline}{glyph (On)} \par {\HMXKayhanOl \SampleText{25}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Shadow}{glyph (On)} \par {\HMXKayhanSd \SampleText{30}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Pook}{glyph (On)} \par {\HMXKayhanPo \SampleText{200}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Sayeh}{glyph (On)} \par {\HMXKayhanSa \SampleText{200}{0.14 em plus 0.5 em}} + +\newpage \KashidaOn \SampleTitle{XeTeX using xepersian-hm}{Navaar}{glyph (On)} \par {\HMXKayhanNa \SampleText{200}{0.14 em plus 0.5 em}} + +\end{document} diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm.pdf b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm.pdf Binary files differindex 5cace91f22a..7b4d1899064 100644 --- a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm.pdf +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm.pdf diff --git a/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx b/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx index b9ff39c87ec..0e8dca69be3 100644 --- a/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx +++ b/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx @@ -1,12 +1,12 @@ % \iffalse meta-comment % % This is file `xepersian-hm.dtx' -% +% % Copyright (C) 2020 Hossein Movahhedian -% +% % 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 license is at: http://www.latex-project.org/lppl.txt % %<*internal> \iffalse @@ -15,14 +15,20 @@ The XEPERSIAN-HM package ------------------------ -Kashida feature in 'xepersian' has problems with some fonts such as 'HM Series' -available at 'https://dma8hm1334.bitbucket.io' and 'X Series 2' available at -'http://wiki.irmug.com/index.php/X_Series_2'. The 'xepersian-hm' package fixes -these problems. +In some cursive scripts such as Persian or Arabic, kashida is used to create +justification. In this type of justification characters are elongated rather +than expanding spaces between words. -The files 'kashida-glyph-example.tex' and 'kashida-hrule-example.tex' in -the directory 'texmf-dist/doc/xelatex/xepersian-hm/' can be used as simple -examples of the usage of the package. +The kashida justification in 'xepersian' has many bugs. Also it has problems +with some fonts such as 'HM Series' available at +'https://dma8hm1334.bitbucket.io' and 'X Series 2' available at +'http://wiki.irmug.com/index.php/X_Series_2'. + +This package fixes the known bugs in 'xepersian' which uses the xetex engine. + +The files 'xepersian-hm-*.tex' in the directory +'texmf-dist/doc/xelatex/xepersian-hm/' can be used as simple examples of +the usage of the package. Please use the Bitbucket issue tracker: 'https://bitbucket.org/dma8hm1334/xepersian-hm/issues' to report a bug, request @@ -36,28 +42,54 @@ make time to fix. \fi %</internal> % -% \begin{macrocode} +%<*driver|package> +% The version of expl3 required is tested as early as possible, as +% some really old versions do not define \ProvidesExplPackage. +\RequirePackage{expl3}[2018/02/21] +%<package>\@ifpackagelater{expl3}{2018/02/21} +%<package> {} +%<package> {% +%<package> \PackageError{xtemplate}{Support package l3kernel too old} +%<package> {% +%<package> Please install an up to date version of l3kernel\MessageBreak +%<package> using your TeX package manager or from CTAN.\MessageBreak +%<package> \MessageBreak +%<package> Loading xtemplate will abort!% +%<package> }% +%<package> \endinput +%<package> } +%</driver|package> %<*driver> -\documentclass[full]{ltxdoc} -\usepackage{longtable} -\usepackage{hypdoc} -\addtolength{\hoffset}{-10mm} -\EnableCrossrefs -\CodelineIndex -\RecordChanges +\documentclass[full]{l3doc} +\usepackage{enumitem} \begin{document} \DocInput{\jobname.dtx} \end{document} %</driver> -% \end{macrocode} % \fi % -% \immediate\write18{xelatex xepersian-hm-doc.ltx} +% \ifluatex +% \immediate\directlua{os.execute([[ lualatex xepersian-hm-doc.ltx ]])} +% \immediate\directlua{os.execute([[ lualatex xepersian-hm-doc.ltx ]])} +% \immediate\directlua{os.execute([[ makeindex -c xepersian-hm-doc.idx ]])} +% \immediate\directlua{os.execute([[ lualatex xepersian-hm-doc.ltx ]])} +% \fi +% +% \ifxetex +% \immediate\write18{lualatex xepersian-hm-doc.ltx} +% \immediate\write18{lualatex xepersian-hm-doc.ltx} +% \immediate\write18{makeindex -c xepersian-hm-doc.idx} +% \immediate\write18{lualatex xepersian-hm-doc.ltx} +% \fi +% +% \begin{implementation} +% +% \def\XePersianHM{XePersianHM} % % \title{^^A % The \textsf{xepersian-hm} package\\Fixing kashida in xepersian\\Source code documentation^^A % } -% +% % \author{^^A % Hossein Movahhedian\thanks % {^^A @@ -66,12 +98,27 @@ make time to fix. % {\textsf{dma8hm1334@gmail.com}} % }^^A % } -% -% \date{Released \quad 2020-08-05 \quad v1.0d} -% +% +% \date{Released \quad 2020-09-04 \quad v1.1a} +% % \maketitle +% +% \vskip 40mm +% \begin{function}{HM:} +% \begin{minipage}{0.65\linewidth} +% \textit{\noindent +% HM is an initialism for ``Hossein Movahhedian'' -- the author's name and family. +% } +% \end{minipage} +% \end{function} +% +% \newpage +% +% \tableofcontents +% +% \newpage % -% \section{\texttt{xepersian-hm} Implementation} +% \section{\XePersianHM{} Implementation} % % \subsection{File: \texttt{xepersian-hm.sty}} % @@ -94,9 +141,11 @@ make time to fix. \RequirePackage{l3keys2e} \RequirePackage{graphicx}[2019-11-30] \RequirePackage{zref-savepos}[2020-03-03] +\RequirePackage{xcolor}[2016/05/11] \RequirePackage{xepersian} -\ExplSyntaxOn -\ProvidesExplPackage {xepersian-hm} {2020-08-05} {1.0d} { Fixes~issues~in~xepersian~package } +\ProvidesExplPackage {xepersian-hm} {2020-09-04} {1.1a} { Fixes~issues~in~xepersian~package } + +\def\XePersianHM{XePersianHM} \box_new:N \l_xephm_ksh_box @@ -104,8 +153,8 @@ make time to fix. \int_const:Nn \c_xephm_lrm_int {"200E} % left-right-mark \int_const:Nn \c_xephm_zwj_int {"200D} % zero-width joiner -\int_const:Nn \c_xephm_two_int {2} % 2 -\int_const:Nn \c_xephm_four_int {4} % 4 +\int_const:Nn \c_xephm_two_int {2} +\int_const:Nn \c_xephm_four_int {4} \tl_const:Nn \c_xephm_skip_a_tl { 0 em plus 0.5 em } \tl_const:Nn \c_xephm_skip_b_tl { 0.14 em plus 5.5 em } @@ -136,11 +185,17 @@ make time to fix. \tl_new:N \l_xephm_gap_filler_tl +\tl_new:N \l_xephm_use_color_tl +\tl_new:N \l_xephm_color_tl +\tl_new:N \l_xephm_color_rgb_tl + \dim_new:N \l_xephm_diff_pos_dim -\bool_set_false:N \l_xephm_kashida_hm_fix_bool +\bool_set_false:N \l_xephm_kashida_fix_bool + \bool_set_false:N \l_xephm_ligature_bool \bool_set_false:N \l_xephm_linebreakpenalty_bool +\bool_set_false:N \l_xephm_color_bool \int_set:Nn \l_xephm_min_penalty_int { 0 } \int_set:Nn \l_xephm_low_penalty_int { 8 } @@ -195,6 +250,8 @@ make time to fix. \tl_set:Nn \l_xephm_lig_rlig_tl { rlig } % Required Ligatures \tl_set:Nn \l_xephm_lig_default_tl { default } +\tl_set:Nn \l_xephm_col_default_tl { magenta } + \clist_set:Nn \l_xephm_lig_aalt_clist { } % Access All Alternatives \clist_set:Nn \l_xephm_lig_ccmp_clist { } % Glyph Composition/Decomposition \clist_set:Nn \l_xephm_lig_dlig_clist { FDF2 = الله , FDF3 = اکبر , FDFB = جلجلاله } % Discretionary Ligatures @@ -264,33 +321,28 @@ make time to fix. \tl_set:Nx \l_xephm_main_font_full_tl { \tex_fontname:D \tex_the:D \tex_font:D } \tl_set:Nx \l_xephm_main_font_name_tl { \l_xephm_main_font_full_tl } \regex_replace_once:nnN { ^"([^/]+)/.* } { \1 } \l_xephm_main_font_name_tl - \int_set:Nn \l_xephm_kashida_slot_int { \XeTeXcharglyph \c_xephm_ksh_int } - \int_compare:nT { \l_xephm_kashida_slot_int = \c_zero_int } - { - \msg_error:nnx { xepersian-hm } { error-kashida-character-is-not-available-in-the-main-font } { \l_xephm_main_font_name_tl } - } } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_leaders_glyph_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_glyph_tl } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_leaders_hrule_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_hrule_tl } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_off_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_off_tl } - \bool_set_false:N \l_xephm_kashida_hm_fix_bool + \bool_set_false:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_on_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_glyph_tl } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } } { } { \tl_set:Nx \l_xephm_gap_filler_tl { #1 } } \tl_if_empty:NT \l_xephm_gap_filler_tl { \msg_error:nn { xepersian-hm } { error-specify-value-for-kashida-option } } @@ -367,25 +419,59 @@ make time to fix. \bool_set_true:N \l_xephm_ligature_bool } , ligatures .default:n = \tl_set:Nn \l_xephm_active_ligs_tl { \l_xephm_lig_default_tl } , + + color .code:n = + { + \tl_set:Nn \l_tmpa_tl { #1 } + \tl_if_empty:NTF \l_tmpa_tl + { + \tl_set:Nx \l_xephm_color_tl { \l_xephm_col_default_tl } + } + { + \tl_set:Nx \l_xephm_color_tl { \l_tmpa_tl } + } + \bool_set_true:N \l_xephm_color_bool + } , + } \ProcessKeysOptions { xepersian-hm } -\bool_if:NT \l_xephm_kashida_hm_fix_bool +\bool_if:NTF \l_xephm_kashida_fix_bool { - \tex_input:D { kashida-xepersian-hm.def } + \tex_input:D { xepersian-hm-kashida.tex } + + \NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_fix_bool } + \NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_fix_bool } + + \tex_let:D \KashidaOn \KashidaHMFixOn + \tex_let:D \KashidaOff \KashidaHMFixOff + + \tl_if_empty:NT \l_xephm_skip_default_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.14 em plus 0.5 em } } + } + { + \tl_set:NV \l_xephm_skip_default_tl \c_xephm_skip_a_tl } -\ExplSyntaxOff +\makeatletter +\newif\if@Kashida@on +%% Becuase Vafa Khalighi has copied the above code (injecting the character uni+200E) in xepersian-23.0 +%% (https://tug.org/svn/texlive/trunk/Master/texmf-dist/tex/xelatex/xepersian/kashida-xepersian.def?revision=55165&view=co), +%% the following line of code is not needed in xepersian anymore. +%% % \newif\if@Kashida@XB@fix +\makeatother + \endinput %</xepersian-hm-sty> % \end{macrocode} % -% \subsection{File: \texttt{kashida-xepersian-hm.def}} +% \subsection{File: \texttt{xepersian-hm-kashida.tex}} +% % \begin{macrocode} -%<*kashida-xepersian-hm-def> -\ExplSyntaxOn -\ProvidesExplFile {kashida-xepersian-hm.def} {2020-08-05} {1.0d} { Fixes~implementation~of~Kashida~in~xepersian~package } +%<*xepersian-hm-kashida-tex> +\ProvidesExplFile {xepersian-hm-kashida.tex} {2020-09-04} {1.1a} { Fixes~implementation~of~Kashida~in~xepersian~package } + +\tex_input:D { xepersian-hm-common-kashida.tex } \newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class \newXeTeXintercharclass \c_xephm_l_charclass % lam @@ -393,78 +479,23 @@ make time to fix. \newXeTeXintercharclass \c_xephm_a_charclass % alef \newXeTeXintercharclass \c_xephm_y_charclass % yeh -\bool_if:NT \l_xephm_ligature_bool -{ - \clist_new:N \l_xephm_ligatures_clist - \int_new:N \l_xephm_lig_names_len_int - \int_set:Nn \l_xephm_lig_names_len_int { \clist_count:N \l_xephm_lig_names_clist } - \int_step_inline:nnnn { 1 } { 2 } { \l_xephm_lig_names_len_int } - { - \int_set:Nn \l_tmpa_int { #1 } - \int_set:Nn \l_tmpb_int { \int_eval:n { \l_tmpa_int + 1 } } - \tl_set:Nf \l_tmpa_tl { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpa_int } } - \clist_set:Nx \l_tmpa_clist { { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpb_int } } } - \bool_if:nT { \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_tmpa_tl || \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_xephm_lig_default_tl } - { - \clist_put_left:Nx \l_xephm_ligatures_clist { \l_tmpa_clist } - } - } - \clist_map_inline:Nn \l_xephm_ligatures_clist - { - \seq_set_split:Nnn \l_tmpa_seq { = } { #1 } - \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl { } { } - \seq_pop_left:NN \l_tmpa_seq \l_tmpb_tl { } { } - \tl_const:cx { \tl_use:N \l_tmpb_tl } { \char"\l_tmpa_tl \ } - } -} - -\bool_if:NT \l_xephm_linebreakpenalty_bool -{ - %% Partly adapted from LaTeX2e source - \cs_new:Nn \xephm_line_break: { - \if_mode_vertical: - \GenericError{ - \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space - }{ - LaTeX Error: There’s no line here to end - }{ - See the LaTeX manual or LaTeX Companion for explanation. - }{ - Your command was ignored.\MessageBreak - Type \space I <command> <return> \space to replace it~ - with another command,\MessageBreak - or \space <return> \space to continue without it.} - \else: - \l_tmpa_skip \tex_lastskip:D - \tex_unskip:D - \tex_penalty:D -\l_xephm_line_break_penalty_int - \dim_compare:nT { \l_tmpa_skip > \c_zero_skip } - { \skip_horizontal:N \l_tmpa_skip \tex_ignorespaces:D } - \fi: +\tl_set:Nn \l_xephm_use_color_tl + { + \bool_if:NTF \l_xephm_color_bool + { + \colorlet{default}{\l_xephm_color_tl} + } + { + \colorlet{default}{.} + } + \color{default} } - \NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m } - { - \IfNoValueF {#1} - { \int_set:Nn \l_xephm_line_break_penalty_int {#1} } - \IfNoValueF {#2} - { \tl_set:Nn \l_xephm_skip_default_tl {#2} } - \xephm_put_line_breaks:n { #3 } - } - - \cs_new_protected:Nn \xephm_put_line_breaks:n - { - \tl_set:Nn \l_xephm_line_break_tl { #1 } - \regex_replace_all:nnN { ([ابپتثجحخچدذرزژسشعغصضفقطظکگلمنوهیـ])+ } { \ \0 \ \c{xephm_line_break:}\ } \l_xephm_line_break_tl - \tl_use:N \l_xephm_line_break_tl - } -} - %% Partly adapted from the code provided by David Carlisle in: %% https://tex.stackexchange.com/questions/356709/how-to-know-the-width-and-fill-the-glue-space-between-two-characters-when-using/356721#356721 \cs_new:Npn \xephm_kashida_glyph #1 { - \bool_if:NT \l_xephm_kashida_hm_fix_bool + \bool_if:NT \l_xephm_kashida_fix_bool { \c_xephm_lrm_int\tex_penalty:D 10000 \mode_leave_vertical: @@ -502,14 +533,14 @@ make time to fix. } \dim_compare:nTF { \l_xephm_diff_pos_dim == 0sp } { } - { \llap { \resizebox { \l_xephm_diff_pos_dim \tex_relax:D } { \height } { \c_xephm_ksh_int } } } + { \llap { \resizebox { \l_xephm_diff_pos_dim \tex_relax:D } { \height } { \l_xephm_use_color_tl \c_xephm_ksh_int } } } \fi: } } \cs_new:Npn \xephm_kashida_leaders #1 { - \bool_if:NT \l_xephm_kashida_hm_fix_bool + \bool_if:NT \l_xephm_kashida_fix_bool { \tl_if_eq:NNTF \l_xephm_gap_filler_tl \l_xephm_stretch_leaders_glyph_tl { @@ -521,7 +552,7 @@ make time to fix. \tl_set:Nn \l_tmpb_tl { HMX } \bool_if:nTF { \str_if_eq_p:NN { \l_xephm_font_init_tl } { \l_tmpa_tl } || \str_if_eq_p:NN { \l_xephm_font_init_tl } { \l_tmpb_tl } } { - \hbox_set:Nn \l_xephm_ksh_box { \XeTeXglyph\XeTeXglyphindex"kashida" } + \hbox_set:Nn \l_xephm_ksh_box { \l_xephm_use_color_tl \XeTeXglyph\XeTeXglyphindex"kashida" } \c_xephm_zwj_int \tex_penalty:D 10000 \tex_leaders:D \copy\l_xephm_ksh_box \skip_horizontal:n { #1 } \c_xephm_zwj_int @@ -538,10 +569,12 @@ make time to fix. %% the earlier versions of this package I made a mistake and acknowledged %% Vafa Khalighi instead of Jonathan Kew. A sincere thank you to Jonathan Kew %% for his excellent code. - \c_xephm_lrm_int\c_xephm_zwj_int\tex_penalty:D 10000 + \c_xephm_lrm_int\c_xephm_zwj_int + {\l_xephm_use_color_tl\tex_penalty:D 10000 \tex_leaders:D \tex_hrule:D height \XeTeXglyphbounds \c_xephm_two_int \int_use:N \XeTeXcharglyph \c_xephm_ksh_int depth \XeTeXglyphbounds \c_xephm_four_int \int_use:N \XeTeXcharglyph \c_xephm_ksh_int \skip_horizontal:n { #1 } + } \c_xephm_zwj_int } } @@ -581,12 +614,12 @@ make time to fix. \tl_if_eq:NNTF \l_xephm_gap_filler_tl \l_xephm_stretch_glyph_tl { \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int } { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int } } \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int } { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int } } @@ -607,12 +640,12 @@ make time to fix. } { \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \xephm_kashida_leaders \l_xephm_skip_default_tl } { \xephm_kashida_leaders \c_xephm_skip_a_tl } } \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass = { - \bool_if:NTF \l_xephm_kashida_hm_fix_bool + \bool_if:NTF \l_xephm_kashida_fix_bool { \xephm_kashida_leaders \l_xephm_skip_default_tl } { \xephm_kashida_leaders \c_xephm_skip_a_tl } } @@ -631,48 +664,253 @@ make time to fix. } } -\NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_hm_fix_bool } -\NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_hm_fix_bool } + \endinput +%</xepersian-hm-kashida-tex> +% \end{macrocode} +% +% \subsection{File: \texttt{xepersian-hm-common-kashida.tex}} +% +% \begin{macrocode} +%<*xepersian-hm-common-kashida-tex> +\ProvidesExplFile {xepersian-hm-common-kashida.tex} {2020-09-04} {1.1a} { Fixes~implementation~of~Kashida~in~xepersian~package } -\tex_let:D \KashidaOn \KashidaHMFixOn -\tex_let:D \KashidaOff \KashidaHMFixOff +\bool_if:NT \l_xephm_ligature_bool +{ + \clist_new:N \l_xephm_ligatures_clist + \int_new:N \l_xephm_lig_names_len_int + \int_set:Nn \l_xephm_lig_names_len_int { \clist_count:N \l_xephm_lig_names_clist } + \int_step_inline:nnnn { 1 } { 2 } { \l_xephm_lig_names_len_int } + { + \int_set:Nn \l_tmpa_int { #1 } + \int_set:Nn \l_tmpb_int { \int_eval:n { \l_tmpa_int + 1 } } + \tl_set:Nf \l_tmpa_tl { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpa_int } } + \clist_set:Nx \l_tmpa_clist { { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpb_int } } } + \bool_if:nT { \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_tmpa_tl || \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_xephm_lig_default_tl } + { + \clist_put_left:Nx \l_xephm_ligatures_clist { \l_tmpa_clist } + } + } + \clist_map_inline:Nn \l_xephm_ligatures_clist + { + \seq_set_split:Nnn \l_tmpa_seq { = } { #1 } + \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl { } { } + \seq_pop_left:NN \l_tmpa_seq \l_tmpb_tl { } { } + \tl_const:cx { \tl_use:N \l_tmpb_tl } { \char"\l_tmpa_tl \ } + } +} -\bool_if:NTF \l_xephm_kashida_hm_fix_bool - { - \tl_if_empty:NT \l_xephm_skip_default_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.14 em plus 0.5 em } } - } - { - \tl_set:NV \l_xephm_skip_default_tl \c_xephm_skip_a_tl +\bool_if:NT \l_xephm_linebreakpenalty_bool +{ + %% Partly adapted from LaTeX2e source + \cs_new:Nn \xephm_line_break: { + \if_mode_vertical: + \GenericError{ + \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space + }{ + LaTeX Error: There’s no line here to end + }{ + See the LaTeX manual or LaTeX Companion for explanation. + }{ + Your command was ignored.\MessageBreak + Type \space I <command> <return> \space to replace it~ + with another command,\MessageBreak + or \space <return> \space to continue without it.} + \else: + \l_tmpa_skip \tex_lastskip:D + \tex_unskip:D + \tex_penalty:D -\l_xephm_line_break_penalty_int + \dim_compare:nT { \l_tmpa_skip > \c_zero_skip } + { \skip_horizontal:N \l_tmpa_skip \tex_ignorespaces:D } + \fi: } -\ExplSyntaxOff + \NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m } + { + \IfNoValueF {#1} + { \int_set:Nn \l_xephm_line_break_penalty_int {#1} } + \IfNoValueF {#2} + { \tl_set:Nn \l_xephm_skip_default_tl {#2} } + \xephm_put_line_breaks:n { #3 } + } -\makeatletter -\newif\if@Kashida@on -%% Becuase Vafa Khalighi has copied the above code (injecting the character uni+200E) in xepersian-23.0 -%% (https://tug.org/svn/texlive/trunk/Master/texmf-dist/tex/xelatex/xepersian/kashida-xepersian.def?revision=55165&view=co), -%% the following line of code is not needed in xepersian anymore. -%% % \newif\if@Kashida@XB@fix -\makeatother + \cs_new_protected:Nn \xephm_put_line_breaks:n + { + \tl_set:Nn \l_xephm_line_break_tl { #1 } + \regex_replace_all:nnN { ([ابپتثجحخچدذرزژسشعغصضفقطظکگلمنوهیـ])+ } { \ \0 \ \c{xephm_line_break:}\ } \l_xephm_line_break_tl + \tl_use:N \l_xephm_line_break_tl + } +} \endinput -%</kashida-xepersian-hm-def> -% \end{macrocode} +%</xepersian-hm-common-kashida-tex> +% \end{macrocode} +% +% \section{Acknowledgments} +% In the first place I have to thank Donald Knuth for inventing TeX. +% During the development of this package I refered to Stack Exchange network of +% question-and-answer (Q\&A) websites to solve problems for which I am grateful. +% I also would like to thank the developer teams of TeX's friends especially LaTeX, LuaTeX and XeTeX teams. % -% \section*{Acknowledgements} +% \section{Change History} +% +% \def\SubSecItem#1{\subsubsection*{\hskip 2em\large #1}\addcontentsline{toc}{subsection}{[#1]}} +% \newenvironment{Itemize}{\begin{itemize}[leftmargin=4em]}{\end{itemize}} +% +% \SubSecItem{2020-03-17~v0.1} +% \begin{Itemize} +% \item First standalone version. +% \end{Itemize} +% +% \SubSecItem{2020-03-19~v0.2} +% \begin{Itemize} +% \item Some minor changes. +% \end{Itemize} +% +% \SubSecItem{2020-03-23~v0.3} +% \begin{Itemize} +% \item Added documentation +% \end{Itemize} +% +% \SubSecItem{2020-03-26~v0.4} +% \begin{Itemize} +% \item Added DTX and INS files +% \end{Itemize} +% +% \SubSecItem{2020-04-20~v0.5a} +% \begin{Itemize} +% \item Added Kashida=glyph to the package options +% \item Added \bslash discouragebadlinebreaks to prevent bad line breaks in a text (less than a paragragraph). +% \end{Itemize} +% +% \SubSecItem{2020-04-26~v0.5b} +% \begin{Itemize} +% \item If the kashida glyph is used to stretch the text, then the main font is checked for availability of the kashida character. +% \item Two optional arguments added in \bslash discouragebadlinebreaks macro. +% \end{Itemize} +% +% \SubSecItem{2020-05-01~v0.5c} +% \begin{Itemize} +% \item The documentation is divided into two parts: User documentation and Source code documentation. +% \item The example file is divided into two parts: An example for the option Kashida=glyph and the other one for Kashida=hrule. +% \end{Itemize} +% +% \SubSecItem{2020-05-07~v0.5d} +% \begin{Itemize} +% \item Added a new section to the user documentation titled: Brief outline of the issues. +% \item An error is trigerred if the value of Kashida option is not specified. +% \end{Itemize} +% +% \SubSecItem{2020-05-12~v0.5e} +% \begin{Itemize} +% \item Disturbance of ligatures caused by activation of kashida is fixed. +% \end{Itemize} +% +% \SubSecItem{2020-05-20~v0.5f} +% \begin{Itemize} +% \item Reduced the length of items created by zref package in \bslash jobname.aux file. +% \item If the option Kashida=glyph is used, a warning message is added to the log file +% which emphasizes that the option is experimental. +% \end{Itemize} +% +% \SubSecItem{2020-05-31~v1.0a} +% \begin{Itemize} +% \item The option 'Kashida=hrule' is changed to 'Kashida=leaders+hrule'. +% \item The option 'Kashida=leaders+glyph' is added. Since with this option kashida glyph +% leaders are used to stretch the text, nothing is saved in .aux files. +% \end{Itemize} +% +% \SubSecItem{2020-06-04~v1.0b} +% \begin{Itemize} +% \item Added two options Kashida=On and Kashida=Off. +% \end{Itemize} +% +% \SubSecItem{2020-07-20~v1.0c} +% \begin{Itemize} +% \item Fixed the problem with the option ligatures=default. +% \end{Itemize} +% +% \SubSecItem{2020-08-05~v1.0d} +% \begin{Itemize} +% \item In the new version of LaTeX3, the name of some of the XeTeX control sequences has changed. +% These changes are applied in this version of xepersion-hm. +% \end{Itemize} % -% Todo +% \SubSecItem{2020-09-04~v1.1a} +% \begin{Itemize} +% \item Added the color option. +% \item Added a few sections to the User Documentation. +% \item Split the file containing kashida code. +% \end{Itemize} % -% \section*{Change History} +% \section*{To Do's} % -% Todo +% To do % -% \section*{References} +% \renewcommand{\refname}{References: \\ {\normalsize\it(Actually, this is not a ``References'' nor a ``Literature'', but the most important +% although not a complete list of ``Resources Used'' to develop this package.)}} % -% Todo +% \begin{thebibliography}{9} % -% \section*{Index} +% \bibitem{DEK-TTB} Donald E. Knuth, +% \emph{The \hologo{TeX} book}, +% Addison-Wesley, 1986. % -% Todo +% \bibitem{VE-TBT} Victor Eijkhout, +% \emph{\hologo{TeX} BY TOPIC}, +% Addison-Wesley, 2013. % +% \bibitem{PWA-KAH-KB-TFI} Paul W. Abrahams, Kathryn A. Hargreaves, and Karl Berry, +% \emph{\hologo{TeX} for the Impatient}, +% Addison-Wesley, 2013. +% +% \bibitem{LL-LADPS} Leslie Lamport, +% \emph{\hologo{LaTeX}, A document preparation System}, +% Addison-Wesley, 1986. +% +% \bibitem{FM-MG-JB-DC-CR-TLC} Frank Mittelbach and Michel Goossens with Johannes Braams, David Carlisle, and Chris Rowley, +% \emph{The \hologo{LaTeX} Companion}, +% Addison-Wesley, second edition, 2004. +% +% \bibitem{TLT-TLS} Package \texttt{latex}: The LaTeX Team, +% \emph{The \hologo{LaTeX2e} Sources}, +% \href{http://mirrors.ctan.org/macros/latex/base/source2e.pdf}{\texttt{CTAN:macros/latex/base/source2e.pdf}}, 2020-02-02 +% +% \bibitem{TL3T-TLS} Package \texttt{l3kernel}: The LaTeX3 Team, +% \emph{The \hologo{LaTeX}3 Sources}, +% \href{http://mirrors.ctan.org/macros/latex/contrib/l3kernel/source3.pdf}{\texttt{CTAN:macros/latex/contrib/l3kernel/source3.pdf}}, 2020-07-17 +% +% \bibitem{TL3T-TLI} Package \texttt{l3kernel}: The LaTeX3 Team, +% \emph{The \hologo{LaTeX}3 Interfaces}, +% \href{http://mirrors.ctan.org/macros/latex/contrib/l3kernel/interface3.pdf}{\texttt{CTAN:macros/latex/contrib/l3kernel/interface3.pdf}}, 2020-07-17 +% +% \bibitem{WR-KH-KB-XRG} Package \texttt{xetexref}: Will Robertson, Khaled Hosny, and Karl Berry, +% \hologo{XeTeX} reference guide, +% \href{http://mirrors.ctan.org/info/xetexref/xetex-reference.pdf}{\texttt{CTAN:info/xetexref/xetex-reference.pdf}}, 2019-12-09 +% +% \bibitem{JQ-AX} Package \texttt{xetex}: Jonathan Kew, +% About \hologo{XeTeX}, +% \href{http://mirrors.ctan.org/systems/doc/xetex/XeTeX-notes.pdf}{\texttt{CTAN:systems/doc/xetex/XeTeX-notes.pdf}}, 2005-10-17 +% +% \bibitem{NG-TXC} Package \texttt{xetex}: Michel Goossens, +% The \hologo{XeTeX} Companion, +% \href{http://xml.web.cern.ch/XML/lgc2/xetexmain.pdf}{\texttt{http://xml.web.cern.ch/XML/lgc2/xetexmain.pdf}}, 2009-08-19 +% +% \bibitem{TEX-STACKEXCHANGE} Website: Stack Exchange: Hot Questions, +% \hologo{TeX}-\hologo{LaTeX} Q\&A for users of TeX, LaTeX, ConTeXt, and related typesetting systems, +% \href{https://tex.stackexchange.com}{\texttt{tex.stackexchange.com}} +% +% \end{thebibliography} +% +%\end{implementation} +% +% \ifluatex +% \immediate\directlua{os.execute([[ makeindex -s gind.ist -o \jobname.ind \jobname.idx ]])} +% \immediate\directlua{os.execute([[ makeindex -s gglo.ist -o \jobname.gls \jobname.glo ]])} +% \fi +% \ifxetex +% \immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} +% \immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} +% \fi +% \PrintIndex +% %\PrintChanges % \Finale diff --git a/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins b/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins index cba9853ea9b..7b513e4a453 100644 --- a/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins +++ b/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins @@ -11,8 +11,7 @@ this license is at: http://www.latex-project.org/lppl.txt \fi \let\jobname\relax -% \input l3docstrip.tex -\input docstrip.tex +\input l3docstrip.tex \askforoverwritefalse \preamble @@ -31,10 +30,18 @@ this license is at: http://www.latex-project.org/lppl.txt \keepsilent \generate{\file{xepersian-hm.sty} {\from{xepersian-hm.dtx} {xepersian-hm-sty}}} + \nopreamble +\nopostamble + \generate{\file{README.txt} {\from{xepersian-hm.dtx} {README-txt}}} + \usepreamble\defaultpreamble -\generate{\file{kashida-xepersian-hm.def} {\from{xepersian-hm.dtx} {kashida-xepersian-hm-def}}} +\usepostamble\defaultpostamble + +\generate{\file{xepersian-hm-kashida.tex} {\from{xepersian-hm.dtx} {xepersian-hm-kashida-tex}}} + +\generate{\file{xepersian-hm-common-kashida.tex} {\from{xepersian-hm.dtx} {xepersian-hm-common-kashida-tex}}} \obeyspaces \Msg{******************************************************} diff --git a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty index 0911eb29982..cb1f50f3648 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty @@ -29,9 +29,11 @@ \RequirePackage{l3keys2e} \RequirePackage{graphicx}[2019-11-30] \RequirePackage{zref-savepos}[2020-03-03] +\RequirePackage{xcolor}[2016/05/11] \RequirePackage{xepersian} -\ExplSyntaxOn -\ProvidesExplPackage {xepersian-hm} {2020-08-05} {1.0d} { Fixes~issues~in~xepersian~package } +\ProvidesExplPackage {xepersian-hm} {2020-09-04} {1.1a} { Fixes~issues~in~xepersian~package } + +\def\XePersianHM{XePersianHM} \box_new:N \l_xephm_ksh_box @@ -39,8 +41,8 @@ \int_const:Nn \c_xephm_lrm_int {"200E} % left-right-mark \int_const:Nn \c_xephm_zwj_int {"200D} % zero-width joiner -\int_const:Nn \c_xephm_two_int {2} % 2 -\int_const:Nn \c_xephm_four_int {4} % 4 +\int_const:Nn \c_xephm_two_int {2} +\int_const:Nn \c_xephm_four_int {4} \tl_const:Nn \c_xephm_skip_a_tl { 0 em plus 0.5 em } \tl_const:Nn \c_xephm_skip_b_tl { 0.14 em plus 5.5 em } @@ -71,11 +73,17 @@ \tl_new:N \l_xephm_gap_filler_tl +\tl_new:N \l_xephm_use_color_tl +\tl_new:N \l_xephm_color_tl +\tl_new:N \l_xephm_color_rgb_tl + \dim_new:N \l_xephm_diff_pos_dim -\bool_set_false:N \l_xephm_kashida_hm_fix_bool +\bool_set_false:N \l_xephm_kashida_fix_bool + \bool_set_false:N \l_xephm_ligature_bool \bool_set_false:N \l_xephm_linebreakpenalty_bool +\bool_set_false:N \l_xephm_color_bool \int_set:Nn \l_xephm_min_penalty_int { 0 } \int_set:Nn \l_xephm_low_penalty_int { 8 } @@ -130,6 +138,8 @@ \tl_set:Nn \l_xephm_lig_rlig_tl { rlig } % Required Ligatures \tl_set:Nn \l_xephm_lig_default_tl { default } +\tl_set:Nn \l_xephm_col_default_tl { magenta } + \clist_set:Nn \l_xephm_lig_aalt_clist { } % Access All Alternatives \clist_set:Nn \l_xephm_lig_ccmp_clist { } % Glyph Composition/Decomposition \clist_set:Nn \l_xephm_lig_dlig_clist { FDF2 = الله , FDF3 = اکبر , FDFB = جلجلاله } % Discretionary Ligatures @@ -199,33 +209,28 @@ \tl_set:Nx \l_xephm_main_font_full_tl { \tex_fontname:D \tex_the:D \tex_font:D } \tl_set:Nx \l_xephm_main_font_name_tl { \l_xephm_main_font_full_tl } \regex_replace_once:nnN { ^"([^/]+)/.* } { \1 } \l_xephm_main_font_name_tl - \int_set:Nn \l_xephm_kashida_slot_int { \XeTeXcharglyph \c_xephm_ksh_int } - \int_compare:nT { \l_xephm_kashida_slot_int = \c_zero_int } - { - \msg_error:nnx { xepersian-hm } { error-kashida-character-is-not-available-in-the-main-font } { \l_xephm_main_font_name_tl } - } } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_leaders_glyph_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_glyph_tl } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_leaders_hrule_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_hrule_tl } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_off_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_off_tl } - \bool_set_false:N \l_xephm_kashida_hm_fix_bool + \bool_set_false:N \l_xephm_kashida_fix_bool } \l_xephm_stretch_on_tl { \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_glyph_tl } - \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \bool_set_true:N \l_xephm_kashida_fix_bool } } { } { \tl_set:Nx \l_xephm_gap_filler_tl { #1 } } \tl_if_empty:NT \l_xephm_gap_filler_tl { \msg_error:nn { xepersian-hm } { error-specify-value-for-kashida-option } } @@ -302,16 +307,48 @@ \bool_set_true:N \l_xephm_ligature_bool } , ligatures .default:n = \tl_set:Nn \l_xephm_active_ligs_tl { \l_xephm_lig_default_tl } , + + color .code:n = + { + \tl_set:Nn \l_tmpa_tl { #1 } + \tl_if_empty:NTF \l_tmpa_tl + { + \tl_set:Nx \l_xephm_color_tl { \l_xephm_col_default_tl } + } + { + \tl_set:Nx \l_xephm_color_tl { \l_tmpa_tl } + } + \bool_set_true:N \l_xephm_color_bool + } , + } \ProcessKeysOptions { xepersian-hm } -\bool_if:NT \l_xephm_kashida_hm_fix_bool +\bool_if:NTF \l_xephm_kashida_fix_bool + { + \tex_input:D { xepersian-hm-kashida.tex } + + \NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_fix_bool } + \NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_fix_bool } + + \tex_let:D \KashidaOn \KashidaHMFixOn + \tex_let:D \KashidaOff \KashidaHMFixOff + + \tl_if_empty:NT \l_xephm_skip_default_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.14 em plus 0.5 em } } + } { - \tex_input:D { kashida-xepersian-hm.def } + \tl_set:NV \l_xephm_skip_default_tl \c_xephm_skip_a_tl } -\ExplSyntaxOff +\makeatletter +\newif\if@Kashida@on +%% Becuase Vafa Khalighi has copied the above code (injecting the character uni+200E) in xepersian-23.0 +%% (https://tug.org/svn/texlive/trunk/Master/texmf-dist/tex/xelatex/xepersian/kashida-xepersian.def?revision=55165&view=co), +%% the following line of code is not needed in xepersian anymore. +%% % \newif\if@Kashida@XB@fix +\makeatother + \endinput %% %% |