summaryrefslogtreecommitdiff
path: root/macros/xetex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-21 03:02:38 +0000
committerNorbert Preining <norbert@preining.info>2020-04-21 03:02:38 +0000
commit8731cc5ad70723b9a155917df509d857579c355d (patch)
treef6594e2b25c3e0aaf4838d7ada0e8885af3fd532 /macros/xetex
parent2a6dafa8ee740f345650d6a697665bf85a57cc77 (diff)
CTAN sync 202004210302
Diffstat (limited to 'macros/xetex')
-rw-r--r--macros/xetex/latex/resumecls/Makefile17
-rw-r--r--macros/xetex/latex/resumecls/README.md14
-rw-r--r--macros/xetex/latex/resumecls/example/Makefile10
-rw-r--r--macros/xetex/latex/resumecls/example/README.md14
-rw-r--r--macros/xetex/latex/resumecls/example/resume-en.pdfbin24081 -> 25042 bytes
-rw-r--r--macros/xetex/latex/resumecls/example/resume-en.tex16
-rw-r--r--macros/xetex/latex/resumecls/example/resume-zh.pdfbin61067 -> 68834 bytes
-rw-r--r--macros/xetex/latex/resumecls/example/resume-zh.tex16
-rw-r--r--macros/xetex/latex/resumecls/resumecls.dtx9
-rw-r--r--macros/xetex/latex/resumecls/resumecls.pdfbin67113 -> 66700 bytes
-rw-r--r--macros/xetex/latex/xepersian-hm/README.txt5
-rw-r--r--macros/xetex/latex/xepersian-hm/kashida-example.pdfbin17991 -> 81522 bytes
-rw-r--r--macros/xetex/latex/xepersian-hm/kashida-example.tex75
-rw-r--r--macros/xetex/latex/xepersian-hm/xepersian-hm.dtx566
-rw-r--r--macros/xetex/latex/xepersian-hm/xepersian-hm.pdfbin52190 -> 62986 bytes
15 files changed, 518 insertions, 224 deletions
diff --git a/macros/xetex/latex/resumecls/Makefile b/macros/xetex/latex/resumecls/Makefile
index 00d76be301..dff99d44cd 100644
--- a/macros/xetex/latex/resumecls/Makefile
+++ b/macros/xetex/latex/resumecls/Makefile
@@ -3,7 +3,7 @@
# | Author: huxuan
# | E-mail: i(at)huxuan.org
# | Created: 2012-12-18
-# | Last modified: 2020-04-16
+# | Last modified: 2020-04-20
# | Description:
# | Makefile for resumecls
# |
@@ -12,7 +12,7 @@
PACKAGE=resumecls
-.PHONY: all cls doc clean distclean dist
+.PHONY: all cls doc dist clean distclean
all: doc
@@ -34,7 +34,13 @@ $(PACKAGE).pdf: $(PACKAGE).cls
xelatex $(PACKAGE).dtx
xelatex $(PACKAGE).dtx
-# clean & distclean
+# dist & clean
+
+dist: distclean cls doc
+ mv $(PACKAGE).cls example/
+ cd example && make dist
+ cd .. && find $(PACKAGE) -name '*.pdf' | tar zcvf $(PACKAGE).tar.gz \
+ -T - --exclude-vcs --exclude-vcs-ignores $(PACKAGE)
clean:
-@rm -f \
@@ -56,8 +62,3 @@ distclean: clean
*.cls \
*.pdf \
*.tar.gz
-
-dist: distclean cls doc
- touch $(PACKAGE).tar.gz
- tar zcvf $(PACKAGE).tar.gz *.pdf --exclude=$(PACKAGE).tar.gz \
- --exclude-vcs --exclude-vcs-ignores .
diff --git a/macros/xetex/latex/resumecls/README.md b/macros/xetex/latex/resumecls/README.md
index 16be555bfb..7fb713493e 100644
--- a/macros/xetex/latex/resumecls/README.md
+++ b/macros/xetex/latex/resumecls/README.md
@@ -2,7 +2,13 @@
A LaTeX document class to typeset a resume or cv both in English and Chinese with more ease and flexibility.
-## Installation
+## Online Preview & Edit (with Overleaf Template)
+
+An overleaf template is available [here](https://www.overleaf.com/latex/templates/resumecls-example/xncvhkjgyjvf) for preview.
+
+You can also edit it directly on the overleaf.
+
+## Installation (for Offline Usage)
Since [`resumecls`](http://www.ctan.org/pkg/resumecls) is included in the CTAN.
You can install it by any package managers.
@@ -17,11 +23,11 @@ tlmgr install resumecls
please refer to [`resumecls-example`](https://github.com/huxuan/resumecls-example).
-## Compile manually
+## Offline Compile
To get the document class file and document manually, you can compile via Makefile or LaTeX commands.
-### Compile by Makefile
+### Makefile
#### Get resumecls.cls
```shell
@@ -43,7 +49,7 @@ make clean
make distclean
```
-### Compile by LaTeX commands
+### LaTeX
#### Get resumecls.cls
```shell
diff --git a/macros/xetex/latex/resumecls/example/Makefile b/macros/xetex/latex/resumecls/example/Makefile
index 01be9090da..4c49977fdd 100644
--- a/macros/xetex/latex/resumecls/example/Makefile
+++ b/macros/xetex/latex/resumecls/example/Makefile
@@ -3,14 +3,14 @@
# | Author: huxuan
# | E-mail: i(at)huxuan.org
# | Created: 2012-12-18
-# | Last modified: 2020-04-16
+# | Last modified: 2020-04-20
# | Description:
# | Makefile for resumecls examples
# |
# | Copyrgiht (c) 2012-2020 by huxuan. All rights reserved.
# +-----------------------------------------------------------------------------
-.PHONY: resume resume-zh resume-en clean depclean
+.PHONY: resume resume-zh resume-en dist clean distclean
RESUME=resume
RESUMEZH=resume-zh
@@ -44,7 +44,9 @@ $(RESUMEEN).bbl: $(RESUME).bib
xelatex $(RESUMEEN).tex
-bibtex $(RESUMEEN)
-# clean & depclean
+# dist & clean
+
+dist: distclean resume
clean:
-@rm -f \
@@ -55,6 +57,6 @@ clean:
*.log \
*.out
-depclean: clean
+distclean: clean
-@rm -f \
*.pdf
diff --git a/macros/xetex/latex/resumecls/example/README.md b/macros/xetex/latex/resumecls/example/README.md
index 07c17e5b17..4531a5933c 100644
--- a/macros/xetex/latex/resumecls/example/README.md
+++ b/macros/xetex/latex/resumecls/example/README.md
@@ -1,21 +1,23 @@
# resumecls-example
-Examples to typeset resume both in Chinese and English with resumecls.
+Examples to typeset resume both in Chinese and English with [resumecls](https://ctan.org/pkg/resumecls).
-## Preview
+## Online Preview & Edit (with Overleaf Template)
-An online version for preview is available on [overleaf](https://www.overleaf.com/read/yrtmzwhtzwtz).
+An overleaf template is available [here](https://www.overleaf.com/latex/templates/resumecls-example/xncvhkjgyjvf) for preview.
-## Workflow
+You can also edit it directly on the overleaf.
+
+## Offline Usage
```shell
git clone git://github.com/huxuan/resumecls-example.git
cd resumecls-example
# Modify resume-en.tex resume-en.tex resume.bib (bib is optional).
-# Compile via Makefile or LaTeX command (More info below).
+# Compile via Makefile or LaTeX commands (More info below).
```
-## Compile
+## Offline Compile
### Makefile
diff --git a/macros/xetex/latex/resumecls/example/resume-en.pdf b/macros/xetex/latex/resumecls/example/resume-en.pdf
index 6df6d32a8a..115519030f 100644
--- a/macros/xetex/latex/resumecls/example/resume-en.pdf
+++ b/macros/xetex/latex/resumecls/example/resume-en.pdf
Binary files differ
diff --git a/macros/xetex/latex/resumecls/example/resume-en.tex b/macros/xetex/latex/resumecls/example/resume-en.tex
index 899fa8cb0c..e14b37ee1e 100644
--- a/macros/xetex/latex/resumecls/example/resume-en.tex
+++ b/macros/xetex/latex/resumecls/example/resume-en.tex
@@ -4,7 +4,7 @@
% | Author: huxuan
% | E-mail: i(at)huxuan.org
% | Created: 2012-12-18
-% | Last modified: 2020-04-16
+% | Last modified: 2020-04-20
% | Description:
% | A English Resume Example in LaTeX based on resumecls
% |
@@ -27,7 +27,7 @@
\begin{table}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\heading{Experience (Compacted version)}
+\heading{Experience (Compact Version)}
\entry{0em}{Xlr}{{\bfseries Organization} \quad Department & Position & Time Period}
\entry{2em}{X}{%
Description1 \\
@@ -83,9 +83,19 @@
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If there is no publications, just comment this part.
-\heading{Appendix: Publications}
+\heading{Publications}
\vspace{-6em}
\bibliography{resume}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Sample for two or more pages.
+\end{table}
+\clearpage
+\begin{table}
+\heading{Heading for Page 2}
+\entry{0em}{X}{
+ Each page is enclosed inside a table environment. \\
+ \verb|\clearpage| between the tables will lead to a new page. \\
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{table}
\end{document}
diff --git a/macros/xetex/latex/resumecls/example/resume-zh.pdf b/macros/xetex/latex/resumecls/example/resume-zh.pdf
index d492d9efaa..676da72ba0 100644
--- a/macros/xetex/latex/resumecls/example/resume-zh.pdf
+++ b/macros/xetex/latex/resumecls/example/resume-zh.pdf
Binary files differ
diff --git a/macros/xetex/latex/resumecls/example/resume-zh.tex b/macros/xetex/latex/resumecls/example/resume-zh.tex
index b778648bc3..cc272e2c56 100644
--- a/macros/xetex/latex/resumecls/example/resume-zh.tex
+++ b/macros/xetex/latex/resumecls/example/resume-zh.tex
@@ -4,7 +4,7 @@
% | Author: huxuan
% | E-mail: i(at)huxuan.org
% | Created: 2012-12-18
-% | Last modified: 2020-04-16
+% | Last modified: 2020-04-20
% | Description:
% | A Chinese Resume Example in LaTeX based on resumecls
% |
@@ -82,10 +82,20 @@
标签2 & 标签对应内容 \\
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% 如果不需要发表成果,注释这一段即可
-\heading{附:发表成果}
+% 如果不需要发表成果,注释这一段即可。
+\heading{发表成果}
\vspace{-6em}
\bibliography{resume}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 两页或者多页的示例。
+\end{table}
+\clearpage
+\begin{table}
+\heading{第二页小标题}
+\entry{0em}{X}{
+ 每个页面都包含在一个 table 环境中。 \\
+ 表格之间的 \verb|\clearpage| 会新建一个页面。 \\
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{table}
\end{document}
diff --git a/macros/xetex/latex/resumecls/resumecls.dtx b/macros/xetex/latex/resumecls/resumecls.dtx
index a71405307a..e8ce58498b 100644
--- a/macros/xetex/latex/resumecls/resumecls.dtx
+++ b/macros/xetex/latex/resumecls/resumecls.dtx
@@ -27,7 +27,7 @@
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesClass{resumecls}
%<*class>
- [2020/04/16 v0.4.0 Hello 2020]
+ [2020/04/20 v0.4.1 Minor fix with enhanced examples]
%</class>
%
%<*driver>
@@ -110,6 +110,7 @@
% \changes{v0.3.1}{2015/09/20}{Compatible with TeXLive 2015 now}
% \changes{v0.3.2}{2015/09/21}{Welcome, contributors}
% \changes{v0.4.0}{2020/04/16}{Hello 2020}
+% \changes{v0.4.1}{2020/04/20}{Minor fix with enhanced examples}
%
% \GetFileInfo{\jobname.dtx}
%
@@ -359,8 +360,8 @@
%
% Since the document generated from \resumecls is just a bunch of tables, it is
% prettey straightfoward to enclose the contents in multiple table environments
-% and use |\newpage| to split them into multiple pages. A minimal example looks
-% like the following:
+% and use |\clearpage| to split them into multiple pages. A minimal example
+% looks like the following:
%
% \iffalse
%<*lst>
@@ -369,7 +370,7 @@
\begin{table}
Contents for Page 1
\end{table}
-\newpage
+\clearpage
\begin{table}
Contents for Page 2
\end{table}
diff --git a/macros/xetex/latex/resumecls/resumecls.pdf b/macros/xetex/latex/resumecls/resumecls.pdf
index 6d9adc5753..85cd70b4f2 100644
--- a/macros/xetex/latex/resumecls/resumecls.pdf
+++ b/macros/xetex/latex/resumecls/resumecls.pdf
Binary files differ
diff --git a/macros/xetex/latex/xepersian-hm/README.txt b/macros/xetex/latex/xepersian-hm/README.txt
index e9df949970..d243aaf7f5 100644
--- a/macros/xetex/latex/xepersian-hm/README.txt
+++ b/macros/xetex/latex/xepersian-hm/README.txt
@@ -23,8 +23,9 @@ package fixes these problems.
The file `texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex' can be used as
a simple example of the usage of the package.
-Any comments or suggestions would be gratefully appreciated.
-Please report any bugs or issues to `dma8hm1334@gmail.com'.
+Please use the Bitbucket issue tracker:
+https://bitbucket.org/dma8hm1334/xepersian-hm/issues
+to report a bug, request 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
diff --git a/macros/xetex/latex/xepersian-hm/kashida-example.pdf b/macros/xetex/latex/xepersian-hm/kashida-example.pdf
index 0579becb84..7856b99746 100644
--- a/macros/xetex/latex/xepersian-hm/kashida-example.pdf
+++ b/macros/xetex/latex/xepersian-hm/kashida-example.pdf
Binary files differ
diff --git a/macros/xetex/latex/xepersian-hm/kashida-example.tex b/macros/xetex/latex/xepersian-hm/kashida-example.tex
index d3492c93ef..bd6e403c09 100644
--- a/macros/xetex/latex/xepersian-hm/kashida-example.tex
+++ b/macros/xetex/latex/xepersian-hm/kashida-example.tex
@@ -1,32 +1,77 @@
% \PassOptionsToPackage{Kashida=off,RTLdocument=on}{xepersian} % Load xepersian with a few options
\documentclass{report}
-\usepackage{xcolor}
-% \usepackage[Kashida]{xepersian} % Fails
-\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
+% \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,Colour=darkgray]{HM XKayhan}
+\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=teal]{XB Kayhan}
-\setlatintextfont[Scale=2.5,Colour=teal]{HM XKayhan}
+% \setlatintextfont[Scale=2.5,Colour=0000FF]{XB Kayhan}
+\setlatintextfont[Scale=1.5,Colour=0000FF]{HM XKayhan}
-\def\SampleText{راهی جایی تابی چاپی چاههی تلاشهایی شتابهایی تابی چاپی راهی تلاشهــایی که کتابهایی که کلاههایی که}
+\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}
+
+\def\SampleText{\discouragebadlinebreaks{
+ راهی جایی تابی چاپی چاههی تلاشهایی
+ شتابهایی تابی چاپی راهی تلاشهــایی
+ که کتابهایی که کلاههایی که کتابهایی }}
\setlength\parindent{0pt}
\pagestyle{empty}
+
\begin{document}
-\color{red}
-\KashidaOff \SampleText \lr{(Kashida Off)~}
+\KashidaOff\lr{(Kashida Off, Regular)}
-\KashidaOn \SampleText \lr{(Kashida On)~}
+\SampleText
-\end{document}
+\newpage
+
+\KashidaOn\lr{(Kashida On, Regular)}
+
+\SampleText
+
+\newpage
+
+\KashidaOn\lr{(Kashida On, Italic)}
+
+{\HMXKayhanIt \SampleText}
+
+\newpage
+\KashidaOn\lr{(Kashida On, Oblique)}
+
+{\HMXKayhanOb \SampleText}
+
+\newpage
+
+\KashidaOn\lr{(Kashida On, Outline)}
+
+{\HMXKayhanOl \SampleText}
+
+\newpage
+
+\KashidaOn\lr{(Kashida On, Shadow)}
+
+{\HMXKayhanSd \SampleText}
+
+\end{document}
diff --git a/macros/xetex/latex/xepersian-hm/xepersian-hm.dtx b/macros/xetex/latex/xepersian-hm/xepersian-hm.dtx
index 72cbc1d028..6a7d84f07e 100644
--- a/macros/xetex/latex/xepersian-hm/xepersian-hm.dtx
+++ b/macros/xetex/latex/xepersian-hm/xepersian-hm.dtx
@@ -15,8 +15,9 @@ package fixes these problems.
The file `texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex' can be used as
a simple example of the usage of the package.
-Any comments or suggestions would be gratefully appreciated.
-Please report any bugs or issues to `dma8hm1334@gmail.com'.
+Please use the Bitbucket issue tracker:
+https://bitbucket.org/dma8hm1334/xepersian-hm/issues
+to report a bug, request 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
@@ -34,13 +35,6 @@ which I cannot make time to fix.
% version 1.3c or higher (your choice). The latest version of
% this license is at: http://www.latex-project.org/lppl.txt
%
-% \iffalse
-%<kashida-xepersian-hm>
-%<kashida-xepersian-hm>% Copyright notice: the following code is partly adapted from the code in
-%<kashida-xepersian-hm>% 'kashida-xepersian.def' from xepersian package (v22.8).
-%<kashida-xepersian-hm>
-% \fi
-%
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
@@ -61,6 +55,7 @@ which I cannot make time to fix.
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
+\usepackage{longtable}
\usepackage{hypdoc}
\addtolength{\hoffset}{-10mm}
\begin{document}
@@ -70,24 +65,24 @@ which I cannot make time to fix.
% \fi
%
% \title{^^A
-% The \textsf{xepersian-hm} package\\ Fixes issues in xepersian package^^A
+% The \textsf{xepersian-hm} package\\Fixing kashida in xepersian^^A
% }
-%
+%
% \author{^^A
% Hossein Movahhedian\thanks
% {^^A
% E-mail:
% \href{mailto:dma8hm1334@gmail.com}
-% {dma8hm1334@gmail.com}^^A
+% {\textsf{dma8hm1334@gmail.com}}
% }^^A
% }
-%
-% \date{Released 2020-03-26}
-%
-% \maketitle
-%
+%
+% \date{Released 2020-04-20 \qquad v0.5a}
+%
% \begin{documentation}
-%
+%
+% \maketitle
+%
% Kashida feature in \textsf{xepersian} has problems with some fonts such as \texttt{HM Series}
% fonts available at
% \href{https://dma8hm1334.bitbucket.io}{\texttt{https://dma8hm1334.bitbucket.io}}
@@ -98,16 +93,19 @@ which I cannot make time to fix.
% The file \texttt{texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex} can be
% used as a simple example of the usage of the package.
%
-% Any comments or suggestions would be gratefully appreciated.
-% Please report any bug or issue to \href{mailto:dma8hm1334@gmail.com}{\textsf{dma8hm1334@gmail.com}}.
+% Please use the Bitbucket issue tracker:
+% \href{https://bitbucket.org/dma8hm1334/xepersian-hm/issues}{\textsf{https://bitbucket.org/dma8hm1334/xepersian-hm/issues}}
+% to report a bug, request 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.
%
+% \section{Package loading and options}
+%
% Please note that \textsf{xepersian-hm} loads \textsf{xepersian} automatically,
% so you may only pass options to the package using the command
-% \verb|\PassOptionsToPackage| before \verb|\documentclass|, for example:
+% \verb|\PassOptionsToPackage| before \verb|\documentclass|. For example:
%
% \begin{verbatim}
% \PassOptionsToPackage{Kashida=off,RTLdocument=on}{xepersian}
@@ -118,15 +116,33 @@ which I cannot make time to fix.
%
% The options available in \textsf{xepersian-hm} are:
% \begin{itemize}
-% \item \texttt{Kashida}: with two possible values, \texttt{on} which enables
-% \texttt{Kashida} feature and \texttt{off} which disables that feature. For
-% example \texttt{Kashida=on} enables \texttt{Kashida} feature.
+% \item \texttt{Kashida}: which implements kashida feature with two possible values:
+% \begin{itemize}
+% \item \texttt{glyph}: which uses the \texttt{Kashida} character to stretch the text.
+% 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.
+% \item \texttt{hrule}: which uses a horizontal rule (\verb|\hrule|) to stretch the text.
+% \end{itemize}
+% For example \texttt{Kashida=glyph} inserts a stretched \texttt{Kashida} glyph where ever it is needed.
+% \item \texttt{linebreakpenalty}: which specifies the amount of penalty for preventing bad line-breaking.
+% You may strictly specify the value of this option. For example \texttt{'linebreakpenalty=8'} or you
+% may use the default values. The available default values of penalties which are put into the
+% horizontal list output are the negative of the followings:
+%
+% \begin{longtable}{ll}
+% \texttt{min}: & \texttt{0} \\
+% \texttt{low}: & \texttt{8} \\
+% \texttt{medium}: & \texttt{15} \\
+% \texttt{high}: & \texttt{25} \\
+% \texttt{max}: & \texttt{10000} \\
+% \end{longtable}
+%
% \item \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
% may use the default values. The available default values are:
%
-% \begin{tabular}{ll}
+% \begin{longtable}{lll}
% \texttt{kayhan} & \texttt{0.14 em plus 0.5 em} \\
% \texttt{khorramshahr} & \texttt{0.131 em plus 0.5 em} \\
% \texttt{kayhannavaar} & \texttt{0.129 em plus 0.5 em} \\
@@ -158,11 +174,20 @@ which I cannot make time to fix.
% \texttt{ziba} & \texttt{0.119 em plus 0.5 em} \\
% \texttt{default} & \texttt{0.14 em plus 0.5 em} \\
% \texttt{noskip} & \texttt{0 em plus 0.5 em}
-% \end{tabular}
+% \end{longtable}
%
% For example: \mbox{\texttt{'kashidastretch=titr'}} is equivalent to\linebreak
% \mbox{\texttt{'kashidastretch=0.12 em plus 0.5 em'}}
% \end{itemize}
+%
+% \section{Commands}
+%
+% \begin{description}
+% \item \verb|\discouragebadlinebreaks{|{\it text}\verb|}| {\it text} may not contain paragraph breaks.
+% This command puts a penalty after each Persian word.
+% The value of the penalty is set by the option \texttt{linebreakpenalty}.
+% The default value is 8.
+% \end{description}
%
% \end{documentation}
%
@@ -178,85 +203,133 @@ which I cannot make time to fix.
%
% \begin{macrocode}
\RequirePackage{l3keys2e}
+\RequirePackage{graphicx}[2019-11-30]
+\RequirePackage{zref-savepos}[2020-03-03]
\RequirePackage{xepersian}
\ExplSyntaxOn
-\ProvidesExplPackage {xepersian-hm} {2020-03-26} {0.4} { Fixes~issues~in~xepersian~package }
-
-\tl_set:Nn \l_kayhan_tl { kayhan }
-\tl_set:Nn \l_khorramshahr_tl { khorramshahr }
-\tl_set:Nn \l_kayhannavaar_tl { kayhannavaar }
-\tl_set:Nn \l_kayhanpook_tl { kayhanpook }
-\tl_set:Nn \l_kayhansayeh_tl { kayhansayeh }
-\tl_set:Nn \l_khoramshahr_tl { khoramshahr }
-\tl_set:Nn \l_khorramshahr_tl { khorramshahr }
-\tl_set:Nn \l_niloofar_tl { niloofar }
-\tl_set:Nn \l_paatch_tl { paatch }
-\tl_set:Nn \l_riyaz_tl { riyaz }
-\tl_set:Nn \l_roya_tl { roya }
-\tl_set:Nn \l_shafigh_tl { shafigh }
-\tl_set:Nn \l_shafighKurd_tl { shafighKurd }
-\tl_set:Nn \l_shafighUzbek_tl { shafighUzbek }
-\tl_set:Nn \l_shiraz_tl { shiraz }
-\tl_set:Nn \l_sols_tl { sols }
-\tl_set:Nn \l_tabriz_tl { tabriz }
-\tl_set:Nn \l_titr_tl { titr }
-\tl_set:Nn \l_titre_tl { titre }
-\tl_set:Nn \l_traffic_tl { traffic }
-\tl_set:Nn \l_vahid_tl { vahid }
-\tl_set:Nn \l_vosta_tl { vosta }
-\tl_set:Nn \l_yaghut_tl { yaghut }
-\tl_set:Nn \l_yagut_tl { yagut }
-\tl_set:Nn \l_yas_tl { yas }
-\tl_set:Nn \l_yekan_tl { yekan }
-\tl_set:Nn \l_yermook_tl { yermook }
-\tl_set:Nn \l_zar_tl { zar }
-\tl_set:Nn \l_ziba_tl { ziba }
-\tl_set:Nn \l_default_tl { default }
-\tl_set:Nn \l_noskip_tl { noskip }
+\ProvidesExplPackage {xepersian-hm} {2020-04-20} {0.5a} { Fixes~issues~in~xepersian~package }
+
+\bool_set_false:N \l_xephm_kashida_hm_fix_bool
+
+\tl_new:N \l_xephm_gap_filler_tl
+
+\bool_set_false:N \l_xephm_linebreakpenalty_bool
+
+\int_new:N \l_xephm_line_break_penalty_int
+\int_new:N \l_xephm_min_penalty_int
+\int_new:N \l_xephm_low_penalty_int
+\int_new:N \l_xephm_med_penalty_int
+\int_new:N \l_xephm_high_penalty_int
+\int_new:N \l_xephm_max_penalty_int
+
+\int_set:Nn \l_xephm_min_penalty_int { 0 }
+\int_set:Nn \l_xephm_low_penalty_int { 8 }
+\int_set:Nn \l_xephm_med_penalty_int { 15 }
+\int_set:Nn \l_xephm_high_penalty_int { 25 }
+\int_set:Nn \l_xephm_max_penalty_int { 10000 }
+
+\tl_set:Nn \l_xephm_stretch_glyph_tl { glyph }
+\tl_set:Nn \l_xephm_stretch_hrule_tl { hrule }
+
+\tl_set:Nn \l_xephm_kayhan_tl { kayhan }
+\tl_set:Nn \l_xephm_khorramshahr_tl { khorramshahr }
+\tl_set:Nn \l_xephm_kayhannavaar_tl { kayhannavaar }
+\tl_set:Nn \l_xephm_kayhanpook_tl { kayhanpook }
+\tl_set:Nn \l_xephm_kayhansayeh_tl { kayhansayeh }
+\tl_set:Nn \l_xephm_khoramshahr_tl { khoramshahr }
+\tl_set:Nn \l_xephm_khorramshahr_tl { khorramshahr }
+\tl_set:Nn \l_xephm_niloofar_tl { niloofar }
+\tl_set:Nn \l_xephm_paatch_tl { paatch }
+\tl_set:Nn \l_xephm_riyaz_tl { riyaz }
+\tl_set:Nn \l_xephm_roya_tl { roya }
+\tl_set:Nn \l_xephm_shafigh_tl { shafigh }
+\tl_set:Nn \l_xephm_shafighKurd_tl { shafighKurd }
+\tl_set:Nn \l_xephm_shafighUzbek_tl { shafighUzbek }
+\tl_set:Nn \l_xephm_shiraz_tl { shiraz }
+\tl_set:Nn \l_xephm_sols_tl { sols }
+\tl_set:Nn \l_xephm_tabriz_tl { tabriz }
+\tl_set:Nn \l_xephm_titr_tl { titr }
+\tl_set:Nn \l_xephm_titre_tl { titre }
+\tl_set:Nn \l_xephm_traffic_tl { traffic }
+\tl_set:Nn \l_xephm_vahid_tl { vahid }
+\tl_set:Nn \l_xephm_vosta_tl { vosta }
+\tl_set:Nn \l_xephm_yaghut_tl { yaghut }
+\tl_set:Nn \l_xephm_yagut_tl { yagut }
+\tl_set:Nn \l_xephm_yas_tl { yas }
+\tl_set:Nn \l_xephm_yekan_tl { yekan }
+\tl_set:Nn \l_xephm_yermook_tl { yermook }
+\tl_set:Nn \l_xephm_zar_tl { zar }
+\tl_set:Nn \l_xephm_ziba_tl { ziba }
+\tl_set:Nn \l_xephm_default_tl { default }
+\tl_set:Nn \l_xephm_noskip_tl { noskip }
\keys_define:nn { xepersian-hm }
{
- Kashida .code:n = \tex_input:D { kashida-xepersian-hm.def } ,
-
- kashidastretch .code:n =
+ Kashida .code:n =
{
\tl_set:Nn \l_tmpa_tl { #1 }
\tl_case:NnTF \l_tmpa_tl
{
- \l_kayhan_tl { \tl_set:Nn \l_hskip_default_tl { 0.14 em plus 0.5 em } }
- \l_khorramshahr_tl { \tl_set:Nn \l_hskip_default_tl { 0.131 em plus 0.5 em } }
- \l_kayhannavaar_tl { \tl_set:Nn \l_hskip_default_tl { 0.129 em plus 0.5 em } }
- \l_kayhanpook_tl { \tl_set:Nn \l_hskip_default_tl { 0.133 em plus 0.5 em } }
- \l_kayhansayeh_tl { \tl_set:Nn \l_hskip_default_tl { 0.135 em plus 0.5 em } }
- \l_khoramshahr_tl { \tl_set:Nn \l_hskip_default_tl { 0.128 em plus 0.5 em } }
- \l_khorramshahr_tl { \tl_set:Nn \l_hskip_default_tl { 0.13 em plus 0.5 em } }
- \l_niloofar_tl { \tl_set:Nn \l_hskip_default_tl { 0.132 em plus 0.5 em } }
- \l_paatch_tl { \tl_set:Nn \l_hskip_default_tl { 0.127 em plus 0.5 em } }
- \l_riyaz_tl { \tl_set:Nn \l_hskip_default_tl { 0.125 em plus 0.5 em } }
- \l_roya_tl { \tl_set:Nn \l_hskip_default_tl { 0.142 em plus 0.5 em } }
- \l_shafigh_tl { \tl_set:Nn \l_hskip_default_tl { 0.143 em plus 0.5 em } }
- \l_shafighKurd_tl { \tl_set:Nn \l_hskip_default_tl { 0.126 em plus 0.5 em } }
- \l_shafighUzbek_tl { \tl_set:Nn \l_hskip_default_tl { 0.123 em plus 0.5 em } }
- \l_shiraz_tl { \tl_set:Nn \l_hskip_default_tl { 0.122 em plus 0.5 em } }
- \l_sols_tl { \tl_set:Nn \l_hskip_default_tl { 0.124 em plus 0.5 em } }
- \l_tabriz_tl { \tl_set:Nn \l_hskip_default_tl { 0.119 em plus 0.5 em } }
- \l_titr_tl { \tl_set:Nn \l_hskip_default_tl { 0.12 em plus 0.5 em } }
- \l_titre_tl { \tl_set:Nn \l_hskip_default_tl { 0.121 em plus 0.5 em } }
- \l_traffic_tl { \tl_set:Nn \l_hskip_default_tl { 0.124 em plus 0.5 em } }
- \l_vahid_tl { \tl_set:Nn \l_hskip_default_tl { 0.134 em plus 0.5 em } }
- \l_vosta_tl { \tl_set:Nn \l_hskip_default_tl { 0.136 em plus 0.5 em } }
- \l_yaghut_tl { \tl_set:Nn \l_hskip_default_tl { 0.138 em plus 0.5 em } }
- \l_yagut_tl { \tl_set:Nn \l_hskip_default_tl { 0.137 em plus 0.5 em } }
- \l_yas_tl { \tl_set:Nn \l_hskip_default_tl { 0.126 em plus 0.5 em } }
- \l_yekan_tl { \tl_set:Nn \l_hskip_default_tl { 0.141 em plus 0.5 em } }
- \l_yermook_tl { \tl_set:Nn \l_hskip_default_tl { 0.139 em plus 0.5 em } }
- \l_zar_tl { \tl_set:Nn \l_hskip_default_tl { 0.116 em plus 0.5 em } }
- \l_ziba_tl { \tl_set:Nn \l_hskip_default_tl { 0.119 em plus 0.5 em } }
- \l_default_tl { \tl_set:Nn \l_hskip_default_tl { 0.14 em plus 0.5 em } }
- \l_noskip_tl { \tl_set:Nn \l_hskip_default_tl { 0 em plus 0.5 em } }
- } { } { \tl_set:Nn \l_hskip_default_tl { #1 } }
+ \l_xephm_stretch_glyph_tl { \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_glyph_tl } }
+ \l_xephm_stretch_hrule_tl { \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_hrule_tl } }
+ } { } { \tl_set:Nn \l_xephm_filler_default_tl { #1 } }
+ \bool_set_true:N \l_xephm_kashida_hm_fix_bool
+ \tex_input:D { kashida-xepersian-hm.def }
} ,
- kashidastretch .default:n = \tl_set:Nn \l_hskip_default_tl { 0 em plus 0.5 em } ,
+
+ linebreakpenalty .code:n =
+ {
+ \int_set:Nn \l_tmpa_int { #1 }
+ \int_case:nnTF \l_tmpa_int
+ {
+ \l_xephm_min_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_min_penalty_int } }
+ \l_xephm_low_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_low_penalty_int } }
+ \l_xephm_med_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_med_penalty_int } }
+ \l_xephm_high_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_high_penalty_int } }
+ \l_xephm_max_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_max_penalty_int } }
+ } { } { \int_set:Nn \l_xephm_line_break_penalty_int { #1 } }
+ \bool_set_true:N \l_xephm_linebreakpenalty_bool
+ } ,
+
+ kashidastretch .code:n =
+ {
+ \tl_set:Nn \l_tmpb_tl { #1 }
+ \tl_case:NnTF \l_tmpb_tl
+ {
+ \l_xephm_kayhan_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.14 em plus 0.5 em } }
+ \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.131 em plus 0.5 em } }
+ \l_xephm_kayhannavaar_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.129 em plus 0.5 em } }
+ \l_xephm_kayhanpook_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.133 em plus 0.5 em } }
+ \l_xephm_kayhansayeh_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.135 em plus 0.5 em } }
+ \l_xephm_khoramshahr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.128 em plus 0.5 em } }
+ \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.13 em plus 0.5 em } }
+ \l_xephm_niloofar_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.132 em plus 0.5 em } }
+ \l_xephm_paatch_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.127 em plus 0.5 em } }
+ \l_xephm_riyaz_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.125 em plus 0.5 em } }
+ \l_xephm_roya_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.142 em plus 0.5 em } }
+ \l_xephm_shafigh_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.143 em plus 0.5 em } }
+ \l_xephm_shafighKurd_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.126 em plus 0.5 em } }
+ \l_xephm_shafighUzbek_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.123 em plus 0.5 em } }
+ \l_xephm_shiraz_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.122 em plus 0.5 em } }
+ \l_xephm_sols_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.124 em plus 0.5 em } }
+ \l_xephm_tabriz_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.119 em plus 0.5 em } }
+ \l_xephm_titr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.12 em plus 0.5 em } }
+ \l_xephm_titre_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.121 em plus 0.5 em } }
+ \l_xephm_traffic_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.124 em plus 0.5 em } }
+ \l_xephm_vahid_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.134 em plus 0.5 em } }
+ \l_xephm_vosta_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.136 em plus 0.5 em } }
+ \l_xephm_yaghut_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.138 em plus 0.5 em } }
+ \l_xephm_yagut_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.137 em plus 0.5 em } }
+ \l_xephm_yas_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.126 em plus 0.5 em } }
+ \l_xephm_yekan_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.141 em plus 0.5 em } }
+ \l_xephm_yermook_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.139 em plus 0.5 em } }
+ \l_xephm_zar_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.116 em plus 0.5 em } }
+ \l_xephm_ziba_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.119 em plus 0.5 em } }
+ \l_xephm_default_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.14 em plus 0.5 em } }
+ \l_xephm_noskip_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0 em plus 0.5 em } }
+ } { } { \tl_set:Nn \l_xephm_hskip_default_tl { #1 } }
+ } ,
+ kashidastretch .default:n = \tl_set:Nn \l_xephm_hskip_default_tl { 0 em plus 0.5 em } ,
}
\ProcessKeysOptions { xepersian-hm }
@@ -274,121 +347,264 @@ which I cannot make time to fix.
% \begin{macrocode}
%<*kashida-xepersian-hm>
\ExplSyntaxOn
-\ProvidesExplFile {kashida-xepersian-hm.def} {2020-03-26} {0.4} { Fixes~implementation~of~Kashida~in~xepersian~package }
-
-\int_const:Nn \c_xepersianhm_zwj_int {"200D} % zero-width joiner
-\int_const:Nn \c_xepersianhm_lrm_int {"200E} % left-right-mark
-\int_const:Nn \c_xepersianhm_two_int {2} % 2
-\int_const:Nn \c_xepersianhm_four_int {4} % 4
-\int_const:Nn \c_xepersianhm_ksh_int {"0640} % kashida
-\int_const:Nn \c_xepersianhm_d_int {10} % dual-joiner class
-\int_const:Nn \c_xepersianhm_l_int {11} % lam
-\int_const:Nn \c_xepersianhm_r_int {12} % right-joiner
-\int_const:Nn \c_xepersianhm_a_int {13} % alef
-\int_const:Nn \c_xepersianhm_h_int {14} % heh
-\int_const:Nn \c_xepersianhm_y_int {15} % yeh
-\int_const:Nn \c_xepersianhm_v_int {4096} % vowel or other combining mark (to be ignored)
-
-\bool_new:N \l_kashida_on_bool
-\bool_new:N \l_kashida_hm_fix_bool
-\bool_new:N \l_kashida_xb_fix_bool
-
-\tl_new:N \l_hskip_zero_tl
-\tl_new:N \l_hskip_default_tl
-
-\cs_new:Npn \xepersian_kashida #1
+\ProvidesExplFile {kashida-xepersian-hm.def} {2020-04-20} {0.5a} { Fixes~implementation~of~Kashida~in~xepersian~package }
+
+\int_const:Nn \c_xephm_zwj_int {"200D} % zero-width joiner
+\int_const:Nn \c_xephm_lrm_int {"200E} % left-right-mark
+\int_const:Nn \c_xephm_two_int {2} % 2
+\int_const:Nn \c_xephm_four_int {4} % 4
+\int_const:Nn \c_xephm_ksh_int {"0640} % kashida
+
+\int_new:N \l_xephm_counter_int
+
+\newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class
+\newXeTeXintercharclass \c_xephm_l_charclass % lam
+\newXeTeXintercharclass \c_xephm_r_charclass % right-joiner
+\newXeTeXintercharclass \c_xephm_a_charclass % alef
+\newXeTeXintercharclass \c_xephm_y_charclass % yeh
+
+\tl_new:N \l_xephm_hskip_zero_tl
+\tl_new:N \l_xephm_hskip_default_tl
+
+\dim_new:N \l_xephm_diff_pos_dim
+
+%% 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 } { m }
+ {
+ \xephm_put_line_breaks:n { #1 }
+ }
+
+\tl_new:N \l_xephm_line_break_tl
+
+\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_kashida_on_bool
+ \c_xephm_lrm_int\tex_penalty:D 10000
+ \mode_leave_vertical:
+ \tex_global:D \tex_advance:D \l_xephm_counter_int \c_one_int
+
+ \tl_set:Nx \l_xephm_pos_tl { pos_\tex_romannumeral:D \l_xephm_counter_int }
+ \tl_set:Nx \l_xephm_zref_tl { zref_\tex_romannumeral:D \l_xephm_counter_int }
+
+ \zsaveposx{x_i_\l_xephm_zref_tl}
+ \tl_set:Nx \l_tmpa_tl
+ {
+ \iow_now:cx { @auxout }
+ {
+ \ExplSyntaxOn
+ \tl_gset:Nn \exp_after:wN \token_to_str:N \cs:w get_x_i\l_xephm_pos_tl \cs_end: { \zposx{ x_i_\l_xephm_zref_tl } }
+ \ExplSyntaxOff
+ }
+ }
+ \l_tmpa_tl
+ \skip_horizontal:n { #1 }
+ \zsaveposx{x_f_\l_xephm_zref_tl}
+ \tl_set:Nx \l_tmpa_tl
+ {
+ \iow_now:cx { @auxout }
+ {
+ \ExplSyntaxOn
+ \tl_gset:Nn \exp_after:wN \token_to_str:N \cs:w get_x_f\l_xephm_pos_tl \cs_end: { \zposx{ x_f_\l_xephm_zref_tl } }
+ \ExplSyntaxOff
+ }
+ }
+ \l_tmpa_tl
+ \exp_after:wN
+ \if_meaning:w
+ \cs:w get_x_i\l_xephm_pos_tl \cs_end: \tex_relax:D
+ \else:
+ \dim_set:Nn \l_xephm_diff_pos_dim
+ {
+ \dim_eval:n { \cs:w get_x_i\l_xephm_pos_tl \cs_end: sp - \cs:w get_x_f\l_xephm_pos_tl \cs_end: sp }
+ }
+ \dim_compare:nTF { \l_xephm_diff_pos_dim == 0sp }
+ { }
+ { \llap { \resizebox { \l_xephm_diff_pos_dim \tex_relax:D } { \height } { \c_xephm_ksh_int } } }
+ \fi:
+ }
+}
+
+%% Partly adapted from the code provided by Jonathan Kew in:
+%% https://tug.org/pipermail/xetex/2009-February/012307.html.
+%% Somebody notified me that the code in 'kashida-xepersian.def' from xepersian
+%% package is an exact copy of Jonathan Kew's code. Being unaware of this, in
+%% 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.
+\cs_new:Npn \xephm_kashida_hrule #1
+ {
+ \bool_if:NT \l_xephm_kashida_hm_fix_bool
{
- \c_xepersianhm_lrm_int\c_xepersianhm_zwj_int\tex_penalty:D 10000
- \tex_leaders:D \tex_hrule:D height \XeTeXglyphbounds \c_xepersianhm_two_int
- \int_use:N \XeTeXcharglyph \c_xepersianhm_ksh_int depth \XeTeXglyphbounds \c_xepersianhm_four_int
- \int_use:N \XeTeXcharglyph \c_xepersianhm_ksh_int \skip_horizontal:n { #1 }
- \c_xepersianhm_zwj_int
+ \c_xephm_lrm_int\c_xephm_zwj_int\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
}
}
\XeTeXinterchartokenstate = 1
-\clist_set:Nn \l_xepersianhm_a_clist { 0622,0623,0625,0627 } % ‏ا، إ، أ، آ‏
-\clist_map_inline:Nn \l_xepersianhm_a_clist
+\clist_set:Nn \l_xephm_a_clist { 0622,0623,0625,0627 } % ‏ا، إ، أ، آ‏
+\clist_map_inline:Nn \l_xephm_a_clist
{
- \XeTeXcharclass "#1 \c_xepersianhm_a_int
+ \XeTeXcharclass "#1 \c_xephm_a_charclass
}
-\clist_set:Nn \l_xepersianhm_d_clist { 0626,0628,062A,062B,062C,062D,062E,0633,0634,0635,0636,0637,0638,0639,063A,0640,0641,0642,0643,0645,0646,0647,067E,0686,06A9,06AF } % ‏ئ,ب,ت,ث,ج,ح,خ,س,ش,ص,ض,ط,ظ,ع,غ,ـ,ف,ق,ك,م,ن,ه,پ,چ,ک,گ‏
-\clist_map_inline:Nn \l_xepersianhm_d_clist
+\clist_set:Nn \l_xephm_d_clist { 0626,0628,062A,062B,062C,062D,062E,0633,0634,0635,0636,0637,0638,0639,063A,0640,0641,0642,0643,0645,0646,0647,067E,0686,06A9,06AF } % ‏ئ,ب,ت,ث,ج,ح,خ,س,ش,ص,ض,ط,ظ,ع,غ,ـ,ف,ق,ك,م,ن,ه,پ,چ,ک,گ‏
+\clist_map_inline:Nn \l_xephm_d_clist
{
- \XeTeXcharclass "#1 \c_xepersianhm_d_int
+ \XeTeXcharclass "#1 \c_xephm_d_charclass
}
-\clist_set:Nn \l_xepersianhm_l_clist { 0644 } % ‏ل‏
-\clist_map_inline:Nn \l_xepersianhm_l_clist
+\clist_set:Nn \l_xephm_l_clist { 0644 } % ‏ل‏
+\clist_map_inline:Nn \l_xephm_l_clist
{
- \XeTeXcharclass "#1 \c_xepersianhm_l_int
+ \XeTeXcharclass "#1 \c_xephm_l_charclass
}
-\clist_set:Nn \l_xepersianhm_r_clist { 0624,0629,062F,0630,0631,0632,0648,0698 } % ‏ؤ,ة,د,ذ,ر,ز,و,ژ‏
-\clist_map_inline:Nn \l_xepersianhm_r_clist
+\clist_set:Nn \l_xephm_r_clist { 0624,0629,062F,0630,0631,0632,0648,0698 } % ‏ؤ,ة,د,ذ,ر,ز,و,ژ‏
+\clist_map_inline:Nn \l_xephm_r_clist
{
- \XeTeXcharclass "#1 \c_xepersianhm_r_int
+ \XeTeXcharclass "#1 \c_xephm_r_charclass
}
-\clist_set:Nn \l_xepersianhm_v_clist { 064B,064C,064D,064E,064F,0650,0651,0652 } % ‏ً,ٌ,ٍ,َ,ُ,ِ,ّ,ْ‏
-\clist_map_inline:Nn \l_xepersianhm_v_clist
+\clist_set:Nn \l_xephm_y_clist { 0649,064A,06CC } % ‏ی,ي,ى‏
+\clist_map_inline:Nn \l_xephm_y_clist
{
- \XeTeXcharclass "#1 \c_xepersianhm_v_int
+ \XeTeXcharclass "#1 \c_xephm_y_charclass
}
-\clist_set:Nn \l_xepersianhm_y_clist { 0649,064A,06CC }
-\clist_map_inline:Nn \l_xepersianhm_y_clist
+\msg_new:nnx { xepersian-hm } { value-not-available-for-kashida-option }
{
- \XeTeXcharclass "#1 \c_xepersianhm_y_int
+ Sorry,~ value~ `\l_xephm_gap_filler_tl'~ is~ not~ available~ for~ kashida~ option~ yet!
}
-\XeTeXinterchartoks \c_xepersianhm_y_int \c_xepersianhm_y_int = {\bool_if:NTF \l_kashida_hm_fix_bool {\xepersian_kashida {\l_hskip_default_tl}} {\xepersian_kashida \l_hskip_zero_tl}}
-\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_y_int = {\bool_if:NTF \l_kashida_hm_fix_bool {\xepersian_kashida {\l_hskip_default_tl}} {\xepersian_kashida \l_hskip_zero_tl}}
-\XeTeXinterchartoks \c_xepersianhm_y_int \c_xepersianhm_d_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_d_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_d_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_l_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_l_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_r_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_a_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_r_int = {\xepersian_kashida \l_hskip_zero_tl}
-\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_a_int = {}
-
-\NewDocumentCommand \KashidaOn {} { \bool_set_true:N \l_kashida_on_bool }
-\NewDocumentCommand \KashidaOff {} { \bool_set_false:N \l_kashida_on_bool }
-
-\NewDocumentCommand \KashidaXBFixOn {} { \bool_set_true:N \l_kashida_xb_fix_bool }
-\NewDocumentCommand \KashidaXBFixOff {} { \bool_set_false:N \l_kashida_xb_fix_bool }
-
-\NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_kashida_hm_fix_bool }
-\NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_kashida_hm_fix_bool }
+\str_case:VnTF \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
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_default_tl \c_xephm_zwj_int }
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass =
+ {
+ \bool_if:NTF \l_xephm_kashida_hm_fix_bool
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_default_tl \c_xephm_zwj_int }
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ }
+ \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass =
+ { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass =
+ { }
+ }
+ \l_xephm_stretch_hrule_tl
+ {
+ \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass =
+ {
+ \bool_if:NTF \l_xephm_kashida_hm_fix_bool
+ { \xephm_kashida_hrule \l_xephm_hskip_default_tl }
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass =
+ {
+ \bool_if:NTF \l_xephm_kashida_hm_fix_bool
+ { \xephm_kashida_hrule \l_xephm_hskip_default_tl }
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ }
+ \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass =
+ { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+ \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass =
+ { }
+ }
+ } { } { \msg_error:nn { xepersian-hm } { value-not-available-for-kashida-option } }
-\ExplSyntaxOff
-\makeatletter
-\newif\if@Kashida@on
-\newif\if@Kashida@XB@fix
-\makeatother
-\ExplSyntaxOn
+\NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_hm_fix_bool }
+\NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_hm_fix_bool }
-\KashidaHMFixOn
+\tex_let:D \KashidaOn \KashidaHMFixOn
+\tex_let:D \KashidaOff \KashidaHMFixOff
-\tl_set:Nn \l_hskip_zero_tl { 0 em plus 0.5 em }
+\tl_set:Nn \l_xephm_hskip_zero_tl { 0 em plus 0.5 em }
-\bool_if:NTF \l_kashida_hm_fix_bool
+\bool_if:NTF \l_xephm_kashida_hm_fix_bool
{
- \tl_if_empty:NT \l_hskip_default_tl { \tl_set:Nn \l_hskip_default_tl { 0.14 em plus 0.5 em } }
+ \tl_if_empty:NT \l_xephm_hskip_default_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.14 em plus 0.5 em } }
}
{
- \tl_set:NV \l_hskip_default_tl \l_hskip_zero_tl
+ \tl_set:NV \l_xephm_hskip_default_tl \l_xephm_hskip_zero_tl
}
-\KashidaOn
-
\ExplSyntaxOff
+
+\makeatletter
+\newif\if@Kashida@on
+\newif\if@Kashida@XB@fix
+\makeatother
+
\endinput
%</kashida-xepersian-hm>
% \end{macrocode}
diff --git a/macros/xetex/latex/xepersian-hm/xepersian-hm.pdf b/macros/xetex/latex/xepersian-hm/xepersian-hm.pdf
index 9c3cff93a1..98b788d787 100644
--- a/macros/xetex/latex/xepersian-hm/xepersian-hm.pdf
+++ b/macros/xetex/latex/xepersian-hm/xepersian-hm.pdf
Binary files differ