diff options
author | Karl Berry <karl@freefriends.org> | 2020-04-26 21:44:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-04-26 21:44:23 +0000 |
commit | 910bac6ba723d9272af1cc739b4e8560f1b6b363 (patch) | |
tree | 832ddf6b6c60271c1bf25ce541fefb339689abab /Master/texmf-dist/tex/xelatex | |
parent | 0f5f837ebab7053f90bcf633612b7b61bdd95fb8 (diff) |
xepersian-hm (26apr20)
git-svn-id: svn://tug.org/texlive/trunk@54900 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 | 69 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty | 108 |
2 files changed, 103 insertions, 74 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 637816e1552..b4e84fca193 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 @@ -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 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 1a3efc09707..6c4c5d654c0 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian-hm/xepersian-hm.sty @@ -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,7 +31,18 @@ \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 @@ -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 } |