X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-otf.lua;h=faef663d239eeba93273a649c3ead3e08bdb47b7;hb=cf51a2259a27eeed9a3d5d0c40c767a5e6bc403e;hp=68845503b826661b1a95c399ab4d9d4a9562a633;hpb=15ed4fcff44d451f64d9e05d0886cb890dbfb614;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-otf.lua b/src/ltj-otf.lua index 6884550..faef663 100644 --- a/src/ltj-otf.lua +++ b/src/ltj-otf.lua @@ -3,11 +3,9 @@ -- luatexbase.provides_module({ name = 'luatexja.otf', - date = '2011/09/09', - version = '0.1', + date = '2013/05/11', description = 'The OTF Lua module for LuaTeX-ja', }) -module('luatexja.otf', package.seeall) luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('jfont'); local ltjf = luatexja.jfont @@ -37,8 +35,8 @@ local ltjr_cidfont_data = ltjr.cidfont_data local OTF = luatexja.userid_table.OTF -function get_ucs_from_rmlgbm(c) - local v = ltjr_cidfont_data["Adobe-Japan1"].unicodes["Japan1." .. tostring(c)] +local function get_ucs_from_rmlgbm(c) + local v = ltjr_cidfont_data["Adobe-Japan1"].resources.unicodes["Japan1." .. tostring(c)] if not v then -- AJ1 範囲外 return 0 elseif v<0xF0000 then -- 素直に Unicode にマップ可能 @@ -57,13 +55,12 @@ function get_ucs_from_rmlgbm(c) return 0 end end - --print(c, v, w) end end -- Append a whatsit node to the list. -- This whatsit node will be extracted to a glyph_node -function append_jglyph(char) +local function append_jglyph(char) local p = node_new(id_whatsit,sid_user) local v = tex.attribute[attr_curjfnt] p.user_id=OTF; p.type=100; p.value=char @@ -71,16 +68,17 @@ function append_jglyph(char) node.write(p) end -function cid(key) +local function cid(key) + if key==0 then return append_jglyph(char) end 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.)') +-- 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)] @@ -91,12 +89,11 @@ function cid(key) ..tostring(key)..')', 'Use a font including the specified CID character.') char = 0 - return end - append_jglyph(char) + return append_jglyph(char) end -function extract(head) +local function extract(head) local p = head local v while p do @@ -174,4 +171,9 @@ luatexbase.add_to_callback("luatexja.find_char_class", cid_set_char_class, "ltj.otf.find_char_class", 1) -------------------- all done +luatexja.otf = { + append_jglyph = append_jglyph, + cid = cid, +} + -- EOF