diff options
author | Karl Berry <karl@freefriends.org> | 2021-01-31 21:36:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-01-31 21:36:25 +0000 |
commit | 5dd99061d7e5522211831a59a94cc023af336dfe (patch) | |
tree | 95b762d6a2aef488fa7e30c903c3e5873833b274 /Master | |
parent | 62bef9415da4c09282aed4aed8fe480181aa2668 (diff) |
texnegar (31jan21)
git-svn-id: svn://tug.org/texlive/trunk@57581 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
31 files changed, 187 insertions, 117 deletions
diff --git a/Master/texmf-dist/doc/latex/texnegar/INSTALL.txt b/Master/texmf-dist/doc/latex/texnegar/INSTALL.txt index 1121a144598..30a096fb97f 100644 --- a/Master/texmf-dist/doc/latex/texnegar/INSTALL.txt +++ b/Master/texmf-dist/doc/latex/texnegar/INSTALL.txt @@ -1,7 +1,7 @@ texnegar -- INSTALL ====================== - Source: texnegar.dtx (2021-01-27 v0.1c) + Source: texnegar.dtx (2021-01-31 v0.1d) Author: Hossein Movahhedian Info: filecontents + macro + verbatim License: LPPL 1.3c @@ -9,23 +9,23 @@ <dma8hm1334 AT gmail DOT com> - To extract the package and at the same time produce the - documentation, execute: xelatex thrice on texnegar.dtx. + documentation, execute: lualatex or xelatex thrice on texnegar.dtx. Files should then be moved to appropriate locations. --- *.dtx -> TEXMF/source/xelatex/texnegar/ --- *.ins -> TEXMF/source/xelatex/texnegar/ +-- *.dtx -> TEXMF/source/latex/texnegar/ +-- *.ins -> TEXMF/source/latex/texnegar/ --- *.sty -> TEXMF/tex/xelatex/texnegar/ --- *.lua -> TEXMF/tex/xelatex/texnegar/ --- texnegar-ini.tex -> TEXMF/tex/xelatex/texnegar/ --- texnegar-xetex-kashida.tex -> TEXMF/tex/xelatex/texnegar/ --- texnegar-common-kashida.tex -> TEXMF/tex/xelatex/texnegar/ +-- *.sty -> TEXMF/tex/latex/texnegar/ +-- *.lua -> TEXMF/tex/latex/texnegar/ +-- texnegar-ini.tex -> TEXMF/tex/latex/texnegar/ +-- texnegar-xetex-kashida.tex -> TEXMF/tex/latex/texnegar/ +-- texnegar-common-kashida.tex -> TEXMF/tex/latex/texnegar/ --- *.pdf -> TEXMF/doc/xelatex/texnegar/ --- *.tex -> TEXMF/doc/xelatex/texnegar/ --- *.ltx -> TEXMF/doc/xelatex/texnegar/ --- *.txt -> TEXMF/doc/xelatex/texnegar/ +-- *.pdf -> TEXMF/doc/latex/texnegar/ +-- *.tex -> TEXMF/doc/latex/texnegar/ +-- *.ltx -> TEXMF/doc/latex/texnegar/ +-- *.txt -> TEXMF/doc/latex/texnegar/ Don't forget to run 'texconfig rehash' afterwards. diff --git a/Master/texmf-dist/doc/latex/texnegar/doc-ligature-texnegar.pdf b/Master/texmf-dist/doc/latex/texnegar/doc-ligature-texnegar.pdf Binary files differindex 55bb7c10877..1a2a98538c7 100644 --- a/Master/texmf-dist/doc/latex/texnegar/doc-ligature-texnegar.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/doc-ligature-texnegar.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/doc-ligature-xep.pdf b/Master/texmf-dist/doc/latex/texnegar/doc-ligature-xep.pdf Binary files differindex 02c1be0ef2b..abe4facd9ed 100644 --- a/Master/texmf-dist/doc/latex/texnegar/doc-ligature-xep.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/doc-ligature-xep.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/doc-samples-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/doc-samples-glyph.pdf Binary files differindex a72a792eb99..9461731e028 100644 --- a/Master/texmf-dist/doc/latex/texnegar/doc-samples-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/doc-samples-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/doc-samples-hrule.pdf b/Master/texmf-dist/doc/latex/texnegar/doc-samples-hrule.pdf Binary files differindex 8e55b7dc265..25e9856e580 100644 --- a/Master/texmf-dist/doc/latex/texnegar/doc-samples-hrule.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/doc-samples-hrule.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/doc-samples-xep.pdf b/Master/texmf-dist/doc/latex/texnegar/doc-samples-xep.pdf Binary files differindex f613613547a..e1dbc20a38c 100644 --- a/Master/texmf-dist/doc/latex/texnegar/doc-samples-xep.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/doc-samples-xep.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.ltx b/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.ltx index c740068a7da..6b38d66e34a 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.ltx +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.ltx @@ -1,7 +1,7 @@ %% %% This is file `texnegar-doc.tex' %% -%% Copyright (c) Hossein Movahhedian 2020-2021 +%% 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 @@ -63,7 +63,7 @@ } } -\date{Released \quad 2021-01-27 \quad v0.1c} +\date{Released \quad 2021-01-31 \quad v0.1d} \definecolor{HMhighlightBlueI}{rgb}{0,0,1} \definecolor{HMhighlightbgYellowII}{rgb}{1,1,1} @@ -281,7 +281,7 @@ The options available in \TeXNegar{} are: for using \texttt{texnegar} to implement kashida feature only. \item \indextermsubsub{General Options}{\textbf{General Options}}{\texttt{Minimal}}{Off}: \\ - for using \texttt{texnegar} as a general purpose typesetter (including kashida implementation). + for using \texttt{texnegar} as a general purpose Persian typesetter (including kashida implementation). This is the default value. \end{itemize} @@ -389,6 +389,26 @@ The options available in \TeXNegar{} are: \begin{itemize} \item \indexterm{LuaLaTeX-only Options}{\textbf{\hologo{LuaLaTeX}-only Options}}: \\ \begin{itemize} + \item \indextermsub{LuaLaTeX-only Options}{\textbf{\hologo{LuaLaTeX}-only Options}}{\texttt{Kashidafontfamily}}: \\ + that fixes the issue in \texttt{ArabLuaTeX} if one uses fonts other than \textsf{HM Series} and \textsf{Adobe Arab}, + among those are fonts such as \textsf{Scheherazade}, \textsf{Scheherazade New}, and \textsf{Amiri}. + The value of this option, as returned by \hologo{LuaTeX}, is the family name of the font without spaces. + A few examples of these values and the corresponding fonts are: + + \begin{longtable}{ll} + value & corresponding fonts \\ + \hline + \texttt{AdobeArab} & \textsf{\small Adobe Arab Regular}, \\ + & \textsf{\small Adobe Arab Bold}, \dots\unkern. \\ + \texttt{Amiri} & \textsf{\small Amiri Regular, Amiri Bold}, \\ + & \textsf{\small Amiri Slanted}, \dots\unkern. \\ + \texttt{HMXKayhan} & \textsf{\small HM XKayhan Regular}, \\ + & \textsf{\small HM XKayhan Bold}, \dots\unkern. \\ + \texttt{ScheherazadeNew} & \textsf{\small Scheherazade New Regular}, \\ + & \textsf{\small Scheherazade New Bold}, \dots\unkern. \\ + \texttt{Scheherazade} & \textsf{\small Scheherazade}, \dots\unkern. \\ + \end{longtable} + \item \indextermsub{LuaLaTeX-only Options}{\textbf{\hologo{LuaLaTeX}-only Options}}{\texttt{hboxrecursion}}: \\ which enables kashida justification inside horizontal boxes recursively. @@ -509,6 +529,12 @@ I also would like to thank the developer teams of TeX's friends especially LaTeX \item Fixed the problem with \texttt{Scheherazade} and \texttt{Amiri} fonts. \end{Itemize} +\SubSecItem{2021-01-31~v0.1d} +\begin{Itemize} + \item Added the option \texttt{Kashidafontfamily} that fixes the issue in \texttt{ArabLuaTeX} if one uses + fonts other than \textsf{HM Series} and \textsf{Adobe Arab}. +\end{Itemize} + \section*{To Do's} To do diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.pdf Binary files differindex fe4771d0d26..75a809b26d5 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-doc.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-glyph.pdf Binary files differindex bfc142958c8..38f55ce7aee 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-glyph.pdf Binary files differindex 575bae99f9d..d2175bb022d 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-hrule.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-hrule.pdf Binary files differindex 3d3a9a5b543..245750465ab 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-hrule.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-luatex-leaders-hrule.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-glyph.pdf Binary files differindex 585372d580e..b27a5a2d230 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-glyph.pdf Binary files differindex b1162a6dc2e..8ebdff53b38 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-hrule.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-hrule.pdf Binary files differindex 6124360681d..e45da3f31fe 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-hrule.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-bidi-leaders-hrule.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-glyph.pdf Binary files differindex 72274f832ad..16a3d0bac9b 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-glyph.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-glyph.pdf Binary files differindex 5bac4724b59..b76e2e3e154 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-glyph.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-glyph.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-hrule.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-hrule.pdf Binary files differindex 84e262a2e41..db2648da2da 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-hrule.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar-xetex-xepersian-leaders-hrule.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/texnegar.pdf b/Master/texmf-dist/doc/latex/texnegar/texnegar.pdf Binary files differindex 834f5bee65e..3abdf6da0b0 100644 --- a/Master/texmf-dist/doc/latex/texnegar/texnegar.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/texnegar.pdf diff --git a/Master/texmf-dist/doc/latex/texnegar/xepersian-XB.pdf b/Master/texmf-dist/doc/latex/texnegar/xepersian-XB.pdf Binary files differindex 6858bae7356..18a3e065fa8 100644 --- a/Master/texmf-dist/doc/latex/texnegar/xepersian-XB.pdf +++ b/Master/texmf-dist/doc/latex/texnegar/xepersian-XB.pdf 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 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 { |