diff options
author | Karl Berry <karl@freefriends.org> | 2020-04-20 21:15:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-04-20 21:15:05 +0000 |
commit | ed3c99cf16da62222e34fc96e0b743b87f2dcd0f (patch) | |
tree | ad6ffe836f3c2162b968a7ccd2450a1b3fa8eeaa /Master/texmf-dist/tex/xelatex/xepersian-hm | |
parent | f84b6e8b6b238868bbf4cdaa80c02d90b8928555 (diff) |
xepersian-hm (20apr20)
git-svn-id: svn://tug.org/texlive/trunk@54816 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian-hm')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def | 305 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty | 184 |
2 files changed, 338 insertions, 151 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def b/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def index ab66aae3083..637816e1552 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def @@ -13,126 +13,265 @@ %% 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 } -% Copyright notice: the following code is partly adapted from the code in -% 'kashida-xepersian.def' from xepersian package (v22.8). +\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 -\ExplSyntaxOn -\ProvidesExplFile {kashida-xepersian-hm.def} {2020-03-26} {0.4} { Fixes~implementation~of~Kashida~in~xepersian~package } - -\int_const:Nn \c_xepersianhm_zwj_int {"200D} % zero-width joiner -\int_const:Nn \c_xepersianhm_lrm_int {"200E} % left-right-mark -\int_const:Nn \c_xepersianhm_two_int {2} % 2 -\int_const:Nn \c_xepersianhm_four_int {4} % 4 -\int_const:Nn \c_xepersianhm_ksh_int {"0640} % kashida -\int_const:Nn \c_xepersianhm_d_int {10} % dual-joiner class -\int_const:Nn \c_xepersianhm_l_int {11} % lam -\int_const:Nn \c_xepersianhm_r_int {12} % right-joiner -\int_const:Nn \c_xepersianhm_a_int {13} % alef -\int_const:Nn \c_xepersianhm_h_int {14} % heh -\int_const:Nn \c_xepersianhm_y_int {15} % yeh -\int_const:Nn \c_xepersianhm_v_int {4096} % vowel or other combining mark (to be ignored) - -\bool_new:N \l_kashida_on_bool -\bool_new:N \l_kashida_hm_fix_bool -\bool_new:N \l_kashida_xb_fix_bool - -\tl_new:N \l_hskip_zero_tl -\tl_new:N \l_hskip_default_tl - -\cs_new:Npn \xepersian_kashida #1 +\int_new:N \l_xephm_counter_int + +\newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class +\newXeTeXintercharclass \c_xephm_l_charclass % lam +\newXeTeXintercharclass \c_xephm_r_charclass % right-joiner +\newXeTeXintercharclass \c_xephm_a_charclass % alef +\newXeTeXintercharclass \c_xephm_y_charclass % yeh + +\tl_new:N \l_xephm_hskip_zero_tl +\tl_new:N \l_xephm_hskip_default_tl + +\dim_new:N \l_xephm_diff_pos_dim + +%% Partly adapted from LaTeX2e source +\cs_new:Nn \xephm_line_break: { + \if_mode_vertical: + \GenericError{ + \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space + }{ + LaTeX Error: There’s no line here to end + }{ + See the LaTeX manual or LaTeX Companion for explanation. + }{ + Your command was ignored.\MessageBreak + Type \space I <command> <return> \space to replace it~ + with another command,\MessageBreak + or \space <return> \space to continue without it.} + \else: + \l_tmpa_skip \tex_lastskip:D + \tex_unskip:D + \tex_penalty:D -\l_xephm_line_break_penalty_int + \dim_compare:nT { \l_tmpa_skip > \c_zero_skip } + { \skip_horizontal:N \l_tmpa_skip \tex_ignorespaces:D } + \fi: +} + +\NewDocumentCommand { \discouragebadlinebreaks } { m } + { + \xephm_put_line_breaks:n { #1 } + } + +\tl_new:N \l_xephm_line_break_tl + +\cs_new_protected:Nn \xephm_put_line_breaks:n + { + \tl_set:Nn \l_xephm_line_break_tl { #1 } + \regex_replace_all:nnN { ([ابپتثجحخچدذرزژسشعغصضفقطظکگلمنوهیـ])+ } { \ \0 \ \c{xephm_line_break:}\ } \l_xephm_line_break_tl + \tl_use:N \l_xephm_line_break_tl + } + +%% Partly adapted from the code provided by David Carlisle in: +%% https://tex.stackexchange.com/questions/356709/how-to-know-the-width-and-fill-the-glue-space-between-two-characters-when-using/356721#356721 +\cs_new:Npn \xephm_kashida_glyph #1 +{ + \bool_if:NT \l_xephm_kashida_hm_fix_bool + { + \c_xephm_lrm_int\tex_penalty:D 10000 + \mode_leave_vertical: + \tex_global:D \tex_advance:D \l_xephm_counter_int \c_one_int + + \tl_set:Nx \l_xephm_pos_tl { pos_\tex_romannumeral:D \l_xephm_counter_int } + \tl_set:Nx \l_xephm_zref_tl { zref_\tex_romannumeral:D \l_xephm_counter_int } + + \zsaveposx{x_i_\l_xephm_zref_tl} + \tl_set:Nx \l_tmpa_tl + { + \iow_now:cx { @auxout } + { + \ExplSyntaxOn + \tl_gset:Nn \exp_after:wN \token_to_str:N \cs:w get_x_i\l_xephm_pos_tl \cs_end: { \zposx{ x_i_\l_xephm_zref_tl } } + \ExplSyntaxOff + } + } + \l_tmpa_tl + \skip_horizontal:n { #1 } + \zsaveposx{x_f_\l_xephm_zref_tl} + \tl_set:Nx \l_tmpa_tl + { + \iow_now:cx { @auxout } + { + \ExplSyntaxOn + \tl_gset:Nn \exp_after:wN \token_to_str:N \cs:w get_x_f\l_xephm_pos_tl \cs_end: { \zposx{ x_f_\l_xephm_zref_tl } } + \ExplSyntaxOff + } + } + \l_tmpa_tl + \exp_after:wN + \if_meaning:w + \cs:w get_x_i\l_xephm_pos_tl \cs_end: \tex_relax:D + \else: + \dim_set:Nn \l_xephm_diff_pos_dim + { + \dim_eval:n { \cs:w get_x_i\l_xephm_pos_tl \cs_end: sp - \cs:w get_x_f\l_xephm_pos_tl \cs_end: sp } + } + \dim_compare:nTF { \l_xephm_diff_pos_dim == 0sp } + { } + { \llap { \resizebox { \l_xephm_diff_pos_dim \tex_relax:D } { \height } { \c_xephm_ksh_int } } } + \fi: + } +} + +%% Partly adapted from the code provided by Jonathan Kew in: +%% https://tug.org/pipermail/xetex/2009-February/012307.html. +%% Somebody notified me that the code in 'kashida-xepersian.def' from xepersian +%% package is an exact copy of Jonathan Kew's code. Being unaware of this, in +%% the earlier versions of this package I made a mistake and acknowledged +%% Vafa Khalighi instead of Jonathan Kew. A sincere thank you to Jonathan Kew +%% for his excellent code. +\cs_new:Npn \xephm_kashida_hrule #1 { - \bool_if:NT \l_kashida_on_bool + \bool_if:NT \l_xephm_kashida_hm_fix_bool { - \c_xepersianhm_lrm_int\c_xepersianhm_zwj_int\tex_penalty:D 10000 - \tex_leaders:D \tex_hrule:D height \XeTeXglyphbounds \c_xepersianhm_two_int - \int_use:N \XeTeXcharglyph \c_xepersianhm_ksh_int depth \XeTeXglyphbounds \c_xepersianhm_four_int - \int_use:N \XeTeXcharglyph \c_xepersianhm_ksh_int \skip_horizontal:n { #1 } - \c_xepersianhm_zwj_int + \c_xephm_lrm_int\c_xephm_zwj_int\tex_penalty:D 10000 + \tex_leaders:D \tex_hrule:D height \XeTeXglyphbounds \c_xephm_two_int + \int_use:N \XeTeXcharglyph \c_xephm_ksh_int depth \XeTeXglyphbounds \c_xephm_four_int + \int_use:N \XeTeXcharglyph \c_xephm_ksh_int \skip_horizontal:n { #1 } + \c_xephm_zwj_int } } \XeTeXinterchartokenstate = 1 -\clist_set:Nn \l_xepersianhm_a_clist { 0622,0623,0625,0627 } % ا، إ، أ، آ -\clist_map_inline:Nn \l_xepersianhm_a_clist +\clist_set:Nn \l_xephm_a_clist { 0622,0623,0625,0627 } % ا، إ، أ، آ +\clist_map_inline:Nn \l_xephm_a_clist { - \XeTeXcharclass "#1 \c_xepersianhm_a_int + \XeTeXcharclass "#1 \c_xephm_a_charclass } -\clist_set:Nn \l_xepersianhm_d_clist { 0626,0628,062A,062B,062C,062D,062E,0633,0634,0635,0636,0637,0638,0639,063A,0640,0641,0642,0643,0645,0646,0647,067E,0686,06A9,06AF } % ئ,ب,ت,ث,ج,ح,خ,س,ش,ص,ض,ط,ظ,ع,غ,ـ,ف,ق,ك,م,ن,ه,پ,چ,ک,گ -\clist_map_inline:Nn \l_xepersianhm_d_clist +\clist_set:Nn \l_xephm_d_clist { 0626,0628,062A,062B,062C,062D,062E,0633,0634,0635,0636,0637,0638,0639,063A,0640,0641,0642,0643,0645,0646,0647,067E,0686,06A9,06AF } % ئ,ب,ت,ث,ج,ح,خ,س,ش,ص,ض,ط,ظ,ع,غ,ـ,ف,ق,ك,م,ن,ه,پ,چ,ک,گ +\clist_map_inline:Nn \l_xephm_d_clist { - \XeTeXcharclass "#1 \c_xepersianhm_d_int + \XeTeXcharclass "#1 \c_xephm_d_charclass } -\clist_set:Nn \l_xepersianhm_l_clist { 0644 } % ل -\clist_map_inline:Nn \l_xepersianhm_l_clist +\clist_set:Nn \l_xephm_l_clist { 0644 } % ل +\clist_map_inline:Nn \l_xephm_l_clist { - \XeTeXcharclass "#1 \c_xepersianhm_l_int + \XeTeXcharclass "#1 \c_xephm_l_charclass } -\clist_set:Nn \l_xepersianhm_r_clist { 0624,0629,062F,0630,0631,0632,0648,0698 } % ؤ,ة,د,ذ,ر,ز,و,ژ -\clist_map_inline:Nn \l_xepersianhm_r_clist +\clist_set:Nn \l_xephm_r_clist { 0624,0629,062F,0630,0631,0632,0648,0698 } % ؤ,ة,د,ذ,ر,ز,و,ژ +\clist_map_inline:Nn \l_xephm_r_clist { - \XeTeXcharclass "#1 \c_xepersianhm_r_int + \XeTeXcharclass "#1 \c_xephm_r_charclass } -\clist_set:Nn \l_xepersianhm_v_clist { 064B,064C,064D,064E,064F,0650,0651,0652 } % ً,ٌ,ٍ,َ,ُ,ِ,ّ,ْ -\clist_map_inline:Nn \l_xepersianhm_v_clist +\clist_set:Nn \l_xephm_y_clist { 0649,064A,06CC } % ی,ي,ى +\clist_map_inline:Nn \l_xephm_y_clist { - \XeTeXcharclass "#1 \c_xepersianhm_v_int + \XeTeXcharclass "#1 \c_xephm_y_charclass } -\clist_set:Nn \l_xepersianhm_y_clist { 0649,064A,06CC } -\clist_map_inline:Nn \l_xepersianhm_y_clist +\msg_new:nnx { xepersian-hm } { value-not-available-for-kashida-option } { - \XeTeXcharclass "#1 \c_xepersianhm_y_int + Sorry,~ value~ `\l_xephm_gap_filler_tl'~ is~ not~ available~ for~ kashida~ option~ yet! } -\XeTeXinterchartoks \c_xepersianhm_y_int \c_xepersianhm_y_int = {\bool_if:NTF \l_kashida_hm_fix_bool {\xepersian_kashida {\l_hskip_default_tl}} {\xepersian_kashida \l_hskip_zero_tl}} -\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_y_int = {\bool_if:NTF \l_kashida_hm_fix_bool {\xepersian_kashida {\l_hskip_default_tl}} {\xepersian_kashida \l_hskip_zero_tl}} -\XeTeXinterchartoks \c_xepersianhm_y_int \c_xepersianhm_d_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_d_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_d_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_l_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_l_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_r_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_d_int \c_xepersianhm_a_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_r_int = {\xepersian_kashida \l_hskip_zero_tl} -\XeTeXinterchartoks \c_xepersianhm_l_int \c_xepersianhm_a_int = {} - -\NewDocumentCommand \KashidaOn {} { \bool_set_true:N \l_kashida_on_bool } -\NewDocumentCommand \KashidaOff {} { \bool_set_false:N \l_kashida_on_bool } - -\NewDocumentCommand \KashidaXBFixOn {} { \bool_set_true:N \l_kashida_xb_fix_bool } -\NewDocumentCommand \KashidaXBFixOff {} { \bool_set_false:N \l_kashida_xb_fix_bool } - -\NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_kashida_hm_fix_bool } -\NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_kashida_hm_fix_bool } +\str_case:VnTF \l_xephm_gap_filler_tl + { + \l_xephm_stretch_glyph_tl + { + \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = + { + \bool_if:NTF \l_xephm_kashida_hm_fix_bool + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_default_tl \c_xephm_zwj_int } + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass = + { + \bool_if:NTF \l_xephm_kashida_hm_fix_bool + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_default_tl \c_xephm_zwj_int } + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + } + \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass = + { \c_xephm_zwj_int \xephm_kashida_glyph \l_xephm_hskip_zero_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass = + { } + } + \l_xephm_stretch_hrule_tl + { + \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = + { + \bool_if:NTF \l_xephm_kashida_hm_fix_bool + { \xephm_kashida_hrule \l_xephm_hskip_default_tl } + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_y_charclass = + { + \bool_if:NTF \l_xephm_kashida_hm_fix_bool + { \xephm_kashida_hrule \l_xephm_hskip_default_tl } + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + } + \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass = + { \xephm_kashida_hrule \l_xephm_hskip_zero_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass = + { } + } + } { } { \msg_error:nn { xepersian-hm } { value-not-available-for-kashida-option } } -\ExplSyntaxOff -\makeatletter -\newif\if@Kashida@on -\newif\if@Kashida@XB@fix -\makeatother -\ExplSyntaxOn +\NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_hm_fix_bool } +\NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_hm_fix_bool } -\KashidaHMFixOn +\tex_let:D \KashidaOn \KashidaHMFixOn +\tex_let:D \KashidaOff \KashidaHMFixOff -\tl_set:Nn \l_hskip_zero_tl { 0 em plus 0.5 em } +\tl_set:Nn \l_xephm_hskip_zero_tl { 0 em plus 0.5 em } -\bool_if:NTF \l_kashida_hm_fix_bool +\bool_if:NTF \l_xephm_kashida_hm_fix_bool { - \tl_if_empty:NT \l_hskip_default_tl { \tl_set:Nn \l_hskip_default_tl { 0.14 em plus 0.5 em } } + \tl_if_empty:NT \l_xephm_hskip_default_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.14 em plus 0.5 em } } } { - \tl_set:NV \l_hskip_default_tl \l_hskip_zero_tl + \tl_set:NV \l_xephm_hskip_default_tl \l_xephm_hskip_zero_tl } -\KashidaOn - \ExplSyntaxOff + +\makeatletter +\newif\if@Kashida@on +\newif\if@Kashida@XB@fix +\makeatother + \endinput %% %% diff --git a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty index 1a685d49694..1a3efc09707 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty @@ -28,85 +28,133 @@ \endinput } \RequirePackage{l3keys2e} +\RequirePackage{graphicx}[2019-11-30] +\RequirePackage{zref-savepos}[2020-03-03] \RequirePackage{xepersian} \ExplSyntaxOn -\ProvidesExplPackage {xepersian-hm} {2020-03-26} {0.4} { Fixes~issues~in~xepersian~package } +\ProvidesExplPackage {xepersian-hm} {2020-04-20} {0.5a} { Fixes~issues~in~xepersian~package } -\tl_set:Nn \l_kayhan_tl { kayhan } -\tl_set:Nn \l_khorramshahr_tl { khorramshahr } -\tl_set:Nn \l_kayhannavaar_tl { kayhannavaar } -\tl_set:Nn \l_kayhanpook_tl { kayhanpook } -\tl_set:Nn \l_kayhansayeh_tl { kayhansayeh } -\tl_set:Nn \l_khoramshahr_tl { khoramshahr } -\tl_set:Nn \l_khorramshahr_tl { khorramshahr } -\tl_set:Nn \l_niloofar_tl { niloofar } -\tl_set:Nn \l_paatch_tl { paatch } -\tl_set:Nn \l_riyaz_tl { riyaz } -\tl_set:Nn \l_roya_tl { roya } -\tl_set:Nn \l_shafigh_tl { shafigh } -\tl_set:Nn \l_shafighKurd_tl { shafighKurd } -\tl_set:Nn \l_shafighUzbek_tl { shafighUzbek } -\tl_set:Nn \l_shiraz_tl { shiraz } -\tl_set:Nn \l_sols_tl { sols } -\tl_set:Nn \l_tabriz_tl { tabriz } -\tl_set:Nn \l_titr_tl { titr } -\tl_set:Nn \l_titre_tl { titre } -\tl_set:Nn \l_traffic_tl { traffic } -\tl_set:Nn \l_vahid_tl { vahid } -\tl_set:Nn \l_vosta_tl { vosta } -\tl_set:Nn \l_yaghut_tl { yaghut } -\tl_set:Nn \l_yagut_tl { yagut } -\tl_set:Nn \l_yas_tl { yas } -\tl_set:Nn \l_yekan_tl { yekan } -\tl_set:Nn \l_yermook_tl { yermook } -\tl_set:Nn \l_zar_tl { zar } -\tl_set:Nn \l_ziba_tl { ziba } -\tl_set:Nn \l_default_tl { default } -\tl_set:Nn \l_noskip_tl { noskip } +\bool_set_false:N \l_xephm_kashida_hm_fix_bool + +\tl_new:N \l_xephm_gap_filler_tl + +\bool_set_false:N \l_xephm_linebreakpenalty_bool + +\int_new:N \l_xephm_line_break_penalty_int +\int_new:N \l_xephm_min_penalty_int +\int_new:N \l_xephm_low_penalty_int +\int_new:N \l_xephm_med_penalty_int +\int_new:N \l_xephm_high_penalty_int +\int_new:N \l_xephm_max_penalty_int + +\int_set:Nn \l_xephm_min_penalty_int { 0 } +\int_set:Nn \l_xephm_low_penalty_int { 8 } +\int_set:Nn \l_xephm_med_penalty_int { 15 } +\int_set:Nn \l_xephm_high_penalty_int { 25 } +\int_set:Nn \l_xephm_max_penalty_int { 10000 } + +\tl_set:Nn \l_xephm_stretch_glyph_tl { glyph } +\tl_set:Nn \l_xephm_stretch_hrule_tl { hrule } + +\tl_set:Nn \l_xephm_kayhan_tl { kayhan } +\tl_set:Nn \l_xephm_khorramshahr_tl { khorramshahr } +\tl_set:Nn \l_xephm_kayhannavaar_tl { kayhannavaar } +\tl_set:Nn \l_xephm_kayhanpook_tl { kayhanpook } +\tl_set:Nn \l_xephm_kayhansayeh_tl { kayhansayeh } +\tl_set:Nn \l_xephm_khoramshahr_tl { khoramshahr } +\tl_set:Nn \l_xephm_khorramshahr_tl { khorramshahr } +\tl_set:Nn \l_xephm_niloofar_tl { niloofar } +\tl_set:Nn \l_xephm_paatch_tl { paatch } +\tl_set:Nn \l_xephm_riyaz_tl { riyaz } +\tl_set:Nn \l_xephm_roya_tl { roya } +\tl_set:Nn \l_xephm_shafigh_tl { shafigh } +\tl_set:Nn \l_xephm_shafighKurd_tl { shafighKurd } +\tl_set:Nn \l_xephm_shafighUzbek_tl { shafighUzbek } +\tl_set:Nn \l_xephm_shiraz_tl { shiraz } +\tl_set:Nn \l_xephm_sols_tl { sols } +\tl_set:Nn \l_xephm_tabriz_tl { tabriz } +\tl_set:Nn \l_xephm_titr_tl { titr } +\tl_set:Nn \l_xephm_titre_tl { titre } +\tl_set:Nn \l_xephm_traffic_tl { traffic } +\tl_set:Nn \l_xephm_vahid_tl { vahid } +\tl_set:Nn \l_xephm_vosta_tl { vosta } +\tl_set:Nn \l_xephm_yaghut_tl { yaghut } +\tl_set:Nn \l_xephm_yagut_tl { yagut } +\tl_set:Nn \l_xephm_yas_tl { yas } +\tl_set:Nn \l_xephm_yekan_tl { yekan } +\tl_set:Nn \l_xephm_yermook_tl { yermook } +\tl_set:Nn \l_xephm_zar_tl { zar } +\tl_set:Nn \l_xephm_ziba_tl { ziba } +\tl_set:Nn \l_xephm_default_tl { default } +\tl_set:Nn \l_xephm_noskip_tl { noskip } \keys_define:nn { xepersian-hm } { - Kashida .code:n = \tex_input:D { kashida-xepersian-hm.def } , - - kashidastretch .code:n = + Kashida .code:n = { \tl_set:Nn \l_tmpa_tl { #1 } \tl_case:NnTF \l_tmpa_tl { - \l_kayhan_tl { \tl_set:Nn \l_hskip_default_tl { 0.14 em plus 0.5 em } } - \l_khorramshahr_tl { \tl_set:Nn \l_hskip_default_tl { 0.131 em plus 0.5 em } } - \l_kayhannavaar_tl { \tl_set:Nn \l_hskip_default_tl { 0.129 em plus 0.5 em } } - \l_kayhanpook_tl { \tl_set:Nn \l_hskip_default_tl { 0.133 em plus 0.5 em } } - \l_kayhansayeh_tl { \tl_set:Nn \l_hskip_default_tl { 0.135 em plus 0.5 em } } - \l_khoramshahr_tl { \tl_set:Nn \l_hskip_default_tl { 0.128 em plus 0.5 em } } - \l_khorramshahr_tl { \tl_set:Nn \l_hskip_default_tl { 0.13 em plus 0.5 em } } - \l_niloofar_tl { \tl_set:Nn \l_hskip_default_tl { 0.132 em plus 0.5 em } } - \l_paatch_tl { \tl_set:Nn \l_hskip_default_tl { 0.127 em plus 0.5 em } } - \l_riyaz_tl { \tl_set:Nn \l_hskip_default_tl { 0.125 em plus 0.5 em } } - \l_roya_tl { \tl_set:Nn \l_hskip_default_tl { 0.142 em plus 0.5 em } } - \l_shafigh_tl { \tl_set:Nn \l_hskip_default_tl { 0.143 em plus 0.5 em } } - \l_shafighKurd_tl { \tl_set:Nn \l_hskip_default_tl { 0.126 em plus 0.5 em } } - \l_shafighUzbek_tl { \tl_set:Nn \l_hskip_default_tl { 0.123 em plus 0.5 em } } - \l_shiraz_tl { \tl_set:Nn \l_hskip_default_tl { 0.122 em plus 0.5 em } } - \l_sols_tl { \tl_set:Nn \l_hskip_default_tl { 0.124 em plus 0.5 em } } - \l_tabriz_tl { \tl_set:Nn \l_hskip_default_tl { 0.119 em plus 0.5 em } } - \l_titr_tl { \tl_set:Nn \l_hskip_default_tl { 0.12 em plus 0.5 em } } - \l_titre_tl { \tl_set:Nn \l_hskip_default_tl { 0.121 em plus 0.5 em } } - \l_traffic_tl { \tl_set:Nn \l_hskip_default_tl { 0.124 em plus 0.5 em } } - \l_vahid_tl { \tl_set:Nn \l_hskip_default_tl { 0.134 em plus 0.5 em } } - \l_vosta_tl { \tl_set:Nn \l_hskip_default_tl { 0.136 em plus 0.5 em } } - \l_yaghut_tl { \tl_set:Nn \l_hskip_default_tl { 0.138 em plus 0.5 em } } - \l_yagut_tl { \tl_set:Nn \l_hskip_default_tl { 0.137 em plus 0.5 em } } - \l_yas_tl { \tl_set:Nn \l_hskip_default_tl { 0.126 em plus 0.5 em } } - \l_yekan_tl { \tl_set:Nn \l_hskip_default_tl { 0.141 em plus 0.5 em } } - \l_yermook_tl { \tl_set:Nn \l_hskip_default_tl { 0.139 em plus 0.5 em } } - \l_zar_tl { \tl_set:Nn \l_hskip_default_tl { 0.116 em plus 0.5 em } } - \l_ziba_tl { \tl_set:Nn \l_hskip_default_tl { 0.119 em plus 0.5 em } } - \l_default_tl { \tl_set:Nn \l_hskip_default_tl { 0.14 em plus 0.5 em } } - \l_noskip_tl { \tl_set:Nn \l_hskip_default_tl { 0 em plus 0.5 em } } - } { } { \tl_set:Nn \l_hskip_default_tl { #1 } } + \l_xephm_stretch_glyph_tl { \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_glyph_tl } } + \l_xephm_stretch_hrule_tl { \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_hrule_tl } } + } { } { \tl_set:Nn \l_xephm_filler_default_tl { #1 } } + \bool_set_true:N \l_xephm_kashida_hm_fix_bool + \tex_input:D { kashida-xepersian-hm.def } + } , + + linebreakpenalty .code:n = + { + \int_set:Nn \l_tmpa_int { #1 } + \int_case:nnTF \l_tmpa_int + { + \l_xephm_min_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_min_penalty_int } } + \l_xephm_low_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_low_penalty_int } } + \l_xephm_med_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_med_penalty_int } } + \l_xephm_high_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_high_penalty_int } } + \l_xephm_max_penalty_int { \int_set:Nn \l_xephm_line_break_penalty_int { \l_xephm_max_penalty_int } } + } { } { \int_set:Nn \l_xephm_line_break_penalty_int { #1 } } + \bool_set_true:N \l_xephm_linebreakpenalty_bool + } , + + kashidastretch .code:n = + { + \tl_set:Nn \l_tmpb_tl { #1 } + \tl_case:NnTF \l_tmpb_tl + { + \l_xephm_kayhan_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.14 em plus 0.5 em } } + \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.131 em plus 0.5 em } } + \l_xephm_kayhannavaar_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.129 em plus 0.5 em } } + \l_xephm_kayhanpook_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.133 em plus 0.5 em } } + \l_xephm_kayhansayeh_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.135 em plus 0.5 em } } + \l_xephm_khoramshahr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.128 em plus 0.5 em } } + \l_xephm_khorramshahr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.13 em plus 0.5 em } } + \l_xephm_niloofar_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.132 em plus 0.5 em } } + \l_xephm_paatch_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.127 em plus 0.5 em } } + \l_xephm_riyaz_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.125 em plus 0.5 em } } + \l_xephm_roya_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.142 em plus 0.5 em } } + \l_xephm_shafigh_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.143 em plus 0.5 em } } + \l_xephm_shafighKurd_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.126 em plus 0.5 em } } + \l_xephm_shafighUzbek_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.123 em plus 0.5 em } } + \l_xephm_shiraz_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.122 em plus 0.5 em } } + \l_xephm_sols_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.124 em plus 0.5 em } } + \l_xephm_tabriz_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.119 em plus 0.5 em } } + \l_xephm_titr_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.12 em plus 0.5 em } } + \l_xephm_titre_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.121 em plus 0.5 em } } + \l_xephm_traffic_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.124 em plus 0.5 em } } + \l_xephm_vahid_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.134 em plus 0.5 em } } + \l_xephm_vosta_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.136 em plus 0.5 em } } + \l_xephm_yaghut_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.138 em plus 0.5 em } } + \l_xephm_yagut_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.137 em plus 0.5 em } } + \l_xephm_yas_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.126 em plus 0.5 em } } + \l_xephm_yekan_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.141 em plus 0.5 em } } + \l_xephm_yermook_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.139 em plus 0.5 em } } + \l_xephm_zar_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.116 em plus 0.5 em } } + \l_xephm_ziba_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.119 em plus 0.5 em } } + \l_xephm_default_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0.14 em plus 0.5 em } } + \l_xephm_noskip_tl { \tl_set:Nn \l_xephm_hskip_default_tl { 0 em plus 0.5 em } } + } { } { \tl_set:Nn \l_xephm_hskip_default_tl { #1 } } } , - kashidastretch .default:n = \tl_set:Nn \l_hskip_default_tl { 0 em plus 0.5 em } , + kashidastretch .default:n = \tl_set:Nn \l_xephm_hskip_default_tl { 0 em plus 0.5 em } , } \ProcessKeysOptions { xepersian-hm } |