diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
10 files changed, 74 insertions, 52 deletions
diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-char-table.lua b/Master/texmf-dist/tex/latex/texnegar/texnegar-char-table.lua index d1f9218812e..64ba467ee45 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-char-table.lua +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-char-table.lua @@ -16,8 +16,8 @@ -- local texnegar_char_table = texnegar_char_table -- texnegar_char_table.module = { -- name = "texnegar_char_table", --- version = "0.1c", --- date = "2021-01-27", +-- version = "0.1d", +-- date = "2021-01-31", -- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX", -- author = "Hossein Movahhedian", -- copyright = "Hossein Movahhedian", diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-common-kashida.tex b/Master/texmf-dist/tex/latex/texnegar/texnegar-common-kashida.tex index 9b8d9219756..7f68e2dd9a8 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-common-kashida.tex +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-common-kashida.tex @@ -6,13 +6,13 @@ %% %% texnegar.dtx (with options: `texnegar-common-kashida-tex') %% -%% Copyright (C) 2020 Hossein Movahhedian +%% Copyright (C) 2020-2021 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 {texnegar-common-kashida.tex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } +\ProvidesExplFile {texnegar-common-kashida.tex} {2021-01-31} {0.1d} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } \bool_if:NT \l_texnegar_ligature_bool { diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.lua b/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.lua index 4aff75679ee..18b711294be 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.lua +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.lua @@ -16,8 +16,8 @@ -- local texnegar_ini = texnegar_ini -- texnegar_ini.module = { -- name = "texnegar_ini", --- version = "0.1c", --- date = "2021-01-27", +-- version = "0.1d", +-- date = "2021-01-31", -- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX", -- author = "Hossein Movahhedian", -- copyright = "Hossein Movahhedian", diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.tex b/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.tex index 4d78ceabfb3..659b2988af8 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.tex +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-ini.tex @@ -6,13 +6,13 @@ %% %% texnegar.dtx (with options: `texnegar-ini-tex') %% -%% Copyright (C) 2020 Hossein Movahhedian +%% Copyright (C) 2020-2021 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 {texnegar-ini.tex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } +\ProvidesExplFile {texnegar-ini.tex} {2021-01-31} {0.1d} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } \def\TeXNegar{\TeX Negar} @@ -72,6 +72,10 @@ \bool_set_false:N \l_texnegar_kashida_fix_bool +\bool_set_false:N \l_texnegar_kashida_fontfamily_bool +\tl_new:N \l_texnegar_kashida_fontfamily_tl +\tl_set:Nn \l_texnegar_kashida_fontfamily_tl { N/A } + \bool_set_false:N \l_texnegar_kashida_glyph_bool \bool_set_false:N \l_texnegar_kashida_leaders_glyph_bool \bool_set_false:N \l_texnegar_kashida_leaders_hrule_bool @@ -203,6 +207,22 @@ \keys_define:nn { texnegar } { + Kashidafontfamily .code:n = + { + \tl_set:Nn \l_tmpa_tl { #1 } + \tl_case:Nn \l_tmpa_tl + { + \tl_if_empty:NTF \l_tmpa_tl + { + \bool_set_false:N \l_texnegar_kashida_fontfamily_bool + } + { + \bool_set_true:N \l_texnegar_kashida_fontfamily_bool + \tl_set:Nx \l_texnegar_kashida_fontfamily_tl { \l_tmpa_tl } + } + } + } , + Minimal .code:n = { \tl_set:Nn \l_tmpa_tl { #1 } diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex-kashida.lua b/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex-kashida.lua index 5eee1094d84..9761462210e 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex-kashida.lua +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex-kashida.lua @@ -16,8 +16,8 @@ -- local texnegar_luatex_kashida = texnegar_luatex_kashida -- texnegar_luatex_kashida.module = { -- name = "texnegar_luatex_kashida", --- version = "0.1c", --- date = "2021-01-27", +-- version = "0.1d", +-- date = "2021-01-31", -- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX", -- author = "Hossein Movahhedian", -- copyright = "Hossein Movahhedian", @@ -118,6 +118,7 @@ function GetGlyph(t_plb_line_glyph_node, t_tbl_line_fields, t_CharTableInitial, local glyph_lang = t_plb_line_glyph_node.lang local glyph_width = t_plb_line_glyph_node.width local glyph_data = t_plb_line_glyph_node.data + if not (t_CharTableInitial[glyph_char] == nil) then t_tbl_line_fields.joinerCharInitial = t_tbl_line_fields.joinerCharInitial + 1 t_plb_line_glyph_node.data = 1 @@ -468,7 +469,6 @@ function ProcessTableVlist(tmpvl_n) local tmpvl_n_id = tmpvl_n.id local tmpvl_n_subtype = tmpvl_n.subtype - print(string_format(" %s: 00-0 tmpvl_n: id: %d, subtype: %d", funcName, tmpvl_n_id, tmpvl_n_subtype)) for vbNode in node.traverse(tmpvl_n) do if vbNode.id == 1 and vbNode.subtype == 0 then for tr_vbNode in node.traverse(vbNode.head) do @@ -491,28 +491,27 @@ function PostLineBreakFilter(hboxes_stack, groupcode) local tbl_fonts_chars_init = { } local tbl_fonts_chars_medi = { } local tbl_fonts_chars_fina = { } + tbl_fonts_used, tbl_fonts_chars, tbl_fonts_chars_init, tbl_fonts_chars_medi, tbl_fonts_chars_fina = GetFontsChars() - for k1, v1 in pairs(tbl_fonts_chars_init) do - for k2, v2 in pairs(tbl_fonts_chars_init[k1]) do - if k2 and not peCharTableInitial[k2] then - peCharTableInitial[k2] = utf8.char(k2) + local f_fontname + + for f_fontname, v in pairs(tbl_fonts_used) do + for k1, v1 in pairs(tbl_fonts_chars_init[f_fontname]) do + if k1 and not peCharTableInitial[k1] then + peCharTableInitial[k1] = utf8.char(k1) end end - end - for k1, v1 in pairs(tbl_fonts_chars_medi) do - for k2, v2 in pairs(tbl_fonts_chars_medi[k1]) do - if k2 and not peCharTableMedial[k2] then - peCharTableMedial[k2] = utf8.char(k2) + for k1, v1 in pairs(tbl_fonts_chars_medi[f_fontname]) do + if k1 and not peCharTableMedial[k1] then + peCharTableMedial[k1] = utf8.char(k1) end end - end - for k1, v1 in pairs(tbl_fonts_chars_fina) do - for k2, v2 in pairs(tbl_fonts_chars_fina[k1]) do - if k2 and not peCharTableFinal[k2] then - peCharTableFinal[k2] = utf8.char(k2) + for k1, v1 in pairs(tbl_fonts_chars_fina[f_fontname]) do + if k1 and not peCharTableFinal[k1] then + peCharTableFinal[k1] = utf8.char(k1) end end end diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex.sty b/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex.sty index 2087b85ead5..8490d2a5f11 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex.sty +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-luatex.sty @@ -6,13 +6,13 @@ %% %% texnegar.dtx (with options: `texnegar-luatex-sty') %% -%% Copyright (C) 2020 Hossein Movahhedian +%% Copyright (C) 2020-2021 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 %% -\ProvidesExplPackage {texnegar-luatex} {2021-01-27} {0.1c} { Full implementation of kashida feature in xetex and luatex } +\ProvidesExplPackage {texnegar-luatex} {2021-01-31} {0.1d} { Full implementation of kashida feature in xetex and luatex } \tex_input:D { texnegar-ini.tex } diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex-kashida.tex b/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex-kashida.tex index 13f642923ad..6e2d4d25b15 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex-kashida.tex +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex-kashida.tex @@ -6,13 +6,13 @@ %% %% texnegar.dtx (with options: `texnegar-xetex-kashida-tex') %% -%% Copyright (C) 2020 Hossein Movahhedian +%% Copyright (C) 2020-2021 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 {texnegar-xetex-kashida.tex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } +\ProvidesExplFile {texnegar-xetex-kashida.tex} {2021-01-31} {0.1d} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } \newXeTeXintercharclass \c_texnegar_d_charclass % dual-joiner class \newXeTeXintercharclass \c_texnegar_l_charclass % lam diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex.sty b/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex.sty index 81984a4c0a0..e2c6f8710d1 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex.sty +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar-xetex.sty @@ -6,14 +6,14 @@ %% %% texnegar.dtx (with options: `texnegar-xetex-sty') %% -%% Copyright (C) 2020 Hossein Movahhedian +%% Copyright (C) 2020-2021 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 %% \RequirePackage{zref-savepos}[2020-03-03] -\ProvidesExplPackage {texnegar-xetex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } +\ProvidesExplPackage {texnegar-xetex} {2021-01-31} {0.1d} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } \tex_input:D { texnegar-ini.tex } diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar.lua b/Master/texmf-dist/tex/latex/texnegar/texnegar.lua index 08c9ab03fff..2c9ee7897b0 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar.lua +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar.lua @@ -16,8 +16,8 @@ -- local texnegar = texnegar -- texnegar.module = { -- name = "texnegar", --- version = "0.1c", --- date = "2021-01-27", +-- version = "0.1d", +-- date = "2021-01-31", -- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX", -- author = "Hossein Movahhedian", -- copyright = "Hossein Movahhedian", @@ -30,6 +30,8 @@ -- texnegar.warning = warn or (function (s) luatexbase.module_warning("texnegar", s) end) -- texnegar.error = err or (function (s) luatexbase.module_error("texnegar", s) end) +local l_texnegar_kashida_fontfamily_bool = token.create("l_texnegar_kashida_fontfamily_bool") + local debug_getinfo = debug.getinfo local string_format = string.format @@ -68,10 +70,6 @@ local pattern_list = { ".*_(ini)t?$", ".*_(ini)t?_.*", ".*_(med)i?$", ".*_(med)i?_.*", ".*_(fin)a?$", ".*_(fin)a?_.*", - - ".*_(AltIni)t?[0-9]?$", ".*_(AltIni)t?[0-9]?_.*", - ".*_(AltMed)i?[0-9]?$", ".*_(AltMed)i?[0-9]?_.*", - ".*_(AltFin)a?[0-9]?$", ".*_(AltFin)a?[0-9]?_.*", } function GetFontsChars() @@ -111,19 +109,24 @@ function GetFontsChars() char_name = f.glyphs[f_id.characters[glyph_idx].index].name char_unicode = f.glyphs[f_id.characters[glyph_idx].index].unicode char_class = f.glyphs[f_id.characters[glyph_idx].index].class - if not tbl_fonts_chars[f_fontname][glyph_idx] then - if string.match(f_fontname, "^(Amiri).*") == "Amiri" and char_name == 'uni0640.long1' then - current_kashida_unicode = glyph_idx - end - tbl_fonts_chars[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} - for _, pattern in ipairs( pattern_list ) do - local pos_alt = string.match(char_name, pattern) - if pos_alt == 'ini' or pos_alt == 'AltIni' then - tbl_fonts_chars_init[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} - elseif pos_alt == 'med' or pos_alt == 'AltMed' then - tbl_fonts_chars_medi[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} - elseif pos_alt == 'fin' or pos_alt == 'AltFin' then - tbl_fonts_chars_fina[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} + + kashida_fontfamily = token.get_macro("l_texnegar_kashida_fontfamily_tl") + fontfamily_match = string.match(f_fontname, "^(" .. kashida_fontfamily .. ").*") + if fontfamily_match == kashida_fontfamily then + if not tbl_fonts_chars[f_fontname][glyph_idx] then + if string.match(f_fontname, "^(Amiri).*") == "Amiri" and char_name == 'uni0640.long1' then + current_kashida_unicode = glyph_idx + end + tbl_fonts_chars[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} + for _, pattern in ipairs( pattern_list ) do + local pos_alt = string.match(char_name, pattern) + if pos_alt == 'ini' or pos_alt == 'AltIni' then + tbl_fonts_chars_init[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} + elseif pos_alt == 'med' or pos_alt == 'AltMed' then + tbl_fonts_chars_medi[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} + elseif pos_alt == 'fin' or pos_alt == 'AltFin' then + tbl_fonts_chars_fina[f_fontname][glyph_idx] = {char_name, char_unicode, char_class} + end end end end diff --git a/Master/texmf-dist/tex/latex/texnegar/texnegar.sty b/Master/texmf-dist/tex/latex/texnegar/texnegar.sty index 92605537d8a..b1dfe7f0d3a 100644 --- a/Master/texmf-dist/tex/latex/texnegar/texnegar.sty +++ b/Master/texmf-dist/tex/latex/texnegar/texnegar.sty @@ -6,7 +6,7 @@ %% %% texnegar.dtx (with options: `texnegar-sty') %% -%% Copyright (C) 2020 Hossein Movahhedian +%% Copyright (C) 2020-2021 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 @@ -21,7 +21,7 @@ \RequirePackage{newverbs}[2010/09/02] \RequirePackage{environ}[2014/05/04] -\ProvidesExplPackage {texnegar} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } +\ProvidesExplPackage {texnegar} {2021-01-31} {0.1d} { Full implementation of kashida feature in XeLaTex and LuaLaTeX } \sys_if_engine_luatex:T { |