texlive[54900] Master/texmf-dist: xepersian-hm (26apr20)

commits+karl at tug.org commits+karl at tug.org
Sun Apr 26 23:44:23 CEST 2020


Revision: 54900
          http://tug.org/svn/texlive?view=revision&revision=54900
Author:   karl
Date:     2020-04-26 23:44:23 +0200 (Sun, 26 Apr 2020)
Log Message:
-----------
xepersian-hm (26apr20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-example.pdf
    trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex
    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/source/xelatex/xepersian-hm/xepersian-hm.ins
    trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def
    trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt	2020-04-26 21:44:05 UTC (rev 54899)
+++ trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/README.txt	2020-04-26 21:44:23 UTC (rev 54900)
@@ -30,7 +30,6 @@
 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.
-%% File: xepersian-hm.dtx
 %% 
 %%
 %% End of file `README.txt'.

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

Modified: trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex	2020-04-26 21:44:05 UTC (rev 54899)
+++ trunk/Master/texmf-dist/doc/xelatex/xepersian-hm/kashida-example.tex	2020-04-26 21:44:23 UTC (rev 54900)
@@ -30,10 +30,20 @@
 \defpersianfont\HMXKayhanOl[Scale=4.5]{HM XKayhan Outline}
 \defpersianfont\HMXKayhanSd[Scale=4.5]{HM XKayhan Shadow}
 
+% \def\SampleText{\discouragebadlinebreaks[8][0.14 em plus 5.5 em]{
+%  راهی جایی تابی چاپی چاههی تلاشهایی
+%  شتابهایی تابی چاپی راهی تلاشهــایی
+%  که کتابهایی که کلاههایی که کتابهایی }}
+
+% \def\SampleText{\discouragebadlinebreaks[10][0.12 em plus 5.5 em]{
+%  راهی جایی تابی چاپی چاههی تلاشهایی
+%  شتابهایی تابی چاپی راهی تلاشهــایی
+%  که کتابهایی که کلاههایی که کتابهایی }}
+
 \def\SampleText{\discouragebadlinebreaks{
- راهی جایی تابی چاپی چاههی تلاشهایی
- شتابهایی تابی چاپی راهی تلاشهــایی
- که کتابهایی که کلاههایی که کتابهایی }}
+  راهی جایی تابی چاپی چاههی تلاشهایی
+  شتابهایی تابی چاپی راهی تلاشهــایی
+  که کتابهایی که کلاههایی که کتابهایی }}
 
 \setlength\parindent{0pt}
 \pagestyle{empty}

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-04-26 21:44:05 UTC (rev 54899)
+++ trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.dtx	2020-04-26 21:44:23 UTC (rev 54900)
@@ -27,41 +27,20 @@
 \fi
 %</internal>
 %
-%% File: xepersian-hm.dtx
-%
-% Copyright (C) 2020 Hossein Movahhedian
-%
-% It may be distributed and/or modified under the LaTeX Project Public License,
-% version 1.3c or higher (your choice). The latest version of
-% this license is at: http://www.latex-project.org/lppl.txt
-%
-%<*driver|package>
-% The version of expl3 required is tested as early as possible, as
-% some really old versions do not define \ProvidesExplPackage.
-\NeedsTeXFormat{LaTeX2e}
-\RequirePackage{expl3}[2020-03-06]
-%<package>\@ifpackagelater{expl3}{2020-03-06}
-%<package>  {}
-%<package>  {%
-%<package>    \PackageError{xepersian-hm}{Support package l3kernel too old}
-%<package>      {%
-%<package>        Please install an up to date version of l3kernel\MessageBreak
-%<package>        using your TeX package manager or from CTAN.\MessageBreak
-%<package>        \MessageBreak
-%<package>        Loading xtemplate will abort!%
-%<package>      }%
-%<package>    \endinput
-%<package>  }
-%</driver|package>
+%    \begin{macrocode}
 %<*driver>
-\documentclass[full]{l3doc}
+\documentclass[full]{ltxdoc}
 \usepackage{longtable}
 \usepackage{hypdoc}
 \addtolength{\hoffset}{-10mm}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
 \begin{document}
   \DocInput{\jobname.dtx}
 \end{document}
 %</driver>
+%    \end{macrocode}
 % \fi
 %
 % \title{^^A
@@ -77,10 +56,8 @@
 %    }^^A
 % }
 % 
-% \date{Released 2020-04-20 \qquad v0.5a}
+% \date{Released 2020-04-26 \qquad v0.5b}
 % 
-% \begin{documentation}
-% 
 % \maketitle
 % 
 % Kashida feature in \textsf{xepersian} has problems with some fonts such as \texttt{HM Series}
@@ -116,15 +93,29 @@
 % 
 % The options available in \textsf{xepersian-hm} are:
 % \begin{itemize}
-%   \item \texttt{Kashida}: which implements kashida feature with two possible values:
+%   \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.
+%       \item \texttt{glyph}: \\
+%         which uses the \texttt{Kashida} character to stretch the text.
+%         With this option you should run \texttt{xelatex} thrice. For example: \\
+% 
+%         \texttt{rm -f kashida-example.aux \\
+%         xelatex kashida-example.tex \\
+%         xelatex kashida-example.tex \\
+%         xelatex kashida-example.tex}
+% 
 %         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.
+% 
+%       \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.
+% 
+%   \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:
@@ -134,10 +125,10 @@
 %       \texttt{low}:    & \texttt{8} \\
 %       \texttt{medium}: & \texttt{15} \\
 %       \texttt{high}:   & \texttt{25} \\
-%       \texttt{max}:    & \texttt{10000} \\
+%       \texttt{max}:    & \texttt{10000}
 %     \end{longtable}
-% 
-%   \item \texttt{kashidastretch}: which specifies the amount of extra stretching
+%   \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:
@@ -183,32 +174,54 @@
 % \section{Commands}
 % 
 % \begin{description}
-%   \item \verb|\discouragebadlinebreaks{|{\it text}\verb|}|  {\it text} may not contain paragraph breaks.
+%   \item \verb|\discouragebadlinebreaks[linebreakpenalty][kashidastretch]{|{\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.
+%     The optional arguments \texttt{linebreakpenalty} and \texttt{kashidastretch} locally specify the value of the penalty and the amount
+%     of extra stretching for some combinations of characters respectively as discussed previously. For example:
+% 
+%     \texttt{\bslash discouragebadlinebreaks[9][0.12 em plus 0.5 em]\{\dots\}}
 % \end{description}
 %
-% \end{documentation}
+% \section{\texttt{xepersian-hm} Implementation}
 %
-%\begin{implementation}
+% \subsection{File: \texttt{xepersian-hm.sty}}
 %
-% \section{\pkg{xepersian-hm} Implementation}
-%
-% \subsection{File: \file{xepersian-hm.sty}}
-%
 %    \begin{macrocode}
-%<*package>
-%    \end{macrocode}
-%
-%    \begin{macrocode}
+%<*xepersian-hm>
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}[2020-03-06]
+\@ifpackagelater{expl3}{2020-03-06}
+  {}
+  {%
+    \PackageError{xepersian-hm}{Support package l3kernel too old}
+      {%
+        Please install an up to date version of l3kernel\MessageBreak
+        using your TeX package manager or from CTAN.\MessageBreak
+        \MessageBreak
+        Loading xtemplate will abort!%
+      }%
+    \endinput
+  }
 \RequirePackage{l3keys2e}
 \RequirePackage{graphicx}[2019-11-30]
 \RequirePackage{zref-savepos}[2020-03-03]
 \RequirePackage{xepersian}
 \ExplSyntaxOn
-\ProvidesExplPackage {xepersian-hm} {2020-04-20} {0.5a} { Fixes~issues~in~xepersian~package }
+\ProvidesExplPackage {xepersian-hm} {2020-04-26} {0.5b} { Fixes~issues~in~xepersian~package }
 
+\tl_new:N \l_xephm_main_font_full_tl
+\tl_new:N \l_xephm_main_font_name_tl
+\int_const:Nn \c_xephm_ksh_int {"0640} % kashida
+\int_new:N \l_xephm_kashida_slot_int
+
+\tl_new:N \l_xephm_skip_default_tl
+
+\tl_const:Nn \c_xephm_skip_a_tl { 0 em plus 0.5 em }
+
+\tl_const:Nn \c_xephm_skip_b_tl { 0.14 em plus 5.5 em }
+
 \bool_set_false:N \l_xephm_kashida_hm_fix_bool
 
 \tl_new:N \l_xephm_gap_filler_tl
@@ -263,21 +276,43 @@
 \tl_set:Nn \l_xephm_default_tl      { default }
 \tl_set:Nn \l_xephm_noskip_tl       { noskip }
 
+\msg_new:nnx { xepersian-hm } { kashida-character-is-not-available-in-the-main-font }
+  {
+    Sorry,~ kashida~ character~ is~ not~ available~ in~ the~ main~ font~!
+  }
+
 \keys_define:nn { xepersian-hm }
   {
-    Kashida .code:n = 
+    Kashida .code:n =
       {
         \tl_set:Nn \l_tmpa_tl { #1 }
         \tl_case:NnTF \l_tmpa_tl
           {
-            \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 } }
+            \l_xephm_stretch_glyph_tl
+              {
+                \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_glyph_tl }
+                \AtBeginDocument
+                  {
+                    \tl_set:Nx \l_xephm_main_font_full_tl { \tex_fontname:D \tex_the:D \tex_font:D }
+                    \tl_set:Nx \l_xephm_main_font_name_tl { \l_xephm_main_font_full_tl }
+                    \regex_replace_once:nnN { ^"([^/]+)/.* } { \1 } \l_xephm_main_font_name_tl
+                    \int_set:Nn \l_xephm_kashida_slot_int { \xetex_charglyph:D \c_xephm_ksh_int }
+                    \int_compare:nT { \l_xephm_kashida_slot_int = \c_zero_int }
+                      {
+                        \msg_error:nn { xepersian-hm } { kashida-character-is-not-available-in-the-main-font }
+                      }
+                  }
+              }
+            \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 }
       } ,
 
-    linebreakpenalty .code:n = 
+    linebreakpenalty .code:n =
       {
         \int_set:Nn \l_tmpa_int { #1 }
         \int_case:nnTF \l_tmpa_int
@@ -296,40 +331,40 @@
         \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 } }
+             \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 } }
+          } { } { \tl_set:Nn \l_xephm_skip_default_tl { #1 } }
       } ,
-    kashidastretch .default:n = \tl_set:Nn \l_xephm_hskip_default_tl { 0 em plus 0.5 em } ,
+    kashidastretch .default:n = \tl_set:Nn \l_xephm_skip_default_tl { 0 em plus 0.5 em } ,
   }
 
 \ProcessKeysOptions { xepersian-hm }
@@ -336,24 +371,19 @@
 
 \ExplSyntaxOff
  \endinput
+%</xepersian-hm>
 %    \end{macrocode}
 %
+% \subsection{File: \texttt{kashida-xepersian-hm.def}}
 %    \begin{macrocode}
-%</package>
-%    \end{macrocode}
-%
-% \subsection{File: \file{kashida-xepersian-hm.def}}
-%
-%    \begin{macrocode}
 %<*kashida-xepersian-hm>
 \ExplSyntaxOn
-\ProvidesExplFile {kashida-xepersian-hm.def} {2020-04-20} {0.5a} { Fixes~implementation~of~Kashida~in~xepersian~package }
+\ProvidesExplFile {kashida-xepersian-hm.def} {2020-04-26} {0.5b} { 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
 
@@ -363,9 +393,6 @@
 \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
@@ -391,9 +418,13 @@
   \fi:
 }
 
-\NewDocumentCommand { \discouragebadlinebreaks } { m }
+\NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m }
  {
-  \xephm_put_line_breaks:n { #1 }
+  \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 }
  }
 
 \tl_new:N \l_xephm_line_break_tl
@@ -519,31 +550,31 @@
         \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 }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
           }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass =
           {
             \bool_if:NTF \l_xephm_kashida_hm_fix_bool
-            { \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 }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
           }
         \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass =
-          { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass =
-          { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass =
           { }
       }
@@ -552,31 +583,31 @@
         \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 }
+            { \xephm_kashida_hrule \l_xephm_skip_default_tl }
+            { \xephm_kashida_hrule \c_xephm_skip_a_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 }
+            { \xephm_kashida_hrule \l_xephm_skip_default_tl }
+            { \xephm_kashida_hrule \c_xephm_skip_a_tl }
           }
         \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass =
           { }
       }
@@ -588,14 +619,12 @@
 \tex_let:D \KashidaOn \KashidaHMFixOn
 \tex_let:D \KashidaOff \KashidaHMFixOff
 
-\tl_set:Nn \l_xephm_hskip_zero_tl { 0 em plus 0.5 em }
-
 \bool_if:NTF \l_xephm_kashida_hm_fix_bool
   {
-    \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_if_empty:NT \l_xephm_skip_default_tl { \tl_set:Nn \l_xephm_skip_default_tl  { 0.14 em plus 0.5 em } }
   }
   {
-    \tl_set:NV \l_xephm_hskip_default_tl  \l_xephm_hskip_zero_tl
+    \tl_set:NV \l_xephm_skip_default_tl  \c_xephm_skip_a_tl
   }
 
 \ExplSyntaxOff
@@ -607,19 +636,22 @@
 
  \endinput
 %</kashida-xepersian-hm>
-%    \end{macrocode}
+%    \end{macrocode} 
 %
-%\end{implementation}
+% \section*{Acknowledgements}
+% 
+% Todo
 %
-% \typeout{***************************************************}
-% \typeout{*}
-% \typeout{* To finish the installation you have to move the}
-% \typeout{* following files into a directory searched by TeX:}
-% \typeout{*}
-% \typeout{* \space\space *.def, *.sty }
-% \typeout{*}
-% \typeout{* Documentation is in xepersian-hm.pdf}
-% \typeout{*}
-% \typeout{***************************************************}
+% \section*{Change History}
 %
-\endinput
+% Todo
+%
+% \section*{References}
+%
+% Todo
+%
+% \section*{Index}
+%
+% Todo
+%
+% \Finale

Modified: trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins
===================================================================
--- trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins	2020-04-26 21:44:05 UTC (rev 54899)
+++ trunk/Master/texmf-dist/source/xelatex/xepersian-hm/xepersian-hm.ins	2020-04-26 21:44:23 UTC (rev 54900)
@@ -11,7 +11,8 @@
 \fi
 
 \let\jobname\relax
-\input l3docstrip.tex
+% \input l3docstrip.tex
+\input docstrip.tex
 \askforoverwritefalse
 
 \preamble
@@ -29,8 +30,25 @@
 
 \keepsilent
 
-\generate{\file{xepersian-hm.sty} {\from{xepersian-hm.dtx} {package}}}
+\generate{\file{xepersian-hm.sty} {\from{xepersian-hm.dtx} {xepersian-hm}}}
 \generate{\file{README.txt} {\from{xepersian-hm.dtx} {README}}}
 \generate{\file{kashida-xepersian-hm.def} {\from{xepersian-hm.dtx} {kashida-xepersian-hm}}}
 
+\obeyspaces
+\Msg{******************************************************}
+\Msg{*                                                    *}
+\Msg{* To finish the installation you have to move the    *}
+\Msg{* following files into a directory searched by TeX:  *}
+\Msg{*                                                    *}
+\Msg{* \space\space *.def, *.sty                          *}
+\Msg{*                                                    *}
+\Msg{* To produce the documentation run the file          *}
+\Msg{* xepersian-hm.dtx through XeLaTeX.                  *}
+\Msg{*                                                    *}
+\Msg{* Happy TeXing!                                      *}
+\Msg{*                                                    *}
+\Msg{* Documentation is in xepersian-hm.pdf               *}
+\Msg{*                                                    *}
+\Msg{******************************************************}
+
 \endbatchfile

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-04-26 21:44:05 UTC (rev 54899)
+++ trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def	2020-04-26 21:44:23 UTC (rev 54900)
@@ -12,15 +12,13 @@
 %% version 1.3c or higher (your choice). The latest version of
 %% this license is at: http://www.latex-project.org/lppl.txt
 %% 
-%% File: xepersian-hm.dtx
 \ExplSyntaxOn
-\ProvidesExplFile {kashida-xepersian-hm.def} {2020-04-20} {0.5a} { Fixes~implementation~of~Kashida~in~xepersian~package }
+\ProvidesExplFile {kashida-xepersian-hm.def} {2020-04-26} {0.5b} { 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
 
@@ -30,9 +28,6 @@
 \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
@@ -58,9 +53,13 @@
   \fi:
 }
 
-\NewDocumentCommand { \discouragebadlinebreaks } { m }
+\NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m }
  {
-  \xephm_put_line_breaks:n { #1 }
+  \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 }
  }
 
 \tl_new:N \l_xephm_line_break_tl
@@ -186,31 +185,31 @@
         \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 }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
           }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass =
           {
             \bool_if:NTF \l_xephm_kashida_hm_fix_bool
-            { \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 }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_skip_default_tl \c_xephm_zwj_int }
+            { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
           }
         \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass =
-          { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass =
-          { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_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 }
+          { \c_xephm_zwj_int \xephm_kashida_glyph \c_xephm_skip_a_tl \c_xephm_zwj_int }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass =
           { }
       }
@@ -219,31 +218,31 @@
         \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 }
+            { \xephm_kashida_hrule \l_xephm_skip_default_tl }
+            { \xephm_kashida_hrule \c_xephm_skip_a_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 }
+            { \xephm_kashida_hrule \l_xephm_skip_default_tl }
+            { \xephm_kashida_hrule \c_xephm_skip_a_tl }
           }
         \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass =
-          { \xephm_kashida_hrule \l_xephm_hskip_zero_tl }
+          { \xephm_kashida_hrule \c_xephm_skip_a_tl }
         \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass =
           { }
       }
@@ -255,14 +254,12 @@
 \tex_let:D \KashidaOn \KashidaHMFixOn
 \tex_let:D \KashidaOff \KashidaHMFixOff
 
-\tl_set:Nn \l_xephm_hskip_zero_tl { 0 em plus 0.5 em }
-
 \bool_if:NTF \l_xephm_kashida_hm_fix_bool
   {
-    \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_if_empty:NT \l_xephm_skip_default_tl { \tl_set:Nn \l_xephm_skip_default_tl  { 0.14 em plus 0.5 em } }
   }
   {
-    \tl_set:NV \l_xephm_hskip_default_tl  \l_xephm_hskip_zero_tl
+    \tl_set:NV \l_xephm_skip_default_tl  \c_xephm_skip_a_tl
   }
 
 \ExplSyntaxOff

Modified: trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty
===================================================================
--- trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty	2020-04-26 21:44:05 UTC (rev 54899)
+++ trunk/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty	2020-04-26 21:44:23 UTC (rev 54900)
@@ -4,7 +4,7 @@
 %%
 %% The original source files were:
 %%
-%% xepersian-hm.dtx  (with options: `package')
+%% xepersian-hm.dtx  (with options: `xepersian-hm')
 %% 
 %% Copyright (C) 2020 Hossein Movahhedian
 %% 
@@ -12,7 +12,6 @@
 %% version 1.3c or higher (your choice). The latest version of
 %% this license is at: http://www.latex-project.org/lppl.txt
 %% 
-%% File: xepersian-hm.dtx
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}[2020-03-06]
 \@ifpackagelater{expl3}{2020-03-06}
@@ -32,8 +31,19 @@
 \RequirePackage{zref-savepos}[2020-03-03]
 \RequirePackage{xepersian}
 \ExplSyntaxOn
-\ProvidesExplPackage {xepersian-hm} {2020-04-20} {0.5a} { Fixes~issues~in~xepersian~package }
+\ProvidesExplPackage {xepersian-hm} {2020-04-26} {0.5b} { Fixes~issues~in~xepersian~package }
 
+\tl_new:N \l_xephm_main_font_full_tl
+\tl_new:N \l_xephm_main_font_name_tl
+\int_const:Nn \c_xephm_ksh_int {"0640} % kashida
+\int_new:N \l_xephm_kashida_slot_int
+
+\tl_new:N \l_xephm_skip_default_tl
+
+\tl_const:Nn \c_xephm_skip_a_tl { 0 em plus 0.5 em }
+
+\tl_const:Nn \c_xephm_skip_b_tl { 0.14 em plus 5.5 em }
+
 \bool_set_false:N \l_xephm_kashida_hm_fix_bool
 
 \tl_new:N \l_xephm_gap_filler_tl
@@ -88,6 +98,11 @@
 \tl_set:Nn \l_xephm_default_tl      { default }
 \tl_set:Nn \l_xephm_noskip_tl       { noskip }
 
+\msg_new:nnx { xepersian-hm } { kashida-character-is-not-available-in-the-main-font }
+  {
+    Sorry,~ kashida~ character~ is~ not~ available~ in~ the~ main~ font~!
+  }
+
 \keys_define:nn { xepersian-hm }
   {
     Kashida .code:n =
@@ -95,8 +110,25 @@
         \tl_set:Nn \l_tmpa_tl { #1 }
         \tl_case:NnTF \l_tmpa_tl
           {
-            \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 } }
+            \l_xephm_stretch_glyph_tl
+              {
+                \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_glyph_tl }
+                \AtBeginDocument
+                  {
+                    \tl_set:Nx \l_xephm_main_font_full_tl { \tex_fontname:D \tex_the:D \tex_font:D }
+                    \tl_set:Nx \l_xephm_main_font_name_tl { \l_xephm_main_font_full_tl }
+                    \regex_replace_once:nnN { ^"([^/]+)/.* } { \1 } \l_xephm_main_font_name_tl
+                    \int_set:Nn \l_xephm_kashida_slot_int { \xetex_charglyph:D \c_xephm_ksh_int }
+                    \int_compare:nT { \l_xephm_kashida_slot_int = \c_zero_int }
+                      {
+                        \msg_error:nn { xepersian-hm } { kashida-character-is-not-available-in-the-main-font }
+                      }
+                  }
+              }
+            \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 }
@@ -121,40 +153,40 @@
         \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 } }
+             \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 } }
+          } { } { \tl_set:Nn \l_xephm_skip_default_tl { #1 } }
       } ,
-    kashidastretch .default:n = \tl_set:Nn \l_xephm_hskip_default_tl { 0 em plus 0.5 em } ,
+    kashidastretch .default:n = \tl_set:Nn \l_xephm_skip_default_tl { 0 em plus 0.5 em } ,
   }
 
 \ProcessKeysOptions { xepersian-hm }



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