This repository was archived by the owner on Aug 17, 2019. It is now read-only.
forked from lualatex/luaotfload
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Aug 17, 2019. It is now read-only.
luaotfload: reading database #6
Copy link
Copy link
Open
Description
The following example worked last year:
\documentclass{article}
\setlength{\parindent}{0em}
\usepackage{fontspec}
\usepackage{luacode}
\newfontface\LMML{Latin Modern Mono Light Cond}%% Für die Ausgabe
\begin{luacode}
local teststring = "\\LaTeX~--~Eine Einführung."
local myfonts = luaotfload.aux.read_font_index()
function printFontDemo(fontname)
local fnA = string.lower(fontname)
local a = {}
local b = {}
for i, v in ipairs(myfonts.mappings) do
m, n = string.find(string.lower(v.familyname),fnA)
if m then
a[v.fontname] = v.familyname
b[#b + 1] = v.fontname
end
end
table.sort(b)
for i, v in ipairs(b) do
tex.print("\\parbox{0.21\\linewidth}{\\LMML\\footnotesize")
tex.print(-2, a[v])
tex.print("\\\\ \\scriptsize")
tex.print(-2, v)
tex.print("}\\parbox{0.79\\linewidth}{\\raggedright\\setmainfont{" .. v .. "}")
tex.print(teststring)
tex.print("}\\\\[2pt]")
end
end
\end{luacode}
\begin{document}
\directlua{printFontDemo("LatinModern")}
\end{document}
now I get with lualatex 0.95 and up-to-date TL2016
[...]
(/usr/local/texlive/2016/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)))(l
oad luc: /usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmmon
oltcond10-regular.luc) (./12-04-19.aux)[\directlua]:7: bad argument #1 to 'ipai
rs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
[\directlua]:7: in function 'printFontDemo'
[\directlua]:1: in main chunk.
l.35 \directlua{printFontDemo("LatinModern")}
?
I can fix it with the following. Is it a problem with my code or the database which has an empty entry?
for i, v in ipairs(myfonts.mappings) do
if v.familyname then
m, n = string.find(string.lower(v.familyname),fnA)
if m then
a[v.fontname] = v.familyname
b[#b + 1] = v.fontname
end
end
end
Metadata
Metadata
Assignees
Labels
No labels