diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-31 21:12:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-31 21:12:25 +0000 |
commit | bdb7cf7bcce7df41192e60afe8dc97f81a714044 (patch) | |
tree | 6cf81eb83858d30a39d4808407d0505d16f35b0b /Master/texmf-dist/tex/xelatex | |
parent | 6edc5f76fda7bebde980ba28e45866598a951d8f (diff) |
xepersian-hm (31may20)
git-svn-id: svn://tug.org/texlive/trunk@55365 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def | 169 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty | 35 |
2 files changed, 111 insertions, 93 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 d3e96f981f7..e936a9d2a8d 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,7 +13,7 @@ %% this license is at: http://www.latex-project.org/lppl.txt %% \ExplSyntaxOn -\ProvidesExplFile {kashida-xepersian-hm.def} {2020-05-20} {0.5f} { Fixes~implementation~of~Kashida~in~xepersian~package } +\ProvidesExplFile {kashida-xepersian-hm.def} {2020-05-31} {1.0a} { Fixes~implementation~of~Kashida~in~xepersian~package } \newXeTeXintercharclass \c_xephm_d_charclass % dual-joiner class \newXeTeXintercharclass \c_xephm_l_charclass % lam @@ -135,24 +135,45 @@ } } -%% Partly adapted from the code provided by Jonathan Kew in: -%% https://tug.org/pipermail/xetex/2009-February/012307.html. -%% Somebody notified me that the code in 'kashida-xepersian.def' from xepersian -%% package is an exact copy of Jonathan Kew's code. Being unaware of this, in -%% the earlier versions of this package I made a mistake and acknowledged -%% Vafa Khalighi instead of Jonathan Kew. A sincere thank you to Jonathan Kew -%% for his excellent code. -\cs_new:Npn \xephm_kashida_hrule #1 - { - \bool_if:NT \l_xephm_kashida_hm_fix_bool +\cs_new:Npn \xephm_kashida_leaders #1 +{ + \bool_if:NT \l_xephm_kashida_hm_fix_bool { - \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 + \tl_if_eq:NNTF \l_xephm_gap_filler_tl \l_xephm_stretch_leaders_glyph_tl + { + \tl_set:Nx \l_xephm_font_full_tl { \tex_fontname:D \tex_the:D \tex_font:D } + \tl_set:Nx \l_xephm_font_name_tl { \l_xephm_font_full_tl } + \tl_set:Nx \l_xephm_font_init_tl { \l_xephm_font_name_tl } + \regex_replace_once:nnN { ^"\[?(HM)[\_\ ](X|F).* } { \1\2 } \l_xephm_font_init_tl\relax + \tl_set:Nn \l_tmpa_tl { HMF } + \tl_set:Nn \l_tmpb_tl { HMX } + \bool_if:nTF { \str_if_eq_p:NN { \l_xephm_font_init_tl } { \l_tmpa_tl } || \str_if_eq_p:NN { \l_xephm_font_init_tl } { \l_tmpb_tl } } + { + \hbox_set:Nn \l_xephm_ksh_box { \XeTeXglyph\XeTeXglyphindex"kashida" } + \c_xephm_zwj_int \tex_penalty:D 10000 + \tex_leaders:D \copy\l_xephm_ksh_box \skip_horizontal:n { #1 } + \c_xephm_zwj_int + } + { + \msg_error:nnx { xepersian-hm } { hm-series-font-not-found } { \l_xephm_font_name_tl } + } + } + { + %% 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. + \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 @@ -186,81 +207,57 @@ \XeTeXcharclass "#1 \c_xephm_y_charclass } -\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_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_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 \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 \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 \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 \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 \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 \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 \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 \c_xephm_skip_a_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_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_skip_default_tl } - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - } - \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass = - { \xephm_kashida_hrule \c_xephm_skip_a_tl } - \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass = - { } - } +\tl_if_eq:NNTF \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_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_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 \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 \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 \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 \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 \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 \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 \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 \c_xephm_skip_a_tl \c_xephm_zwj_int } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass = { } +} +{ + \bool_if:nTF { + \tl_if_eq_p:NN \l_xephm_gap_filler_tl \l_xephm_stretch_leaders_glyph_tl || + \tl_if_eq_p:NN \l_xephm_gap_filler_tl \l_xephm_stretch_leaders_hrule_tl } { - \msg_warning:nnn { xepersian-hm } { warning-experimental-feature } { Kashida=glyph } + \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_y_charclass = { + \bool_if:NTF \l_xephm_kashida_hm_fix_bool + { \xephm_kashida_leaders \l_xephm_skip_default_tl } + { \xephm_kashida_leaders \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_leaders \l_xephm_skip_default_tl } + { \xephm_kashida_leaders \c_xephm_skip_a_tl } + } + \XeTeXinterchartoks \c_xephm_y_charclass \c_xephm_d_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_d_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_d_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_l_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_l_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_r_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_d_charclass \c_xephm_a_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_r_charclass = { \xephm_kashida_leaders \c_xephm_skip_a_tl } + \XeTeXinterchartoks \c_xephm_l_charclass \c_xephm_a_charclass = { } } { \msg_error:nnx { xepersian-hm } { error-value-not-available-for-kashida-option } { \l_xephm_gap_filler_tl } } +} \NewDocumentCommand \KashidaHMFixOn {} { \bool_set_true:N \l_xephm_kashida_hm_fix_bool } \NewDocumentCommand \KashidaHMFixOff {} { \bool_set_false:N \l_xephm_kashida_hm_fix_bool } 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 ba57d9bfd3f..cc493c22a31 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty @@ -31,7 +31,9 @@ \RequirePackage{zref-savepos}[2020-03-03] \RequirePackage{xepersian} \ExplSyntaxOn -\ProvidesExplPackage {xepersian-hm} {2020-05-20} {0.5f} { Fixes~issues~in~xepersian~package } +\ProvidesExplPackage {xepersian-hm} {2020-05-31} {1.0a} { Fixes~issues~in~xepersian~package } + +\box_new:N \l_xephm_ksh_box \int_const:Nn \c_xephm_ksh_int {"0640} % kashida \int_const:Nn \c_xephm_lrm_int {"200E} % left-right-mark @@ -60,6 +62,9 @@ \tl_new:N \l_xephm_main_font_full_tl \tl_new:N \l_xephm_main_font_name_tl +\tl_new:N \l_xephm_font_full_tl +\tl_new:N \l_xephm_font_name_tl + \tl_new:N \l_xephm_skip_default_tl \tl_new:N \l_xephm_active_ligs_tl @@ -79,7 +84,8 @@ \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_stretch_leaders_glyph_tl { leaders+glyph } +\tl_set:Nn \l_xephm_stretch_leaders_hrule_tl { leaders+hrule } \tl_set:Nn \l_xephm_fnt_kayhan_tl { kayhan } \tl_set:Nn \l_xephm_fnt_kayhannavaar_tl { kayhannavaar } @@ -146,7 +152,7 @@ \msg_new:nnn { xepersian-hm } { error-kashida-character-is-not-available-in-the-main-font } { - Sorry,~ kashida~ character~ is~ not~ available~ in~ the~ main~ font~! + Sorry,~ kashida~ character~ is~ not~ available~ in~ the~ main~ font~#1! } \msg_new:nnn { xepersian-hm } { error-value-not-available-for-kashida-option } @@ -165,6 +171,16 @@ and~ is~ not~ regarded~ as~ stable. } +\msg_new:nnn { xepersian-hm } { hm-series-font-not-found } + { + Either~ the~ font~`#1'~ is~ not~ installed~ on~ your~ system~ or~ does~ not~ + belong~ to~ HM~Series~fonts.~ + Please~ note~ that~ the~ option~ `Kashida=leaders+glyph'~ is~ currently~ only~ + supported~ by~ HM~Series~fonts.~ + If~ you~ know~ of~ any~ other~ font~ that~ supports~ this~ option,~ please~ + let~ me~ know~ to~ add~ it~ to~ the~ list~ of~ corresponding~ fonts.~ + } + \keys_define:nn { xepersian-hm } { Kashida .code:n = @@ -174,7 +190,8 @@ { \l_xephm_stretch_glyph_tl { - \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_glyph_tl } + \msg_warning:nnn { xepersian-hm } { warning-experimental-feature } { Kashida=glyph } + \tl_set:Nx \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 } @@ -183,13 +200,17 @@ \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 } { error-kashida-character-is-not-available-in-the-main-font } + \msg_error:nnx { xepersian-hm } { error-kashida-character-is-not-available-in-the-main-font } { \l_xephm_main_font_name_tl } } } } - \l_xephm_stretch_hrule_tl + \l_xephm_stretch_leaders_glyph_tl + { + \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_glyph_tl } + } + \l_xephm_stretch_leaders_hrule_tl { - \tl_set:Nn \l_xephm_gap_filler_tl { \l_xephm_stretch_hrule_tl } + \tl_set:Nx \l_xephm_gap_filler_tl { \l_xephm_stretch_leaders_hrule_tl } } } { } { \tl_set:Nx \l_xephm_gap_filler_tl { #1 } } \tl_if_empty:NT \l_xephm_gap_filler_tl { \msg_error:nn { xepersian-hm } { error-specify-value-for-kashida-option } } |