diff options
Diffstat (limited to 'Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex')
-rw-r--r-- | Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex new file mode 100644 index 00000000000..e8f18375b6e --- /dev/null +++ b/Master/texmf-dist/doc/xelatex/xepersian-hm/xepersian-hm-common-kashida.tex @@ -0,0 +1,87 @@ +%% +%% This is file `xepersian-hm-common-kashida.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xepersian-hm.dtx (with options: `xepersian-hm-common-kashida-tex') +%% +%% Copyright (C) 2020 Hossein Movahhedian +%% +%% It may be distributed and/or modified under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +\ProvidesExplFile {xepersian-hm-common-kashida.tex} {2020-09-04} {1.1a} { Fixes~implementation~of~Kashida~in~xepersian~package } + +\bool_if:NT \l_xephm_ligature_bool +{ + \clist_new:N \l_xephm_ligatures_clist + \int_new:N \l_xephm_lig_names_len_int + \int_set:Nn \l_xephm_lig_names_len_int { \clist_count:N \l_xephm_lig_names_clist } + \int_step_inline:nnnn { 1 } { 2 } { \l_xephm_lig_names_len_int } + { + \int_set:Nn \l_tmpa_int { #1 } + \int_set:Nn \l_tmpb_int { \int_eval:n { \l_tmpa_int + 1 } } + \tl_set:Nf \l_tmpa_tl { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpa_int } } + \clist_set:Nx \l_tmpa_clist { { \clist_item:Nn \l_xephm_lig_names_clist { \l_tmpb_int } } } + \bool_if:nT { \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_tmpa_tl || \tl_if_eq_p:NN \l_xephm_active_ligs_tl \l_xephm_lig_default_tl } + { + \clist_put_left:Nx \l_xephm_ligatures_clist { \l_tmpa_clist } + } + } + \clist_map_inline:Nn \l_xephm_ligatures_clist + { + \seq_set_split:Nnn \l_tmpa_seq { = } { #1 } + \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl { } { } + \seq_pop_left:NN \l_tmpa_seq \l_tmpb_tl { } { } + \tl_const:cx { \tl_use:N \l_tmpb_tl } { \char"\l_tmpa_tl \ } + } +} + +\bool_if:NT \l_xephm_linebreakpenalty_bool +{ + %% Partly adapted from LaTeX2e source + \cs_new:Nn \xephm_line_break: { + \if_mode_vertical: + \GenericError{ + \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space + }{ + LaTeX Error: There’s no line here to end + }{ + See the LaTeX manual or LaTeX Companion for explanation. + }{ + Your command was ignored.\MessageBreak + Type \space I <command> <return> \space to replace it~ + with another command,\MessageBreak + or \space <return> \space to continue without it.} + \else: + \l_tmpa_skip \tex_lastskip:D + \tex_unskip:D + \tex_penalty:D -\l_xephm_line_break_penalty_int + \dim_compare:nT { \l_tmpa_skip > \c_zero_skip } + { \skip_horizontal:N \l_tmpa_skip \tex_ignorespaces:D } + \fi: + } + + \NewDocumentCommand { \discouragebadlinebreaks } { O{\l_xephm_line_break_penalty_int} O{\c_xephm_skip_b_tl} m } + { + \IfNoValueF {#1} + { \int_set:Nn \l_xephm_line_break_penalty_int {#1} } + \IfNoValueF {#2} + { \tl_set:Nn \l_xephm_skip_default_tl {#2} } + \xephm_put_line_breaks:n { #3 } + } + + \cs_new_protected:Nn \xephm_put_line_breaks:n + { + \tl_set:Nn \l_xephm_line_break_tl { #1 } + \regex_replace_all:nnN { ([ابپتثجحخچدذرزژسشعغصضفقطظکگلمنوهیـ])+ } { \ \0 \ \c{xephm_line_break:}\ } \l_xephm_line_break_tl + \tl_use:N \l_xephm_line_break_tl + } +} + + \endinput +%% +%% +%% End of file `xepersian-hm-common-kashida.tex'. |