OSDN Git Service

Problems in test10-otf.tex
[luatex-ja/luatexja.git] / src / luatexja / otf.lua
1 --
2 -- luatexja/otf.lua
3 --
4 luatexbase.provides_module({
5   name = 'luatexja.otf',
6   date = '2011/09/09',
7   version = '0.1',
8   description = 'The OTF Lua module for LuaTeX-ja',
9 })
10 module('luatexja.otf', package.seeall)
11
12 require('luatexja.base');      local ltjb = luatexja.base
13
14 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
15
16 function cid(key)
17    local curjfnt = fonts.ids[tex.attribute[attr_curjfnt]]
18    if curjfnt.cidinfo.ordering ~= "Japan1" then
19       ltjb.package_error('luatexja-otf',
20                          'Current Japanese font "'..curjfnt.psname..'" is not a CID-Keyed font (Adobe-Japan1)', 
21                          'Select a CID-Keyed font using \jfont.')
22       return
23    end
24    local char = curjfnt.unicodes['Japan1.'..tostring(key)]
25    if not char then
26       ltjb.package_error('luatexja-otf',
27                          'Current Japanese font "'..curjfnt.psname..'" does not include the specified CID character ('..tostring(key)..')', 
28                          'Use a font including the specified CID character.')
29       return
30    end
31    tex.print(char)
32 end
33
34 -------------------- all done
35 -- EOF