luaotfload icon indicating copy to clipboard operation
luaotfload copied to clipboard

Fonts without "names" field

Open kmaed opened this issue 13 years ago • 1 comments

It was reported from some Chinese and Japanese users that there exist fonts without "names" field. For example, the entry for a valid font is written in otfl-names.lua as

{
 ["familyname"]="TeXGyreTermes",
 ["filename"]={ "texgyretermes-regular.otf", false },
 ["fontname"]="TeXGyreTermes-Regular",
 ["fontstyle_name"]="Regular",
 ["fullname"]="TeXGyreTermes-Regular",
 ["names"]={
  ["family"]="TeX Gyre Termes",
  ["fullname"]="TeXGyreTermes-Regular",
  ["psname"]="TeXGyreTermes-Regular",
  ["subfamily"]="Regular",
 },
 ["size"]={ 100, 200, 50 },
 ["slant"]=0,
 ["weight"]=400,
 ["width"]=5,
}

But entries for some Chinese and Japanese fonts do not have "names" field (["names"]=nil). When these fonts exist on your system and you use luaotfload, the following error occurs:

! LuaTeX error ...1/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua:109: att
empt to index field 'names' (a nil value).
<to be read again> 
                   \scan_stop: 
l.5 \setmainfont{TeXGyreTermes}

Note that this error occurs even when you load valid fonts (in the above example, the loaded font is TeXGyreTermes).

I don't know whether the fonts without "names" field are valid or invalid. In my opinion, luaotfload should work without the error even if otfl-names.lua includes such invalid entries. Or another solution is that mkluatexfontdb simply ignores such invalid fonts. Hironori Kitagawa wrote a patch for the latter solution.

Of course, I know there is otfl-blacklist.cnf for problematic fonts. But this solution requires users to edit the blacklist file.

kmaed avatar Jun 28 '12 16:06 kmaed

I had the same problem for a while and just found this issue here. I applied this commit locally (instead of the fix above) to get around the problem (and then uninstalled the font in question).

Well, now I know this, but I agree that either way this shouldn't happen.

Ferada avatar Oct 23 '12 20:10 Ferada