From 5dd99061d7e5522211831a59a94cc023af336dfe Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 31 Jan 2021 21:36:25 +0000 Subject: texnegar (31jan21) git-svn-id: svn://tug.org/texlive/trunk@57581 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/texnegar/texnegar.dtx | 116 ++++++++++++--------- .../texmf-dist/source/latex/texnegar/texnegar.ins | 4 +- 2 files changed, 71 insertions(+), 49 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/texnegar/texnegar.dtx b/Master/texmf-dist/source/latex/texnegar/texnegar.dtx index 17e8e83e3d1..40a5baef1c0 100644 --- a/Master/texmf-dist/source/latex/texnegar/texnegar.dtx +++ b/Master/texmf-dist/source/latex/texnegar/texnegar.dtx @@ -101,7 +101,7 @@ make time to fix. % }^^A % } % -% \date{Released \quad 2021-01-27 \quad v0.1c} +% \date{Released \quad 2021-01-31 \quad v0.1d} % % \maketitle % @@ -137,7 +137,7 @@ make time to fix. \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 { @@ -165,7 +165,7 @@ make time to fix. % % \begin{macrocode} %<*texnegar-luatex-sty> -\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 } @@ -201,7 +201,7 @@ make time to fix. % \begin{macrocode} %<*texnegar-xetex-sty> \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 } @@ -218,7 +218,7 @@ make time to fix. % % \begin{macrocode} %<*texnegar-ini-tex> -\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} @@ -278,6 +278,10 @@ make time to fix. \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 @@ -409,6 +413,22 @@ make time to fix. \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 } @@ -643,7 +663,7 @@ make time to fix. % \subsection{File: \texttt{texnegar-common-kashida.tex}} % \begin{macrocode} %<*texnegar-common-kashida-tex> -\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 { @@ -720,7 +740,7 @@ make time to fix. % % \begin{macrocode} %<*texnegar-xetex-kashida-tex> -\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 @@ -941,8 +961,8 @@ make time to fix. -- 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", @@ -1166,8 +1186,8 @@ return peCharTableInitial, peCharTableMedial, peCharTableFinal -- 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", @@ -1180,6 +1200,8 @@ return peCharTableInitial, peCharTableMedial, peCharTableFinal -- 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 @@ -1218,10 +1240,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() @@ -1261,19 +1279,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 @@ -1315,8 +1338,8 @@ dofile(kpse.find_file("texnegar-ini.lua")) -- 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", @@ -1369,8 +1392,8 @@ dofile(kpse.find_file("texnegar-luatex-kashida.lua")) -- 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", @@ -1471,6 +1494,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 @@ -1821,7 +1845,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 @@ -1844,28 +1867,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/source/latex/texnegar/texnegar.ins b/Master/texmf-dist/source/latex/texnegar/texnegar.ins index 6ed26bf9488..a5b915ccf99 100644 --- a/Master/texmf-dist/source/latex/texnegar/texnegar.ins +++ b/Master/texmf-dist/source/latex/texnegar/texnegar.ins @@ -2,7 +2,7 @@ File: texnegar.ins -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 @@ -16,7 +16,7 @@ this license is at: http://www.latex-project.org/lppl.txt \preamble -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 -- cgit v1.2.3