[NTG-context] Latest beta stops loading some ttc fonts

Hongwen Qiu qiuhongwen at gmail.com
Thu Sep 25 10:50:01 CEST 2014


The following minimal example used to work fine:
\starttypescript [serif] [zhfonts]
   \definefontsynonym [Serif] [name:nsimsun]
\stoptypescript

\starttypescript [zhfonts]
   \definetypeface [zhfonts] [rm] [serif] [zhfonts]
\stoptypescript

\usetypescript [zhfonts]
\setupbodyfont [zhfonts, rm, 11pt]

\starttext

测试

\stoptext

but it's no longer the case.

The font used here is 'simsun.ttc' which ships with Chinese edition 
Windows systems by default.
When I require "name:nsimsun" as above, the TTFAddLangStr() function in 
the luatex code base will have the following information:
fontname lang
NSimSun   0
NSimSun  1033
新宋体       2052
That is when lang equals 0 or 1033, the fontname will be NSimSun, but 
when lang equals 2052, the fontname will be 新宋体, the Chinese words 
for NSimSun.
Although the ValidatePostScriptFontName() complains about the Chinese 
name of this font, and set 'bad_ps_fontname' to true, luatex itself 
don't stop the font fromgetting the right fontname NSimSun, since it 
chooses ASCII names when there're multiple fontnames.

But actions["check metadata"](font-otf.lua, 1812),sets the 
metadata.fontname from the correct "NSimSun" to "bad-fontname-simsun", 
and this change causes ff_get_ttc_index() to always return -1 as the 
index, which caused ConTeXt to complain about the following error 
message before bail out:

(bad-fontname-simsun:-1)Invalid TTC index number

mtx-context     | fatal error: return code: 1

So, maybe font-otf.lua may need not change metadata.fontname and 
metadata.fullname if these two names are not nil?


More information about the ntg-context mailing list