texlive[55123] Master/texmf-dist: xepersian-hm (12may20)

commits+karl at tug.org commits+karl at tug.org
Tue May 12 23:23:12 CEST 2020


Revision: 55123
          http://tug.org/svn/texlive?view=revision&revision=55123
Author:   karl
Date:     2020-05-12 23:23:12 +0200 (Tue, 12 May 2020)
Log Message:
-----------
xepersian-hm (12may20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.pdf
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-hrule-example.pdf
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.pdf
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.pdf
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm.pdf
    trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx
    trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def
    trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf

Added: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt	2020-05-12 21:23:12 UTC (rev 55123)
@@ -0,0 +1,38 @@
+  xepersian-hm -- INSTALL
+======================
+
+    Source:  xepersian-hm.dtx ( 2020/05/11 v0.5e)
+    Author:  Hossein Movahhedian
+    Info:    filecontents + macro + verbatim
+    License: LPPL 1.3c
+    Copyright (C) 2020 Hossein Movahedian.
+    <dma8hm1334 AT gmail DOT com>
+
+-   To extract the package and at the same time produce the
+    documentation, execute: xelatex thrice on xepersian-hm.dtx.
+
+Files should then be moved to appropriate locations.
+
+-- *.dtx -> TEXMF/source/xelatex/xepersian-hm/
+-- *.ins -> TEXMF/source/xelatex/xepersian-hm/
+
+-- *.sty -> TEXMF/tex/xelatex/xepersian-hm/
+-- *.def -> TEXMF/tex/xelatex/xepersian-hm/
+
+-- *.pdf -> TEXMF/doc/xelatex/xepersian-hm/
+-- *.tex -> TEXMF/doc/xelatex/xepersian-hm/
+-- *.ltx -> TEXMF/doc/xelatex/xepersian-hm/
+-- *.txt -> TEXMF/doc/xelatex/xepersian-hm/
+
+Don't forget to run 'texconfig rehash' afterwards.
+
+The example files
+
+    kashida-glyph-example.tex
+    kashida-hrule-example.tex
+    kashida-xep-XB-example.tex
+
+illustrate some features of the package and are an addendum to the
+main documentation xepersian-hm.pdf.
+
+Thats it.


Property changes on: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/INSTALL.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf	2020-05-12 21:22:49 UTC (rev 55122)
+++ trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf	2020-05-12 21:23:12 UTC (rev 55123)

Property changes on: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xep.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf	2020-05-12 21:22:49 UTC (rev 55122)
+++ trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf	2020-05-12 21:23:12 UTC (rev 55123)

Property changes on: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/doc-ligature-xephm.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-glyph-example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-hrule-example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-xep-XB-example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx	2020-05-12 21:22:49 UTC (rev 55122)
+++ trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.ltx	2020-05-12 21:23:12 UTC (rev 55123)
@@ -27,7 +27,7 @@
    }
 }
 
-\date{Released \quad 2020-05-07 \quad v0.5d}
+\date{Released \quad 2020-05-12 \quad v0.5e}
 
 \let\tmpthepage\thepage
 \renewcommand{\thepage}{\lr{\Large\textbf\tmpthepage}}
@@ -81,6 +81,19 @@
         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.
+
   \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.
@@ -88,24 +101,34 @@
 
 For comparing the outputs of \textsf{xepersian} and \textsf{xepersian-hm} with
 a variety of options available to these packages, please see the
-\mbox{Figure \ref{fig:xepersian-XB}}, 
-\mbox{Figure \ref{fig:xepersian-hm-hrule}}, and
-\mbox{Figure \ref{fig:xepersian-hm-glyph}}.
+\mbox{Figures \ref{fig:xepersian-XB}, \ref{fig:xepersian-hm-hrule}}, and \ref{fig:xepersian-hm-glyph}.
 
 \begin{figure}
-  \centerline{\includegraphics[scale=1]{doc-samples-xep.pdf}}
+  \centerline{\fbox{\includegraphics[scale=1]{doc-ligature-xep.pdf}}}
+  \caption{Package: \textsf{xeprsian}, Font: \textsf{Noto Sans Arabic}, \textsf{Scale=1.1}, \textsf{Kashida=On}}
+  \label{fig:ligatures-xep}
+\end{figure}
+
+\begin{figure}
+  \centerline{\fbox{\includegraphics[scale=1]{doc-ligature-xephm.pdf}}}
+  \caption{Package: \textsf{xeprsian-hm}, Font: \textsf{Noto Sans Arabic}, \textsf{Scale=1.1}, \textsf{Kashida=glyph}}
+  \label{fig:ligatures-xephm}
+\end{figure}
+
+\begin{figure}
+  \centerline{\fbox{\includegraphics[scale=1]{doc-samples-xep.pdf}}}
   \caption{Package: \textsf{xeprsian}, Font: \textsf{XB Kayhan}, \textsf{Scale=4.5}, \textsf{Kashida=0n}}
   \label{fig:xepersian-XB}
 \end{figure}
 
 \begin{figure}
-  \centerline{\includegraphics[scale=1]{doc-samples-hrule.pdf}}
+  \centerline{\fbox{\includegraphics[scale=1]{doc-samples-hrule.pdf}}}
   \caption{Package: \textsf{xeprsian-hm}, Font: \textsf{HM XKayhan}, \textsf{Scale=4.5}, \textsf{Kashida=hrule}}
   \label{fig:xepersian-hm-hrule}
 \end{figure}
 
 \begin{figure}
-  \centerline{\includegraphics[scale=1]{doc-samples-glyph.pdf}}
+  \centerline{\fbox{\includegraphics[scale=1]{doc-samples-glyph.pdf}}}
   \caption{Package: \textsf{xeprsian-hm}, Font: \textsf{HM XKayhan}, \textsf{Scale=4.5}, \textsf{Kashida=glyph}}
   \label{fig:xepersian-hm-glyph}
 \end{figure}
@@ -160,6 +183,7 @@
       \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
@@ -202,6 +226,25 @@
 
     For example: \mbox{\texttt{'kashidastretch=titr'}} is equivalent to\linebreak
     \mbox{\texttt{'kashidastretch=0.12  em plus 0.5 em'}}
+
+  \item \texttt{ligature}: \\
+    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{'ligature=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}
@@ -223,7 +266,7 @@
   \item Kashida and ligatures:
 
     The method used to implement kashida feature breaks a ligature if it is applied to the letters which are joined to form
-    the ligature.
+    the ligature. This is fixed in \textsf{xepersian-hm}, but it is still immature.
 \end{description}
 
 \end{latin}

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx
===================================================================
--- trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx	2020-05-12 21:22:49 UTC (rev 55122)
+++ trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx	2020-05-12 21:23:12 UTC (rev 55123)
@@ -67,7 +67,7 @@
 %    }^^A
 % }
 % 
-% \date{Released \quad 2020-05-07 \quad v0.5d}
+% \date{Released \quad 2020-05-12 \quad v0.5e}
 % 
 % \maketitle
 % 
@@ -96,7 +96,7 @@
 \RequirePackage{zref-savepos}[2020-03-03]
 \RequirePackage{xepersian}
 \ExplSyntaxOn
-\ProvidesExplPackage {xepersian-hm} {2020-05-07} {0.5d} { Fixes~issues~in~xepersian~package }
+\ProvidesExplPackage {xepersian-hm} {2020-05-12} {0.5e} { Fixes~issues~in~xepersian~package }
 
 \int_const:Nn \c_xephm_ksh_int {"0640} % kashida
 \int_const:Nn \c_xephm_lrm_int {"200E} % left-right-mark
@@ -127,11 +127,14 @@
 
 \tl_new:N \l_xephm_skip_default_tl
 
+\tl_new:N \l_xephm_active_ligs_tl
+
 \tl_new:N \l_xephm_gap_filler_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_ligature_bool
 \bool_set_false:N \l_xephm_linebreakpenalty_bool
 
 \int_set:Nn \l_xephm_min_penalty_int { 0 }
@@ -143,38 +146,69 @@
 \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 }
+\tl_set:Nn \l_xephm_fnt_kayhan_tl       { kayhan }
+\tl_set:Nn \l_xephm_fnt_kayhannavaar_tl { kayhannavaar }
+\tl_set:Nn \l_xephm_fnt_kayhanpook_tl   { kayhanpook }
+\tl_set:Nn \l_xephm_fnt_kayhansayeh_tl  { kayhansayeh }
+\tl_set:Nn \l_xephm_fnt_khoramshahr_tl  { khoramshahr }
+\tl_set:Nn \l_xephm_fnt_khorramshahr_tl { khorramshahr }
+\tl_set:Nn \l_xephm_fnt_niloofar_tl     { niloofar }
+\tl_set:Nn \l_xephm_fnt_paatch_tl       { paatch }
+\tl_set:Nn \l_xephm_fnt_riyaz_tl        { riyaz }
+\tl_set:Nn \l_xephm_fnt_roya_tl         { roya }
+\tl_set:Nn \l_xephm_fnt_shafigh_tl      { shafigh }
+\tl_set:Nn \l_xephm_fnt_shafighKurd_tl  { shafighKurd }
+\tl_set:Nn \l_xephm_fnt_shafighUzbek_tl { shafighUzbek }
+\tl_set:Nn \l_xephm_fnt_shiraz_tl       { shiraz }
+\tl_set:Nn \l_xephm_fnt_sols_tl         { sols }
+\tl_set:Nn \l_xephm_fnt_tabriz_tl       { tabriz }
+\tl_set:Nn \l_xephm_fnt_titr_tl         { titr }
+\tl_set:Nn \l_xephm_fnt_titre_tl        { titre }
+\tl_set:Nn \l_xephm_fnt_traffic_tl      { traffic }
+\tl_set:Nn \l_xephm_fnt_vahid_tl        { vahid }
+\tl_set:Nn \l_xephm_fnt_vosta_tl        { vosta }
+\tl_set:Nn \l_xephm_fnt_yaghut_tl       { yaghut }
+\tl_set:Nn \l_xephm_fnt_yagut_tl        { yagut }
+\tl_set:Nn \l_xephm_fnt_yas_tl          { yas }
+\tl_set:Nn \l_xephm_fnt_yekan_tl        { yekan }
+\tl_set:Nn \l_xephm_fnt_yermook_tl      { yermook }
+\tl_set:Nn \l_xephm_fnt_zar_tl          { zar }
+\tl_set:Nn \l_xephm_fnt_ziba_tl         { ziba }
+\tl_set:Nn \l_xephm_fnt_default_tl      { default }
+\tl_set:Nn \l_xephm_fnt_noskip_tl       { noskip }
 
+\tl_set:Nn \l_xephm_lig_aalt_tl    { aalt } % Access All Alternatives
+\tl_set:Nn \l_xephm_lig_ccmp_tl    { ccmp } % Glyph Composition/Decomposition
+\tl_set:Nn \l_xephm_lig_dlig_tl    { dlig } % Discretionary Ligatures
+\tl_set:Nn \l_xephm_lig_fina_tl    { fina } % Final (Terminal) Forms
+\tl_set:Nn \l_xephm_lig_init_tl    { init } % Initial Forms
+\tl_set:Nn \l_xephm_lig_locl_tl    { locl } % Localized Forms
+\tl_set:Nn \l_xephm_lig_medi_tl    { medi } % Medial Forms
+\tl_set:Nn \l_xephm_lig_rlig_tl    { rlig } % Required Ligatures
+\tl_set:Nn \l_xephm_lig_default_tl { default }
+
+\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
+\clist_set:Nn \l_xephm_lig_fina_clist    { {  } } % Final (Terminal) Forms
+\clist_set:Nn \l_xephm_lig_init_clist    { {  } } % Initial Forms
+\clist_set:Nn \l_xephm_lig_locl_clist    { {  } } % Localized Forms
+\clist_set:Nn \l_xephm_lig_medi_clist    { {  } } % Medial Forms
+\clist_set:Nn \l_xephm_lig_rlig_clist    { {  } } % Required Ligatures
+\clist_set:Nn \l_xephm_lig_default_clist { {  } }
+
+\clist_set:Nn \l_xephm_lig_names_clist
+  {
+    \l_xephm_lig_aalt_tl , { \l_xephm_lig_aalt_clist } ,
+    \l_xephm_lig_ccmp_tl , { \l_xephm_lig_ccmp_clist } ,
+    \l_xephm_lig_dlig_tl , { \l_xephm_lig_dlig_clist } ,
+    \l_xephm_lig_fina_tl , { \l_xephm_lig_fina_clist } ,
+    \l_xephm_lig_init_tl , { \l_xephm_lig_init_clist } ,
+    \l_xephm_lig_locl_tl , { \l_xephm_lig_locl_clist } ,
+    \l_xephm_lig_medi_tl , { \l_xephm_lig_medi_clist } ,
+    \l_xephm_lig_rlig_tl , { \l_xephm_lig_rlig_clist } ,
+  }
+
 \msg_new:nnn { xepersian-hm } { kashida-character-is-not-available-in-the-main-font }
   {
     Sorry,~ kashida~ character~ is~ not~ available~ in~ the~ main~ font~!
@@ -219,7 +253,6 @@
           } { } { \tl_set:Nx \l_xephm_gap_filler_tl { #1 } }
         \tl_if_empty:NT \l_xephm_gap_filler_tl { \msg_error:nn { xepersian-hm } { specify-value-for-kashida-option } }
         \bool_set_true:N \l_xephm_kashida_hm_fix_bool
-        \tex_input:D { kashida-xepersian-hm.def }
       } ,
 
     linebreakpenalty .code:n =
@@ -227,11 +260,11 @@
         \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_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 } }
+            \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
       } ,
@@ -238,47 +271,71 @@
 
     kashidastretch .code:n =
       {
-        \tl_set:Nn \l_tmpb_tl { #1 }
-        \tl_case:NnTF \l_tmpb_tl
+        \tl_set:Nn \l_tmpa_tl { #1 }
+        \tl_case:NnTF \l_tmpa_tl
           {
-             \l_xephm_kayhan_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
-             \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.131 em plus 0.5 em } }
-             \l_xephm_kayhannavaar_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.129 em plus 0.5 em } }
-             \l_xephm_kayhanpook_tl   { \tl_set:Nn \l_xephm_skip_default_tl { 0.133 em plus 0.5 em } }
-             \l_xephm_kayhansayeh_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.135 em plus 0.5 em } }
-             \l_xephm_khoramshahr_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.128 em plus 0.5 em } }
-             \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.13  em plus 0.5 em } }
-             \l_xephm_niloofar_tl     { \tl_set:Nn \l_xephm_skip_default_tl { 0.132 em plus 0.5 em } }
-             \l_xephm_paatch_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.127 em plus 0.5 em } }
-             \l_xephm_riyaz_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.125 em plus 0.5 em } }
-             \l_xephm_roya_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.142 em plus 0.5 em } }
-             \l_xephm_shafigh_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.143 em plus 0.5 em } }
-             \l_xephm_shafighKurd_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
-             \l_xephm_shafighUzbek_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.123 em plus 0.5 em } }
-             \l_xephm_shiraz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.122 em plus 0.5 em } }
-             \l_xephm_sols_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
-             \l_xephm_tabriz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
-             \l_xephm_titr_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.12  em plus 0.5 em } }
-             \l_xephm_titre_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.121 em plus 0.5 em } }
-             \l_xephm_traffic_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
-             \l_xephm_vahid_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.134 em plus 0.5 em } }
-             \l_xephm_vosta_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.136 em plus 0.5 em } }
-             \l_xephm_yaghut_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.138 em plus 0.5 em } }
-             \l_xephm_yagut_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.137 em plus 0.5 em } }
-             \l_xephm_yas_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
-             \l_xephm_yekan_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.141 em plus 0.5 em } }
-             \l_xephm_yermook_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.139 em plus 0.5 em } }
-             \l_xephm_zar_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.116 em plus 0.5 em } }
-             \l_xephm_ziba_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
-             \l_xephm_default_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
-             \l_xephm_noskip_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0     em plus 0.5 em } }
+             \l_xephm_fnt_kayhan_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
+             \l_xephm_fnt_kayhannavaar_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.129 em plus 0.5 em } }
+             \l_xephm_fnt_kayhanpook_tl   { \tl_set:Nn \l_xephm_skip_default_tl { 0.133 em plus 0.5 em } }
+             \l_xephm_fnt_kayhansayeh_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.135 em plus 0.5 em } }
+             \l_xephm_fnt_khoramshahr_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.128 em plus 0.5 em } }
+             \l_xephm_fnt_khorramshahr_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.13  em plus 0.5 em } }
+             \l_xephm_fnt_niloofar_tl     { \tl_set:Nn \l_xephm_skip_default_tl { 0.132 em plus 0.5 em } }
+             \l_xephm_fnt_paatch_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.127 em plus 0.5 em } }
+             \l_xephm_fnt_riyaz_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.125 em plus 0.5 em } }
+             \l_xephm_fnt_roya_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.142 em plus 0.5 em } }
+             \l_xephm_fnt_shafigh_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.143 em plus 0.5 em } }
+             \l_xephm_fnt_shafighKurd_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
+             \l_xephm_fnt_shafighUzbek_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.123 em plus 0.5 em } }
+             \l_xephm_fnt_shiraz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.122 em plus 0.5 em } }
+             \l_xephm_fnt_sols_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
+             \l_xephm_fnt_tabriz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
+             \l_xephm_fnt_titr_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.12  em plus 0.5 em } }
+             \l_xephm_fnt_titre_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.121 em plus 0.5 em } }
+             \l_xephm_fnt_traffic_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
+             \l_xephm_fnt_vahid_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.134 em plus 0.5 em } }
+             \l_xephm_fnt_vosta_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.136 em plus 0.5 em } }
+             \l_xephm_fnt_yaghut_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.138 em plus 0.5 em } }
+             \l_xephm_fnt_yagut_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.137 em plus 0.5 em } }
+             \l_xephm_fnt_yas_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
+             \l_xephm_fnt_yekan_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.141 em plus 0.5 em } }
+             \l_xephm_fnt_yermook_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.139 em plus 0.5 em } }
+             \l_xephm_fnt_zar_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.116 em plus 0.5 em } }
+             \l_xephm_fnt_ziba_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
+             \l_xephm_fnt_default_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
+             \l_xephm_fnt_noskip_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0     em plus 0.5 em } }
           } { } { \tl_set:Nn \l_xephm_skip_default_tl { #1 } }
       } ,
     kashidastretch .default:n = \tl_set:Nn \l_xephm_skip_default_tl { 0 em plus 0.5 em } ,
+
+    ligatures .code:n =
+      {
+        \tl_set:Nn \l_tmpa_tl { #1 }
+        \tl_case:NnTF \l_tmpa_tl
+          {
+            \l_xephm_lig_aalt_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_aalt_tl } }
+            \l_xephm_lig_ccmp_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_ccmp_tl } }
+            \l_xephm_lig_dlig_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_dlig_tl } }
+            \l_xephm_lig_fina_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_fina_tl } }
+            \l_xephm_lig_init_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_init_tl } }
+            \l_xephm_lig_locl_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_locl_tl } }
+            \l_xephm_lig_medi_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_medi_tl } }
+            \l_xephm_lig_rlig_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_rlig_tl } }
+            \l_xephm_lig_default_tl { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_default_tl } }
+          } { } { \tl_set:Nn \l_xephm_active_ligs_tl { #1 } }
+        \bool_set_true:N \l_xephm_ligature_bool
+      } ,
+    ligatures .default:n = \tl_set:Nn \l_xephm_active_ligs_tl { \l_xephm_lig_default_tl } ,
+
   }
 
 \ProcessKeysOptions { xepersian-hm }
 
+\bool_if:NT \l_xephm_kashida_hm_fix_bool
+  {
+    \tex_input:D { kashida-xepersian-hm.def }
+  }
+
 \ExplSyntaxOff
  \endinput
 %</xepersian-hm-sty>
@@ -288,7 +345,7 @@
 %    \begin{macrocode}
 %<*kashida-xepersian-hm-def>
 \ExplSyntaxOn
-\ProvidesExplFile {kashida-xepersian-hm.def} {2020-05-07} {0.5d} { Fixes~implementation~of~Kashida~in~xepersian~package }
+\ProvidesExplFile {kashida-xepersian-hm.def} {2020-05-12} {0.5e} { Fixes~implementation~of~Kashida~in~xepersian~package }
 
 \newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class
 \newXeTeXintercharclass \c_xephm_l_charclass % lam
@@ -296,45 +353,73 @@
 \newXeTeXintercharclass \c_xephm_a_charclass % alef
 \newXeTeXintercharclass \c_xephm_y_charclass % yeh
 
-%% 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:
+\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 \ }
+    }
 }
 
-\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 }
- }
+\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
+    }
+}
 
-\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

Modified: trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def	2020-05-12 21:22:49 UTC (rev 55122)
+++ trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def	2020-05-12 21:23:12 UTC (rev 55123)
@@ -13,7 +13,7 @@
 %% this license is at: http://www.latex-project.org/lppl.txt
 %% 
 \ExplSyntaxOn
-\ProvidesExplFile {kashida-xepersian-hm.def} {2020-05-07} {0.5d} { Fixes~implementation~of~Kashida~in~xepersian~package }
+\ProvidesExplFile {kashida-xepersian-hm.def} {2020-05-12} {0.5e} { Fixes~implementation~of~Kashida~in~xepersian~package }
 
 \newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class
 \newXeTeXintercharclass \c_xephm_l_charclass % lam
@@ -21,45 +21,73 @@
 \newXeTeXintercharclass \c_xephm_a_charclass % alef
 \newXeTeXintercharclass \c_xephm_y_charclass % yeh
 
-%% 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:
+\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 \ }
+    }
 }
 
-\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 }
- }
+\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:
+  }
 
-\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
- }
+  \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

Modified: trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty	2020-05-12 21:22:49 UTC (rev 55122)
+++ trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty	2020-05-12 21:23:12 UTC (rev 55123)
@@ -31,7 +31,7 @@
 \RequirePackage{zref-savepos}[2020-03-03]
 \RequirePackage{xepersian}
 \ExplSyntaxOn
-\ProvidesExplPackage {xepersian-hm} {2020-05-07} {0.5d} { Fixes~issues~in~xepersian~package }
+\ProvidesExplPackage {xepersian-hm} {2020-05-12} {0.5e} { Fixes~issues~in~xepersian~package }
 
 \int_const:Nn \c_xephm_ksh_int {"0640} % kashida
 \int_const:Nn \c_xephm_lrm_int {"200E} % left-right-mark
@@ -62,11 +62,14 @@
 
 \tl_new:N \l_xephm_skip_default_tl
 
+\tl_new:N \l_xephm_active_ligs_tl
+
 \tl_new:N \l_xephm_gap_filler_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_ligature_bool
 \bool_set_false:N \l_xephm_linebreakpenalty_bool
 
 \int_set:Nn \l_xephm_min_penalty_int { 0 }
@@ -78,38 +81,69 @@
 \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 }
+\tl_set:Nn \l_xephm_fnt_kayhan_tl       { kayhan }
+\tl_set:Nn \l_xephm_fnt_kayhannavaar_tl { kayhannavaar }
+\tl_set:Nn \l_xephm_fnt_kayhanpook_tl   { kayhanpook }
+\tl_set:Nn \l_xephm_fnt_kayhansayeh_tl  { kayhansayeh }
+\tl_set:Nn \l_xephm_fnt_khoramshahr_tl  { khoramshahr }
+\tl_set:Nn \l_xephm_fnt_khorramshahr_tl { khorramshahr }
+\tl_set:Nn \l_xephm_fnt_niloofar_tl     { niloofar }
+\tl_set:Nn \l_xephm_fnt_paatch_tl       { paatch }
+\tl_set:Nn \l_xephm_fnt_riyaz_tl        { riyaz }
+\tl_set:Nn \l_xephm_fnt_roya_tl         { roya }
+\tl_set:Nn \l_xephm_fnt_shafigh_tl      { shafigh }
+\tl_set:Nn \l_xephm_fnt_shafighKurd_tl  { shafighKurd }
+\tl_set:Nn \l_xephm_fnt_shafighUzbek_tl { shafighUzbek }
+\tl_set:Nn \l_xephm_fnt_shiraz_tl       { shiraz }
+\tl_set:Nn \l_xephm_fnt_sols_tl         { sols }
+\tl_set:Nn \l_xephm_fnt_tabriz_tl       { tabriz }
+\tl_set:Nn \l_xephm_fnt_titr_tl         { titr }
+\tl_set:Nn \l_xephm_fnt_titre_tl        { titre }
+\tl_set:Nn \l_xephm_fnt_traffic_tl      { traffic }
+\tl_set:Nn \l_xephm_fnt_vahid_tl        { vahid }
+\tl_set:Nn \l_xephm_fnt_vosta_tl        { vosta }
+\tl_set:Nn \l_xephm_fnt_yaghut_tl       { yaghut }
+\tl_set:Nn \l_xephm_fnt_yagut_tl        { yagut }
+\tl_set:Nn \l_xephm_fnt_yas_tl          { yas }
+\tl_set:Nn \l_xephm_fnt_yekan_tl        { yekan }
+\tl_set:Nn \l_xephm_fnt_yermook_tl      { yermook }
+\tl_set:Nn \l_xephm_fnt_zar_tl          { zar }
+\tl_set:Nn \l_xephm_fnt_ziba_tl         { ziba }
+\tl_set:Nn \l_xephm_fnt_default_tl      { default }
+\tl_set:Nn \l_xephm_fnt_noskip_tl       { noskip }
 
+\tl_set:Nn \l_xephm_lig_aalt_tl    { aalt } % Access All Alternatives
+\tl_set:Nn \l_xephm_lig_ccmp_tl    { ccmp } % Glyph Composition/Decomposition
+\tl_set:Nn \l_xephm_lig_dlig_tl    { dlig } % Discretionary Ligatures
+\tl_set:Nn \l_xephm_lig_fina_tl    { fina } % Final (Terminal) Forms
+\tl_set:Nn \l_xephm_lig_init_tl    { init } % Initial Forms
+\tl_set:Nn \l_xephm_lig_locl_tl    { locl } % Localized Forms
+\tl_set:Nn \l_xephm_lig_medi_tl    { medi } % Medial Forms
+\tl_set:Nn \l_xephm_lig_rlig_tl    { rlig } % Required Ligatures
+\tl_set:Nn \l_xephm_lig_default_tl { default }
+
+\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
+\clist_set:Nn \l_xephm_lig_fina_clist    { {  } } % Final (Terminal) Forms
+\clist_set:Nn \l_xephm_lig_init_clist    { {  } } % Initial Forms
+\clist_set:Nn \l_xephm_lig_locl_clist    { {  } } % Localized Forms
+\clist_set:Nn \l_xephm_lig_medi_clist    { {  } } % Medial Forms
+\clist_set:Nn \l_xephm_lig_rlig_clist    { {  } } % Required Ligatures
+\clist_set:Nn \l_xephm_lig_default_clist { {  } }
+
+\clist_set:Nn \l_xephm_lig_names_clist
+  {
+    \l_xephm_lig_aalt_tl , { \l_xephm_lig_aalt_clist } ,
+    \l_xephm_lig_ccmp_tl , { \l_xephm_lig_ccmp_clist } ,
+    \l_xephm_lig_dlig_tl , { \l_xephm_lig_dlig_clist } ,
+    \l_xephm_lig_fina_tl , { \l_xephm_lig_fina_clist } ,
+    \l_xephm_lig_init_tl , { \l_xephm_lig_init_clist } ,
+    \l_xephm_lig_locl_tl , { \l_xephm_lig_locl_clist } ,
+    \l_xephm_lig_medi_tl , { \l_xephm_lig_medi_clist } ,
+    \l_xephm_lig_rlig_tl , { \l_xephm_lig_rlig_clist } ,
+  }
+
 \msg_new:nnn { xepersian-hm } { kashida-character-is-not-available-in-the-main-font }
   {
     Sorry,~ kashida~ character~ is~ not~ available~ in~ the~ main~ font~!
@@ -154,7 +188,6 @@
           } { } { \tl_set:Nx \l_xephm_gap_filler_tl { #1 } }
         \tl_if_empty:NT \l_xephm_gap_filler_tl { \msg_error:nn { xepersian-hm } { specify-value-for-kashida-option } }
         \bool_set_true:N \l_xephm_kashida_hm_fix_bool
-        \tex_input:D { kashida-xepersian-hm.def }
       } ,
 
     linebreakpenalty .code:n =
@@ -162,11 +195,11 @@
         \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_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 } }
+            \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
       } ,
@@ -173,47 +206,71 @@
 
     kashidastretch .code:n =
       {
-        \tl_set:Nn \l_tmpb_tl { #1 }
-        \tl_case:NnTF \l_tmpb_tl
+        \tl_set:Nn \l_tmpa_tl { #1 }
+        \tl_case:NnTF \l_tmpa_tl
           {
-             \l_xephm_kayhan_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
-             \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.131 em plus 0.5 em } }
-             \l_xephm_kayhannavaar_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.129 em plus 0.5 em } }
-             \l_xephm_kayhanpook_tl   { \tl_set:Nn \l_xephm_skip_default_tl { 0.133 em plus 0.5 em } }
-             \l_xephm_kayhansayeh_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.135 em plus 0.5 em } }
-             \l_xephm_khoramshahr_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.128 em plus 0.5 em } }
-             \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.13  em plus 0.5 em } }
-             \l_xephm_niloofar_tl     { \tl_set:Nn \l_xephm_skip_default_tl { 0.132 em plus 0.5 em } }
-             \l_xephm_paatch_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.127 em plus 0.5 em } }
-             \l_xephm_riyaz_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.125 em plus 0.5 em } }
-             \l_xephm_roya_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.142 em plus 0.5 em } }
-             \l_xephm_shafigh_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.143 em plus 0.5 em } }
-             \l_xephm_shafighKurd_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
-             \l_xephm_shafighUzbek_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.123 em plus 0.5 em } }
-             \l_xephm_shiraz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.122 em plus 0.5 em } }
-             \l_xephm_sols_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
-             \l_xephm_tabriz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
-             \l_xephm_titr_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.12  em plus 0.5 em } }
-             \l_xephm_titre_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.121 em plus 0.5 em } }
-             \l_xephm_traffic_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
-             \l_xephm_vahid_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.134 em plus 0.5 em } }
-             \l_xephm_vosta_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.136 em plus 0.5 em } }
-             \l_xephm_yaghut_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.138 em plus 0.5 em } }
-             \l_xephm_yagut_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.137 em plus 0.5 em } }
-             \l_xephm_yas_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
-             \l_xephm_yekan_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.141 em plus 0.5 em } }
-             \l_xephm_yermook_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.139 em plus 0.5 em } }
-             \l_xephm_zar_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.116 em plus 0.5 em } }
-             \l_xephm_ziba_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
-             \l_xephm_default_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
-             \l_xephm_noskip_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0     em plus 0.5 em } }
+             \l_xephm_fnt_kayhan_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
+             \l_xephm_fnt_kayhannavaar_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.129 em plus 0.5 em } }
+             \l_xephm_fnt_kayhanpook_tl   { \tl_set:Nn \l_xephm_skip_default_tl { 0.133 em plus 0.5 em } }
+             \l_xephm_fnt_kayhansayeh_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.135 em plus 0.5 em } }
+             \l_xephm_fnt_khoramshahr_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.128 em plus 0.5 em } }
+             \l_xephm_fnt_khorramshahr_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.13  em plus 0.5 em } }
+             \l_xephm_fnt_niloofar_tl     { \tl_set:Nn \l_xephm_skip_default_tl { 0.132 em plus 0.5 em } }
+             \l_xephm_fnt_paatch_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.127 em plus 0.5 em } }
+             \l_xephm_fnt_riyaz_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.125 em plus 0.5 em } }
+             \l_xephm_fnt_roya_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.142 em plus 0.5 em } }
+             \l_xephm_fnt_shafigh_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.143 em plus 0.5 em } }
+             \l_xephm_fnt_shafighKurd_tl  { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
+             \l_xephm_fnt_shafighUzbek_tl { \tl_set:Nn \l_xephm_skip_default_tl { 0.123 em plus 0.5 em } }
+             \l_xephm_fnt_shiraz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.122 em plus 0.5 em } }
+             \l_xephm_fnt_sols_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
+             \l_xephm_fnt_tabriz_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
+             \l_xephm_fnt_titr_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.12  em plus 0.5 em } }
+             \l_xephm_fnt_titre_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.121 em plus 0.5 em } }
+             \l_xephm_fnt_traffic_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.124 em plus 0.5 em } }
+             \l_xephm_fnt_vahid_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.134 em plus 0.5 em } }
+             \l_xephm_fnt_vosta_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.136 em plus 0.5 em } }
+             \l_xephm_fnt_yaghut_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0.138 em plus 0.5 em } }
+             \l_xephm_fnt_yagut_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.137 em plus 0.5 em } }
+             \l_xephm_fnt_yas_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.126 em plus 0.5 em } }
+             \l_xephm_fnt_yekan_tl        { \tl_set:Nn \l_xephm_skip_default_tl { 0.141 em plus 0.5 em } }
+             \l_xephm_fnt_yermook_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.139 em plus 0.5 em } }
+             \l_xephm_fnt_zar_tl          { \tl_set:Nn \l_xephm_skip_default_tl { 0.116 em plus 0.5 em } }
+             \l_xephm_fnt_ziba_tl         { \tl_set:Nn \l_xephm_skip_default_tl { 0.119 em plus 0.5 em } }
+             \l_xephm_fnt_default_tl      { \tl_set:Nn \l_xephm_skip_default_tl { 0.14  em plus 0.5 em } }
+             \l_xephm_fnt_noskip_tl       { \tl_set:Nn \l_xephm_skip_default_tl { 0     em plus 0.5 em } }
           } { } { \tl_set:Nn \l_xephm_skip_default_tl { #1 } }
       } ,
     kashidastretch .default:n = \tl_set:Nn \l_xephm_skip_default_tl { 0 em plus 0.5 em } ,
+
+    ligatures .code:n =
+      {
+        \tl_set:Nn \l_tmpa_tl { #1 }
+        \tl_case:NnTF \l_tmpa_tl
+          {
+            \l_xephm_lig_aalt_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_aalt_tl } }
+            \l_xephm_lig_ccmp_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_ccmp_tl } }
+            \l_xephm_lig_dlig_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_dlig_tl } }
+            \l_xephm_lig_fina_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_fina_tl } }
+            \l_xephm_lig_init_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_init_tl } }
+            \l_xephm_lig_locl_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_locl_tl } }
+            \l_xephm_lig_medi_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_medi_tl } }
+            \l_xephm_lig_rlig_tl    { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_rlig_tl } }
+            \l_xephm_lig_default_tl { \tl_set:Nx \l_xephm_active_ligs_tl { \l_xephm_lig_default_tl } }
+          } { } { \tl_set:Nn \l_xephm_active_ligs_tl { #1 } }
+        \bool_set_true:N \l_xephm_ligature_bool
+      } ,
+    ligatures .default:n = \tl_set:Nn \l_xephm_active_ligs_tl { \l_xephm_lig_default_tl } ,
+
   }
 
 \ProcessKeysOptions { xepersian-hm }
 
+\bool_if:NT \l_xephm_kashida_hm_fix_bool
+  {
+    \tex_input:D { kashida-xepersian-hm.def }
+  }
+
 \ExplSyntaxOff
  \endinput
 %% 



More information about the tex-live-commits mailing list.