summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-01-27 22:06:08 +0000
committerKarl Berry <karl@freefriends.org>2021-01-27 22:06:08 +0000
commit320efcad556ed87db690ab734f006d8d07a42b07 (patch)
tree8c53859464e7c632df88ade6611b1a832f675f88 /Master/texmf-dist/source
parentb06ee001d16756ed21be9f7432a6e58baaeee5fb (diff)
texnegar (27jan21)
git-svn-id: svn://tug.org/texlive/trunk@57539 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/texnegar/texnegar.dtx345
1 files changed, 306 insertions, 39 deletions
diff --git a/Master/texmf-dist/source/latex/texnegar/texnegar.dtx b/Master/texmf-dist/source/latex/texnegar/texnegar.dtx
index 4b27c5c054d..17e8e83e3d1 100644
--- a/Master/texmf-dist/source/latex/texnegar/texnegar.dtx
+++ b/Master/texmf-dist/source/latex/texnegar/texnegar.dtx
@@ -2,7 +2,7 @@
%
% This is file `texnegar.dtx'
%
-% 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
@@ -63,6 +63,7 @@ make time to fix.
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
+\usepackage{enumitem}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
@@ -88,7 +89,7 @@ make time to fix.
% \def\TeXNegar{\TeX Negar}
%
% \title{^^A
-% The \TeXNegar{} package\\Kashida justification in LuaTeX and XeTeX\\Source code documentation^^A
+% The \textsf{texnegar} package\\Kashida justification in LuaTeX and XeTeX\\Source code documentation^^A
% }
%
% \author{^^A
@@ -100,7 +101,7 @@ make time to fix.
% }^^A
% }
%
-% \date{Released \quad 2020-08-30 \quad v0.1b}
+% \date{Released \quad 2021-01-27 \quad v0.1c}
%
% \maketitle
%
@@ -130,8 +131,13 @@ make time to fix.
\RequirePackage{xparse}
\RequirePackage{l3keys2e}
\RequirePackage{graphicx}[2019-11-30]
+\RequirePackage{array}[2019-10-01]
\RequirePackage[dvipsnames,svgnames,x11names]{xcolor}[2016/05/11]
-\ProvidesExplPackage {texnegar} {2020-08-30} {0.1b} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
+\RequirePackage{fontspec}[2020/02/21]
+\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 }
\sys_if_engine_luatex:T
{
@@ -159,7 +165,7 @@ make time to fix.
%
% \begin{macrocode}
%<*texnegar-luatex-sty>
-\ProvidesExplPackage {texnegar-luatex} {2020-08-30} {0.1b} { Full implementation of kashida feature in xetex and luatex }
+\ProvidesExplPackage {texnegar-luatex} {2021-01-27} {0.1c} { Full implementation of kashida feature in xetex and luatex }
\tex_input:D { texnegar-ini.tex }
@@ -195,7 +201,7 @@ make time to fix.
% \begin{macrocode}
%<*texnegar-xetex-sty>
\RequirePackage{zref-savepos}[2020-03-03]
-\ProvidesExplPackage {texnegar-xetex} {2020-08-30} {0.1b} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
+\ProvidesExplPackage {texnegar-xetex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
\tex_input:D { texnegar-ini.tex }
@@ -212,7 +218,7 @@ make time to fix.
%
% \begin{macrocode}
%<*texnegar-ini-tex>
-\ProvidesExplFile {texnegar-ini.tex} {2020-08-30} {0.1b} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
+\ProvidesExplFile {texnegar-ini.tex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
\def\TeXNegar{\TeX Negar}
@@ -266,6 +272,10 @@ make time to fix.
\dim_new:N \l_texnegar_diff_pos_dim
+\bool_set_false:N \l_texnegar_minimal_bool
+\tl_set:Nn \l_texnegar_minimal_off_tl { Off }
+\tl_set:Nn \l_texnegar_minimal_on_tl { On }
+
\bool_set_false:N \l_texnegar_kashida_fix_bool
\bool_set_false:N \l_texnegar_kashida_glyph_bool
@@ -399,6 +409,22 @@ make time to fix.
\keys_define:nn { texnegar }
{
+ Minimal .code:n =
+ {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \tl_case:Nn \l_tmpa_tl
+ {
+ \l_texnegar_minimal_off_tl
+ {
+ \bool_set_false:N \l_texnegar_minimal_bool
+ }
+ \l_texnegar_minimal_on_tl
+ {
+ \bool_set_true:N \l_texnegar_minimal_bool
+ }
+ }
+ } ,
+
Kashida .code:n =
{
\tl_set:Nn \l_tmpa_tl { #1 }
@@ -530,7 +556,10 @@ make time to fix.
\sys_if_engine_luatex:T
{
\convertcolorspec{named}{\l_texnegar_color_tl}{rgb}\l_texnegar_color_rgb_tl
- \directlua{l_texnegar_color_rgb_tl = "\l_texnegar_color_rgb_tl"}
+ \sys_if_engine_luatex:T
+ {
+ \directlua{l_texnegar_color_rgb_tl = "\l_texnegar_color_rgb_tl"}
+ }
}
} ,
@@ -602,6 +631,11 @@ make time to fix.
%% % \newif\if@Kashida@XB@fix
%% % \makeatother
+\bool_if:NF \l_texnegar_minimal_bool
+ {
+ \input texnegar-luabidi.tex
+ }
+
\endinput
%</texnegar-ini-tex>
% \end{macrocode}
@@ -609,7 +643,7 @@ make time to fix.
% \subsection{File: \texttt{texnegar-common-kashida.tex}}
% \begin{macrocode}
%<*texnegar-common-kashida-tex>
-\ProvidesExplFile {texnegar-common-kashida.tex} {2020-08-30} {0.1b} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
+\ProvidesExplFile {texnegar-common-kashida.tex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
\bool_if:NT \l_texnegar_ligature_bool
{
@@ -677,6 +711,8 @@ make time to fix.
\tl_use:N \l_texnegar_line_break_tl
}
}
+
+ \endinput
%</texnegar-common-kashida-tex>
% \end{macrocode}
%
@@ -684,7 +720,7 @@ make time to fix.
%
% \begin{macrocode}
%<*texnegar-xetex-kashida-tex>
-\ProvidesExplFile {texnegar-xetex-kashida.tex} {2020-08-30} {0.1b} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
+\ProvidesExplFile {texnegar-xetex-kashida.tex} {2021-01-27} {0.1c} { Full implementation of kashida feature in XeLaTex and LuaLaTeX }
\newXeTeXintercharclass \c_texnegar_d_charclass % dual-joiner class
\newXeTeXintercharclass \c_texnegar_l_charclass % lam
@@ -895,7 +931,7 @@ make time to fix.
--
-- texnegar.dtx (with options: `texnegar-char-table-lua')
--
--- 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
@@ -905,8 +941,8 @@ make time to fix.
-- local texnegar_char_table = texnegar_char_table
-- texnegar_char_table.module = {
-- name = "texnegar_char_table",
--- version = "0.1b",
--- date = "2020-08-30",
+-- version = "0.1c",
+-- date = "2021-01-27",
-- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX",
-- author = "Hossein Movahhedian",
-- copyright = "Hossein Movahhedian",
@@ -919,6 +955,84 @@ make time to fix.
-- texnegar_char_table.warning = warn or (function (s) luatexbase.module_warning("texnegar_char_table", s) end)
-- texnegar_char_table.error = err or (function (s) luatexbase.module_error("texnegar_char_table", s) end)
+local peCharTableDigit = {
+ [1632] = utf8.char(1632), -- "٠", utf8.codepoint("٠") == 1632, "\u{0660}", ARABIC-INDIC DIGIT ZERO
+ [1633] = utf8.char(1633), -- "١", utf8.codepoint("١") == 1633, "\u{0661}", ARABIC-INDIC DIGIT ONE
+ [1634] = utf8.char(1634), -- "٢", utf8.codepoint("٢") == 1634, "\u{0662}", ARABIC-INDIC DIGIT TWO
+ [1635] = utf8.char(1635), -- "٣", utf8.codepoint("٣") == 1635, "\u{0663}", ARABIC-INDIC DIGIT THREE
+ [1636] = utf8.char(1636), -- "٤", utf8.codepoint("٤") == 1636, "\u{0664}", ARABIC-INDIC DIGIT FOUR
+ [1637] = utf8.char(1637), -- "٥", utf8.codepoint("٥") == 1637, "\u{0665}", ARABIC-INDIC DIGIT FIVE
+ [1638] = utf8.char(1638), -- "٦", utf8.codepoint("٦") == 1638, "\u{0666}", ARABIC-INDIC DIGIT SIX
+ [1639] = utf8.char(1639), -- "٧", utf8.codepoint("٧") == 1639, "\u{0667}", ARABIC-INDIC DIGIT SEVEN
+ [1640] = utf8.char(1640), -- "٨", utf8.codepoint("٨") == 1640, "\u{0668}", ARABIC-INDIC DIGIT EIGHT
+ [1641] = utf8.char(1641), -- "٩", utf8.codepoint("٩") == 1641, "\u{0669}", ARABIC-INDIC DIGIT NINE
+ [1780] = utf8.char(1780), -- "۴", utf8.codepoint("۴") == 1780, "\u{06F4}", EXTENDED ARABIC-INDIC DIGIT FOUR
+ [1781] = utf8.char(1781), -- "۵", utf8.codepoint("۵") == 1781, "\u{06F5}", EXTENDED ARABIC-INDIC DIGIT FIVE
+ [1782] = utf8.char(1782), -- "۶", utf8.codepoint("۶") == 1782, "\u{06F6}", EXTENDED ARABIC-INDIC DIGIT SIX
+}
+
+local peCharTablePunctuation = {
+ [1548] = utf8.char(1548), -- "،", utf8.codepoint("،") == 1548, "\u{060C}", ARABIC COMMA
+ [1549] = utf8.char(1549), -- "؍", utf8.codepoint("؍") == 1549, "\u{060D}", ARABIC DATE SEPARATOR
+ [1563] = utf8.char(1563), -- "؛", utf8.codepoint("؛") == 1563, "\u{061B}", ARABIC SEMICOLON
+ [1567] = utf8.char(1567), -- "؟", utf8.codepoint("؟") == 1567, "\u{061F}", ARABIC QUESTION MARK
+ [1642] = utf8.char(1642), -- "٪", utf8.codepoint("٪") == 1642, "\u{066A}", ARABIC PERCENT SIGN
+ [1643] = utf8.char(1643), -- "٫", utf8.codepoint("٫") == 1643, "\u{066B}", ARABIC DECIMAL SEPARATOR
+ [1644] = utf8.char(1644), -- "٬", utf8.codepoint("٬") == 1644, "\u{066C}", ARABIC THOUSANDS SEPARATOR
+ [1645] = utf8.char(1645), -- "٭", utf8.codepoint("٭") == 1645, "\u{066D}", ARABIC FIVE POINTED STAR
+}
+
+local peCharTable = {
+ [1569] = utf8.char(1569), -- "ء", utf8.codepoint("ء") == 1569, "\u{0621}", ARABIC LETTER ALEF HAMZA
+ [1570] = utf8.char(1570), -- "آ", utf8.codepoint("آ") == 1570, "\u{0622}", ARABIC LETTER ALEF WITH MADDA ABOVE
+ [1571] = utf8.char(1571), -- "أ", utf8.codepoint("أ") == 1571, "\u{0623}", ARABIC LETTER ALEF WITH HAMZA ABOVE
+ [1572] = utf8.char(1572), -- "ؤ", utf8.codepoint("ؤ") == 1572, "\u{0624}", ARABIC LETTER WAW WITH HAMZA ABOVE
+ [1573] = utf8.char(1573), -- "إ", utf8.codepoint("إ") == 1573, "\u{0625}", ARABIC LETTER ALEF WITH HAMZA BELOW
+ [1574] = utf8.char(1574), -- "ئ", utf8.codepoint("ئ") == 1574, "\u{0626}", ARABIC LETTER YEH WITH HAMZA ABOVE
+ [1575] = utf8.char(1575), -- "ا", utf8.codepoint("ا") == 1575, "\u{0627}", ARABIC LETTER ALEF
+ [1576] = utf8.char(1576), -- "ب", utf8.codepoint("ب") == 1576, "\u{0628}", ARABIC LETTER BEH
+ [1577] = utf8.char(1577), -- "ة", utf8.codepoint("ة") == 1577, "\u{0629}", ARABIC LETTER TEH MARBUTA
+ [1578] = utf8.char(1578), -- "ت", utf8.codepoint("ت") == 1578, "\u{062A}", ARABIC LETTER TEH
+ [1579] = utf8.char(1579), -- "ث", utf8.codepoint("ث") == 1579, "\u{062B}", ARABIC LETTER THEH
+ [1580] = utf8.char(1580), -- "ج", utf8.codepoint("ج") == 1580, "\u{062C}", ARABIC LETTER JEEM
+ [1581] = utf8.char(1581), -- "ح", utf8.codepoint("ح") == 1581, "\u{062D}", ARABIC LETTER HAH
+ [1582] = utf8.char(1582), -- "خ", utf8.codepoint("خ") == 1582, "\u{062E}", ARABIC LETTER KHAH
+ [1583] = utf8.char(1583), -- "د", utf8.codepoint("د") == 1583, "\u{062F}", ARABIC LETTER DAL
+ [1584] = utf8.char(1584), -- "ذ", utf8.codepoint("ذ") == 1584, "\u{0630}", ARABIC LETTER THAL
+ [1585] = utf8.char(1585), -- "ر", utf8.codepoint("ر") == 1585, "\u{0631}", ARABIC LETTER REH
+ [1586] = utf8.char(1586), -- "ز", utf8.codepoint("ز") == 1586, "\u{0632}", ARABIC LETTER ZAIN
+ [1587] = utf8.char(1587), -- "س", utf8.codepoint("س") == 1587, "\u{0633}", ARABIC LETTER SEEN
+ [1588] = utf8.char(1588), -- "ش", utf8.codepoint("ش") == 1588, "\u{0634}", ARABIC LETTER SHEEN
+ [1589] = utf8.char(1589), -- "ص", utf8.codepoint("ص") == 1589, "\u{0635}", ARABIC LETTER SAD
+ [1590] = utf8.char(1590), -- "ض", utf8.codepoint("ض") == 1590, "\u{0636}", ARABIC LETTER DAD
+ [1591] = utf8.char(1591), -- "ط", utf8.codepoint("ط") == 1591, "\u{0637}", ARABIC LETTER TAH
+ [1592] = utf8.char(1592), -- "ظ", utf8.codepoint("ظ") == 1592, "\u{0638}", ARABIC LETTER ZAH
+ [1593] = utf8.char(1593), -- "ع", utf8.codepoint("ع") == 1593, "\u{0639}", ARABIC LETTER AIN
+ [1594] = utf8.char(1594), -- "غ", utf8.codepoint("غ") == 1594, "\u{063A}", ARABIC LETTER GHAIN
+ [1601] = utf8.char(1601), -- "ف", utf8.codepoint("ف") == 1601, "\u{0641}", ARABIC LETTER FEH
+ [1602] = utf8.char(1602), -- "ق", utf8.codepoint("ق") == 1602, "\u{0642}", ARABIC LETTER QAF
+ [1603] = utf8.char(1603), -- "ك", utf8.codepoint("ك") == 1603, "\u{0643}", ARABIC LETTER KAF
+ [1604] = utf8.char(1604), -- "ل", utf8.codepoint("ل") == 1604, "\u{0644}", ARABIC LETTER LAM
+ [1605] = utf8.char(1605), -- "م", utf8.codepoint("م") == 1605, "\u{0645}", ARABIC LETTER MEEM
+ [1606] = utf8.char(1606), -- "ن", utf8.codepoint("ن") == 1606, "\u{0646}", ARABIC LETTER NOON
+ [1607] = utf8.char(1607), -- "ه", utf8.codepoint("ه") == 1607, "\u{0647}", ARABIC LETTER HEH
+ [1608] = utf8.char(1608), -- "و", utf8.codepoint("و") == 1608, "\u{0648}", ARABIC LETTER WAW
+ [1609] = utf8.char(1609), -- "ى", utf8.codepoint("ى") == 1609, "\u{0649}", ARABIC LETTER ALEF MAKSURA
+ [1610] = utf8.char(1610), -- "ي", utf8.codepoint("ي") == 1610, "\u{064A}", ARABIC LETTER YEH
+ [1662] = utf8.char(1662), -- "پ", utf8.codepoint("پ") == 1662, "\u{067E}", ARABIC LETTER PEH
+ [1670] = utf8.char(1670), -- "چ", utf8.codepoint("چ") == 1670, "\u{0686}", ARABIC LETTER TCHEH
+ [1688] = utf8.char(1688), -- "ژ", utf8.codepoint("ژ") == 1688, "\u{0698}", ARABIC LETTER JEH
+ [1705] = utf8.char(1705), -- "ک", utf8.codepoint("ک") == 1705, "\u{06A9}", ARABIC LETTER KEHEH
+ [1706] = utf8.char(1706), -- "ڪ", utf8.codepoint("ڪ") == 1706, "\u{06AA}", ARABIC LETTER SWASH KAF
+ [1711] = utf8.char(1711), -- "گ", utf8.codepoint("گ") == 1711, "\u{06AF}", ARABIC LETTER GAF
+ [1726] = utf8.char(1726), -- "ھ", utf8.codepoint("ھ") == 1726, "\u{06BE}", ARABIC LETTER HEH DOACHASHMEE
+ [1728] = utf8.char(1728), -- "ۀ", utf8.codepoint("ۀ") == 1728, "\u{06C0}", ARABIC LETTER HEH WITH YEH ABOVE
+ [1740] = utf8.char(1740), -- "ی", utf8.codepoint("ی") == 1740, "\u{06CC}", ARABIC LETTER FARSI YEH
+ [1749] = utf8.char(1749), -- "ە", utf8.codepoint("ە") == 1740, "\u{06D5}", ARABIC LETTER AE
+ [65275] = utf8.char(65275), -- "ﻻ", utf8.codepoint("ﻻ") == 65275, "\u{FEFB}", ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM
+ [65276] = utf8.char(65276), -- "ﻼ", utf8.codepoint("ﻼ") == 65276, "\u{FEFC}", ARABIC LIGATURE LAM WITH ALEF FINAL FORM
+}
+
local peCharTableInitial = {
[64344] = utf8.char(64344), -- "ﭘ", utf8.codepoint("ﭘ") == 64344, "\u{FB58}", INITIAL FORM PEH
[64380] = utf8.char(64380), -- "ﭼ", utf8.codepoint("ﭼ") == 64380, "\u{FB7C}", INITIAL FORM TCHEH
@@ -1042,7 +1156,7 @@ return peCharTableInitial, peCharTableMedial, peCharTableFinal
--
-- texnegar.dtx (with options: `texnegar-lua')
--
--- 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
@@ -1052,8 +1166,8 @@ return peCharTableInitial, peCharTableMedial, peCharTableFinal
-- local texnegar = texnegar
-- texnegar.module = {
-- name = "texnegar",
--- version = "0.1b",
--- date = "2020-08-30",
+-- version = "0.1c",
+-- date = "2021-01-27",
-- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX",
-- author = "Hossein Movahhedian",
-- copyright = "Hossein Movahhedian",
@@ -1066,7 +1180,112 @@ 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 debug_getinfo = debug.getinfo
+local string_format = string.format
+
+function TableLength(t)
+ local i = 0
+ for _ in pairs(t) do
+ i = i + 1
+ end
+ return i
+end
+
tex.enableprimitives('',tex.extraprimitives ())
+
+local range_tble = {
+ [1536] = 1791,
+ [1872] = 1919,
+ [2208] = 2274,
+ [8204] = 8297,
+ [64336] = 65023,
+ [65136] = 65279,
+ [126464] = 126719,
+ [983040] = 1048575
+ }
+
+local tbl_fonts_used = { }
+local tbl_fonts_chars = { }
+local tbl_fonts_chars_init = { }
+local tbl_fonts_chars_medi = { }
+local tbl_fonts_chars_fina = { }
+
+local pattern_list = {
+ ".*%.(ini)t?$", ".*%.(ini)t?%..*",
+ ".*%.(med)i?$", ".*%.(med)i?%..*",
+ ".*%.(fin)a?$", ".*%.(fin)a?%..*",
+
+ ".*_(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()
+ local funcName = debug_getinfo(1).name
+ local funcNparams = debug_getinfo(1).nparams
+
+ for f_num = 1, font.max() do
+ local f_tmp = font.fonts[f_num]
+ if f_tmp then
+ local f_tmp_fontname = f_tmp.fontname
+ if f_tmp_fontname then
+ local f_id_tmp = font.getfont(f_num)
+ local f_fontname_tmp = f_id_tmp.fontname
+ local f_filename_tmp = f_id_tmp.filename
+ if not tbl_fonts_used[f_fontname_tmp] then
+ tbl_fonts_used[f_fontname_tmp] = {f_filename_tmp, f_id_tmp}
+ end
+ end
+ end
+ end
+
+ for f_fontname, v in pairs(tbl_fonts_used) do
+ f_filename = v[1]
+ f_id = v[2]
+ if not tbl_fonts_chars[f_fontname] then
+ tbl_fonts_chars[f_fontname] = { }
+ tbl_fonts_chars_init[f_fontname] = { }
+ tbl_fonts_chars_medi[f_fontname] = { }
+ tbl_fonts_chars_fina[f_fontname] = { }
+ local f = fontloader.open(f_filename)
+ local char_name
+ local char_unicode
+ local char_class
+ for k, v in pairs(range_tble) do
+ for glyph_idx = k, v do
+ if f_id.characters[glyph_idx] then
+ 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}
+ end
+ end
+ end
+ end
+ end
+ end
+ fontloader.close(f)
+ end
+ end
+ return tbl_fonts_used, tbl_fonts_chars, tbl_fonts_chars_init, tbl_fonts_chars_medi, tbl_fonts_chars_fina
+end
+
dofile(kpse.find_file("texnegar-ini.lua"))
--
--
@@ -1086,7 +1305,7 @@ dofile(kpse.find_file("texnegar-ini.lua"))
--
-- texnegar.dtx (with options: `texnegar-ini-lua')
--
--- 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
@@ -1096,8 +1315,8 @@ dofile(kpse.find_file("texnegar-ini.lua"))
-- local texnegar_ini = texnegar_ini
-- texnegar_ini.module = {
-- name = "texnegar_ini",
--- version = "0.1b",
--- date = "2020-08-30",
+-- version = "0.1c",
+-- date = "2021-01-27",
-- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX",
-- author = "Hossein Movahhedian",
-- copyright = "Hossein Movahhedian",
@@ -1121,7 +1340,7 @@ if l_texnegar_color_bool.mode == c_true_bool.mode then
end
end
-dofile(kpse.find_file("texnegar-luatex-kashida.lua")) -- leaders + resized glyph U+0640
+dofile(kpse.find_file("texnegar-luatex-kashida.lua"))
--
--
-- End of file `texnegar-ini.lua'.
@@ -1140,7 +1359,7 @@ dofile(kpse.find_file("texnegar-luatex-kashida.lua")) -- leaders + resized gly
--
-- texnegar.dtx (with options: `texnegar-luatex-kashida-lua')
--
--- 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
@@ -1150,8 +1369,8 @@ dofile(kpse.find_file("texnegar-luatex-kashida.lua")) -- leaders + resized gly
-- local texnegar_luatex_kashida = texnegar_luatex_kashida
-- texnegar_luatex_kashida.module = {
-- name = "texnegar_luatex_kashida",
--- version = "0.1b",
--- date = "2020-08-30",
+-- version = "0.1c",
+-- date = "2021-01-27",
-- description = "Full implementation of kashida feature in XeLaTex and LuaLaTeX",
-- author = "Hossein Movahhedian",
-- copyright = "Hossein Movahhedian",
@@ -1306,7 +1525,7 @@ function ProcessTableKashidaHlist(ksh_hlistNode, hbox_num, in_font)
local ksh_unicode
ksh_unicode = font.getfont(in_font).resources.unicodes['kashida']
if hbox_num == 'l_texnegar_k_box' then
- tp.char = kashida_unicode
+ tp.char = current_kashida_unicode or kashida_unicode
elseif hbox_num == 'l_texnegar_ksh_box' then
tp.char = ksh_unicode
tn_width = tn.width
@@ -1402,7 +1621,11 @@ function StretchGlyph(t_plb_node, t_plb_glyph_node, t_gluePerJoiner, t_dir, t_fi
kashida_node.subtype = kashida_subtype
kashida_node.font = font_current
- kashida_node.char = kashida_unicode
+ if string.match(font_name, "^(Amiri).*") == "Amiri" then
+ kashida_node.char = current_kashida_unicode
+ else
+ kashida_node.char = kashida_unicode
+ end
kashida_node.lang = tex.language
kashida_width = kashida_node.width
@@ -1443,6 +1666,12 @@ function StretchGlyph(t_plb_node, t_plb_glyph_node, t_gluePerJoiner, t_dir, t_fi
if tn_id == 12 and tn_subtype == 100 then
local t_hbox = node.new(HLIST)
local t_hrule = node.copy(tn)
+
+ if string.match(font_name, "^(Amiri).*") == "Amiri" then
+ t_hrule.leader.height = kashida_height
+ t_hrule.leader.depth = kashida_depth
+ end
+
t_hbox.head = node.insert_after(t_hbox.list, t_hbox.head,t_hrule)
t_plb_node.head = node.insert_after(t_plb_node.list, tn, t_hbox)
@@ -1608,6 +1837,39 @@ function PostLineBreakFilter(hboxes_stack, groupcode)
local funcName = debug_getinfo(1).name
local funcNparams = debug_getinfo(1).nparams
+ funcName = "PostLineBreakFilter"
+
+ local tbl_fonts_used = { }
+ local tbl_fonts_chars = { }
+ 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)
+ 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)
+ 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)
+ end
+ end
+ end
+
tbl_hlist_nodes = {}
tbl_vlist_nodes = {}
for hlistNode in node.traverse(hboxes_stack) do
@@ -1673,21 +1935,26 @@ end
% question-and-answer (Q\&A) websites to solve problems for which I am grateful.
% I also would like to thank the developer teams of TeX's friends especially LaTeX, LuaTeX and XeTeX teams.
%
-% \def\HistoryItem#1#2{\subsection*{[#1]} \addcontentsline{toc}{subsection}{[#1]} \item #2}
-%
% \section{Change History}
-%
-% \begin{itemize}
-% \let\tmpitemindent\itemindent
-% \addtolength{\itemindent}{\leftmargin}
-% \setlength{\parskip}{0pt}
-% \setlength{\itemsep}{0pt}
-%
-% \HistoryItem{2020-08-29~v0.1a}{First standalone version.}
-%
-% \HistoryItem{2020-08-30~v0.1b}{Changed some file names.}
-%
-% \end{itemize}
+%
+% \def\SubSecItem#1{\subsubsection*{\hskip 2em\large #1}\addcontentsline{toc}{subsection}{[#1]}}
+% \newenvironment{Itemize}{\begin{itemize}[leftmargin=4em]}{\end{itemize}}
+%
+% \SubSecItem{2020-08-29~v0.1a}
+% \begin{Itemize}
+% \item First standalone version.
+% \end{Itemize}
+%
+% \SubSecItem{2020-08-30~v0.1b}
+% \begin{Itemize}
+% \item Changed some file names.
+% \end{Itemize}
+%
+% \SubSecItem{2021-01-27~v0.1c}
+% \begin{Itemize}
+% \item Added the option \texttt{Minimal} which is needed if texnegar is used for kashida implementaion only.
+% \item Fixed the problem with \texttt{Scheherazade} and \texttt{Amiri} fonts.
+% \end{Itemize}
%
% \section*{To Do's}
%