diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian-hm')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def | 132 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty | 100 |
2 files changed, 232 insertions, 0 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 new file mode 100644 index 00000000000..ce3a9600dc5 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/kashida-xepersian-hm.def @@ -0,0 +1,132 @@ +%% +%% This is file `kashida-xepersian-hm.def' +%% +%% Copyright (c) Hossein Movahhedian 2020 +%% +%% 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 +%% +%% Copyright notice: the following code is partly adapted from the code in +%% 'kashida-xepersian.def' from xepersian package (v22.8). +\ExplSyntaxOn +\ProvidesExplFile {kashida-xepersian.def} {2018/01/04} {0.1} { Fixes~implementation~of~Kashida~in~xepersian~package } + +\int_const:Nn \c_xepersian_zwj_int {"200D} % zero-width joiner +\int_const:Nn \c_xepersian_lrm_int {"200E} % left-right-mark +\int_const:Nn \c_xepersian_two_int {2} % 2 +\int_const:Nn \c_xepersian_four_int {4} % 4 +\int_const:Nn \c_xepersian_ksh_int {"0640} % kashida +\int_const:Nn \c_xepersian_d_int {10} % dual-joiner class +\int_const:Nn \c_xepersian_l_int {11} % lam +\int_const:Nn \c_xepersian_r_int {12} % right-joiner +\int_const:Nn \c_xepersian_a_int {13} % alef +\int_const:Nn \c_xepersian_h_int {14} % heh +\int_const:Nn \c_xepersian_y_int {15} % yeh +\int_const:Nn \c_xepersian_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 + { + \bool_if:NT \l_kashida_on_bool + { + \c_xepersian_lrm_int\c_xepersian_zwj_int\tex_penalty:D 10000 + \tex_leaders:D \tex_hrule:D height \XeTeXglyphbounds \c_xepersian_two_int + \int_use:N \XeTeXcharglyph \c_xepersian_ksh_int depth \XeTeXglyphbounds \c_xepersian_four_int + \int_use:N \XeTeXcharglyph \c_xepersian_ksh_int \skip_horizontal:n { #1 } + \c_xepersian_zwj_int + } + } + +\XeTeXinterchartokenstate = 1 + +\clist_set:Nn \l_xepersian_a_clist { 0622,0623,0625,0627 } % ا، إ، أ، آ +\clist_map_inline:Nn \l_xepersian_a_clist + { + \XeTeXcharclass "#1 \c_xepersian_a_int + } + +\clist_set:Nn \l_xepersian_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_xepersian_d_clist + { + \XeTeXcharclass "#1 \c_xepersian_d_int + } + +\clist_set:Nn \l_xepersian_l_clist { 0644 } % ل +\clist_map_inline:Nn \l_xepersian_l_clist + { + \XeTeXcharclass "#1 \c_xepersian_l_int + } + +\clist_set:Nn \l_xepersian_r_clist { 0624,0629,062F,0630,0631,0632,0648,0698 } % ؤ,ة,د,ذ,ر,ز,و,ژ +\clist_map_inline:Nn \l_xepersian_r_clist + { + \XeTeXcharclass "#1 \c_xepersian_r_int + } + +\clist_set:Nn \l_xepersian_v_clist { 064B,064C,064D,064E,064F,0650,0651,0652 } % ً,ٌ,ٍ,َ,ُ,ِ,ّ,ْ +\clist_map_inline:Nn \l_xepersian_v_clist + { + \XeTeXcharclass "#1 \c_xepersian_v_int + } + +\clist_set:Nn \l_xepersian_y_clist { 0649,064A,06CC } +\clist_map_inline:Nn \l_xepersian_y_clist + { + \XeTeXcharclass "#1 \c_xepersian_y_int + } + +\XeTeXinterchartoks \c_xepersian_y_int \c_xepersian_y_int = {\bool_if:NTF \l_kashida_hm_fix_bool {\xepersian_kashida {\l_hskip_default_tl}} {\xepersian_kashida \l_hskip_zero_tl}} +\XeTeXinterchartoks \c_xepersian_d_int \c_xepersian_y_int = {\bool_if:NTF \l_kashida_hm_fix_bool {\xepersian_kashida {\l_hskip_default_tl}} {\xepersian_kashida \l_hskip_zero_tl}} +\XeTeXinterchartoks \c_xepersian_y_int \c_xepersian_d_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_d_int \c_xepersian_d_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_l_int \c_xepersian_d_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_d_int \c_xepersian_l_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_l_int \c_xepersian_l_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_d_int \c_xepersian_r_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_d_int \c_xepersian_a_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_l_int \c_xepersian_r_int = {\xepersian_kashida \l_hskip_zero_tl} +\XeTeXinterchartoks \c_xepersian_l_int \c_xepersian_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 } + +\ExplSyntaxOff +\makeatletter +\newif\if@Kashida@on +\newif\if@Kashida@XB@fix +\makeatother +\ExplSyntaxOn + +\KashidaHMFixOn + +\tl_set:Nn \l_hskip_zero_tl { 0 em plus 0.5 em } + +\bool_if:NTF \l_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_set:NV \l_hskip_default_tl \l_hskip_zero_tl + } + +\KashidaOn + +\ExplSyntaxOff +\endinput + +%% +%% END OF FILE +%% diff --git a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty new file mode 100644 index 00000000000..568c000c5ec --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty @@ -0,0 +1,100 @@ +%% +%% This is file `xepersian-hm.sty' +%% +%% Copyright (c) Hossein Movahhedian 2020 +%% +%% 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 +%% +\ExplSyntaxOn +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{l3keys2e} +\RequirePackage{xepersian} +\ProvidesExplPackage {xepersian-hm} {2020-03-17} {0.1} { 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 } + +\keys_define:nn { xepersian-hm } + { + Kashida .code:n = \tex_input:D { kashida-xepersian-hm.def } , + + kashidastretch .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 } } + } , + kashidastretch .default:n = \tl_set:Nn \l_hskip_default_tl { 0 em plus 0.5 em } , + } + +\ProcessKeysOptions { xepersian-hm } + +\ExplSyntaxOff +\endinput + +%% +%% END OF FILE +%% |