Skip to content
This repository has been archived by the owner on Aug 17, 2019. It is now read-only.

luaotfload: reading database #6

Open
hvoss49 opened this issue Feb 5, 2017 · 4 comments
Open

luaotfload: reading database #6

hvoss49 opened this issue Feb 5, 2017 · 4 comments

Comments

@hvoss49
Copy link

hvoss49 commented Feb 5, 2017

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
@phi-gamma
Copy link
Owner

phi-gamma commented Feb 6, 2017 via email

@hvoss49
Copy link
Author

hvoss49 commented Feb 6, 2017

The familyname of the font is nil:

[...]
1843: countriesofeurope
1844: vrinda
1845: nil
[\directlua]:10: bad argument #1 to 'lower' 
(string expected, got nil)
stack traceback:
	[C]: in function 'lower'
	[\directlua]:10: in function 'printFontDemo'
	[\directlua]:1: in main chunk.
l.38 \directlua{printFontDemo("LatinModern")}
                                           
? X

the fonts from luaotfload-names are:

[...]
, "/usr/share/fonts/truetype/lohit-punjabi/Lohit-Punjabi.ttf"
, "/usr/local/share/fonts/CountriesofEurope.otf"
, "/usr/local/share/fonts/vrinda.ttf"
, "/usr/local/share/fonts/epkyouka.ttf"
, "/usr/local/share/fonts/GohaTibebZemen.otf"
, "/usr/local/share/fonts/manchu.ttf"
[...]

I can delete the vrinda.ttf and epkyouka.ttf and then get the same problem with another font.
The header of epkyouka.ttf:

Family:              EPSON Kyoukashoutai
Subfamily:           Regular
Full name:           EPSON Kyoukashoutai
PostScript name:     -Regular
Version:             Version 3.00
Unique ID:           -Regular-2012:10:10
Trademark:           EPSON Kyoukashoutai  and EPSON-KYOKASHO is a trademark of SEIKO EPSON CORPORATION.
Copyright:            - Created with Type 3.2
Vendor ID:           EPSN

The PostScript name is a bit curious ...

@hvoss49
Copy link
Author

hvoss49 commented Feb 6, 2017

I had a lot of such fonts which gave nil in the list. After deleting all it works. That were all ttf fonts. Let me know if you need one of the fonts for testing.

@phi-gamma
Copy link
Owner

phi-gamma commented Feb 6, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants