X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-rmlgbm.lua;h=f7553d0ceb043567ae736a60d08c24629d962c4a;hb=cf51a2259a27eeed9a3d5d0c40c767a5e6bc403e;hp=0303db6d260bf93499a79d729ed498798fbe80c8;hpb=72d09c2f86541e8cbf52ab28f1751157b6d74fc3;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-rmlgbm.lua b/src/ltj-rmlgbm.lua index 0303db6..f7553d0 100644 --- a/src/ltj-rmlgbm.lua +++ b/src/ltj-rmlgbm.lua @@ -3,8 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.rmlgbm', - date = '2013/03/17', - version = '0.4', + date = '2013/05/14', description = 'Definitions of non-embedded Japanese (or other CJK) fonts', }) module('luatexja.rmlgbm', package.seeall) @@ -120,6 +119,7 @@ do end function make_cid_font() local kx = cid_replace[cid_name] + if not kx then return end local k = { cidinfo = { ordering=cid_order, registry=cid_reg, supplement=kx[3] }, encodingbytes = 2, extend=1000, format = 'opentype', @@ -194,36 +194,36 @@ do k.characters[46].width = math.floor(655360/14); -- Standard fonts are ``seriffed''. table.tofile(savepath, k,'return', false, true, false ) + ltjb.package_info_no_line('luatexja', "saved :'" .. savepath .. "'", '') else - ltjb.package_warning('luatexja', - 'failed to save informations of non-embedded 2-byte fonts', '') + ltjb.package_warning_no_line('luatexja', "failed to save to '" .. savepath .. "'", '') end end end local make_cid_font = make_cid_font -- +local function cid_cache_load(fullpath) + cidfont_data[cid_name] = require(fullpath) + cache_chars[cid_name] = { [655360] = cidfont_data[cid_name].characters } +end + local function read_cid_font() -- local v = "ltj-cid-" .. string.lower(cid_name) .. ".lua" local v = "ltj-cid-auto-" .. string.lower(cid_name) .. ".lua" - local localpath = file.join(path.localdir, v) - local systempath = file.join(path.systemdir, v) + local localpath = file.join(path.localdir .. '/luatexja', v) + local systempath = file.join(path.systemdir .. '/luatexja' , v) local kpsefound = kpse.find_file(v) if kpsefound and file.isreadable(kpsefound) then - cidfont_data[cid_name] = require(kpsefound) - cache_chars[cid_name] = { [655360] = cidfont_data[cid_name].characters } + cid_cache_load(kpsefound) elseif file.isreadable(localpath) then - cidfont_data[cid_name] = require(localpath) - cache_chars[cid_name] = { [655360] = cidfont_data[cid_name].characters } + cid_cache_load(localpath) elseif file.isreadable(systempath) then - cidfont_data[cid_name] = require(systempath) - cache_chars[cid_name] = { [655360] = cidfont_data[cid_name].characters } + cid_cache_load(systempath) + else + -- Now we must create the virtual metrics from CMap. + make_cid_font() end - -- Now we must create the virtual metrics from CMap. - ltjb.package_info('luatexja', - 'I try to generate informations of non-embedded 2-byte fonts...', '') - make_cid_font() - if cidfont_data[cid_name] then for i,v in pairs(cidfont_data[cid_name].characters) do if not v.width then v.width = 655360 end