Kazuki Maeda
2015-10-08 03:57:44 UTC
Hi all.
Mac OS X 10.11 El Capitan provides many new CJK fonts as OpenType Collection (but extension is .ttc).
LuaTeX 0.81.0 can handle these new fonts (see rev 5330).
However, luaotfload still cannot embed several fonts, e.g. HiraginoSans-W1, with "Invalid TTC index number" error.
The cause of the problem is that this font does not have subfonts whose PostScript name is same as "fontname" of the font file.
For HiraginoSans-W1, luatex fontloader returns:
...
["familyname"]="Hiragino Sans W1",
["fontname"]="HiraKakuProN-W1",
["fontstyle_id"]=0,
["fullname"]="HiraKakuProN-W1",
...
This font file has two subfonts. Their PostScript name are:
...
["family"]=".Hiragino Kaku Gothic Interface",
["fullname"]=".Hiragino Kaku Gothic Interface W1",
["manufacturer"]="SCREEN Graphic and Precision Solutions Co., Ltd.",
["postscriptname"]=".HiraKakuInterface-W1",
["preffamilyname"]=".Hiragino Kaku Gothic Interface",
...
["family"]="Hiragino Sans W1",
["fullname"]="Hiragino Sans W1",
["manufacturer"]="SCREEN Graphic and Precision Solutions Co., Ltd.",
["postscriptname"]="HiraginoSans-W1",
["preffamilyname"]="Hiragino Sans",
...
There is no subfont whose postscriptname is "HiraKakuProN-W1".
But luaotfload sets fontname "HiraKakuProN-W1" to psname, and causes "Invalid TTC index number" error.
I attach a patch to luaotfload (or font-otf.lua).
This code reads postscriptname, writes it to font cache as metadata.psname, and sets it to psname.
After applying this patch, you will be able to embed all the new CJK fonts.
Best regards
Kazuki Maeda
Mac OS X 10.11 El Capitan provides many new CJK fonts as OpenType Collection (but extension is .ttc).
LuaTeX 0.81.0 can handle these new fonts (see rev 5330).
However, luaotfload still cannot embed several fonts, e.g. HiraginoSans-W1, with "Invalid TTC index number" error.
The cause of the problem is that this font does not have subfonts whose PostScript name is same as "fontname" of the font file.
For HiraginoSans-W1, luatex fontloader returns:
...
["familyname"]="Hiragino Sans W1",
["fontname"]="HiraKakuProN-W1",
["fontstyle_id"]=0,
["fullname"]="HiraKakuProN-W1",
...
This font file has two subfonts. Their PostScript name are:
...
["family"]=".Hiragino Kaku Gothic Interface",
["fullname"]=".Hiragino Kaku Gothic Interface W1",
["manufacturer"]="SCREEN Graphic and Precision Solutions Co., Ltd.",
["postscriptname"]=".HiraKakuInterface-W1",
["preffamilyname"]=".Hiragino Kaku Gothic Interface",
...
["family"]="Hiragino Sans W1",
["fullname"]="Hiragino Sans W1",
["manufacturer"]="SCREEN Graphic and Precision Solutions Co., Ltd.",
["postscriptname"]="HiraginoSans-W1",
["preffamilyname"]="Hiragino Sans",
...
There is no subfont whose postscriptname is "HiraKakuProN-W1".
But luaotfload sets fontname "HiraKakuProN-W1" to psname, and causes "Invalid TTC index number" error.
I attach a patch to luaotfload (or font-otf.lua).
This code reads postscriptname, writes it to font cache as metadata.psname, and sets it to psname.
After applying this patch, you will be able to embed all the new CJK fonts.
Best regards
Kazuki Maeda