-function cid(key)
- local curjfnt = fonts.ids[tex.attribute[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
- 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)]
- if not char then
- ltjb.package_warning('luatexja-otf',
- 'Current Japanese font (or other CJK font) "'
- ..curjfnt.psname..'" does not have the specified CID character ('
- ..tostring(key)..')',
- 'Use a font including the specified CID character.')
- char = 0
- return
+local cid
+do
+ cid = function (key)
+ if key==0 then return append_jglyph(char) end
+ 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 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) "'
+ ..curjfnt.psname..'" does not have the specified CID character ('
+ ..tostring(key)..')',
+ 'Use a font including the specified CID character.')
+ char = 0
+ end
+ return append_jglyph(char)