--
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)
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',
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
-- no embedding
local var = ''
- local s = string.match(specification.detail, 'slant=([+-]*[0-9]*%.[0-9]*)')
- if s and e~=1 then
+ local s = string.match(specification.detail, 'slant=([+-]*%d*%.?%d)')
+ if s and e~=0 then
s = s * 1000
var, fontdata.slant = var .. 's' .. tostring(s), s
end
- local e = string.match(specification.detail, 'extend=([+-]*[0-9]*%.[0-9]*)')
+ local e = string.match(specification.detail, 'extend=([+-]*%d*%.?%d)')
if e and e~=1 then
e = e * 1000
var, fontdata.extend = var .. 'x' .. tostring(e), e
local s = "Adobe-Japan1-6"
local basename = utf.sub(name,p+1)
local p = utf.find(basename, ":")
+ local q = utf.find(basename, "/[BI][BI]?")
+ if q and p and q<=p then
+ basename = utf.gsub(basename, '/[BI][BI]?', '', 1)
+ p = utf.find(basename, ":")
+ end
if p then
local xname = utf.sub(basename, p+1)
p = 1