end
prepare_fl_data = function (dest, id)
local fl = fontloader.open(id.filename)
- local unicodes = {}
+ local ind_to_uni, unicodes = {}, {}
for i,v in pairs(id.characters) do
- unicodes[v.index] = i
+ ind_to_uni[v.index] = i
end
if fl.glyphs then
local tg, glyphmin, glyphmax = fl.glyphs, fl.glyphmin, fl.glyphmax
for i = glyphmin, glyphmax do
- if tg[i] and tg[i].name then unicodes[tg[i].name] = unicodes[i] end
+ if tg[i] and tg[i].name then unicodes[tg[i].name] = ind_to_uni[i] end
end
dest = add_fl_table(dest, fl, unicodes,
fl.ascent + fl.descent, fl.units_per_em)
for _,v in pairs(fl.subfonts) do
local tg, glyphmin, glyphmax = v.glyphs, v.glyphmin, v.glyphmax
for i = glyphmin, glyphmax do
- if tg[i] and tg[i].name then unicodes[tg[i].name] = unicodes[i] end
+ if tg[i] and tg[i].name then unicodes[tg[i].name] = ind_to_uni[i] end
end
end
for _,v in pairs(fl.subfonts) do
dest = add_fl_table(dest, v, unicodes,
fl.ascent + fl.descent, fl.units_per_em)
end
- end
- fontloader.close(fl); collectgarbage("collect")
- return dest
+ end
+ if dest then dest.unicodes = unicodes end
+ fontloader.close(fl); collectgarbage("collect")
+ return dest
end
-- supply vkern table
supply_vkern_table = function(id, bname)
--
do
- local cache_ver = 7
+ local cache_ver = 9
local checksum = file.checksum
local function prepare_extra_data_base(id)
local tex_get_attr = tex.getattribute
cid = function (key)
if key==0 then return append_jglyph(char) end
- local curjfnt = identifiers[tex_get_attr((ltjd_get_dir_count()==dir_tate)
- and attr_curtfnt or attr_curjfnt)]
- if not curjfnt.cidinfo or
- curjfnt.cidinfo.ordering ~= "Japan1" and
- curjfnt.cidinfo.ordering ~= "GB1" and
- curjfnt.cidinfo.ordering ~= "CNS1" and
- curjfnt.cidinfo.ordering ~= "Korea1" then
+ local curjfnt_num = tex_get_attr((ltjd_get_dir_count()==dir_tate)
+ and attr_curtfnt or attr_curjfnt)
+ local curjfnt = identifiers[curjfnt_num]
+ local cidinfo = curjfnt.resources.cidinfo
+ if not cidinfo or
+ cidinfo.ordering ~= "Japan1" and
+ cidinfo.ordering ~= "GB1" and
+ cidinfo.ordering ~= "CNS1" and
+ cidinfo.ordering ~= "Korea1" then
-- ltjb.package_warning('luatexja-otf',
-- 'Current Japanese font (or other CJK font) "'
-- ..curjfnt.psname..'" is not a CID-Keyed font (Adobe-Japan1 etc.)')
return append_jglyph(get_ucs_from_rmlgbm(key))
end
- local char = curjfnt.resources.unicodes[curjfnt.cidinfo.ordering..'.'..tostring(key)]
+ local fe, char = ltjf_font_extra_info[curjfnt_num], nil
+ if fe and fe.unicodes then
+ char = fe.unicodes[cidinfo.ordering..'.'..tostring(key)]
+ end
if not char then
ltjb.package_warning('luatexja-otf',
'Current Japanese font (or other CJK font) "'
-- 和文フォント読み込み時に,CID -> unicode 対応をとっておく.
local function cid_to_char(fmtable, fn)
local fi = identifiers[fn]
- if fi.cidinfo and fi.cidinfo.ordering == "Japan1" then
+ local fe = ltjf_font_extra_info[fn]
+ if fi.cidinfo and fi.cidinfo.ordering == "Japan1" and fe then
for i, v in pairs(fmtable.chars) do
local j = string.match(i, "^AJ1%-([0-9]*)")
if j then
- j = tonumber(fi.resources.unicodes['Japan1.'..tostring(j)])
+ j = tonumber(fe.unicodes['Japan1.'..tostring(j)])
if j then
fmtable.cid_char_type = fmtable.cid_char_type or {}
fmtable.cid_char_type[j] = v