local node_free = Dnode.free
local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
local unset_attr = Dnode.unset_attribute
local node_free = Dnode.free
local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
local unset_attr = Dnode.unset_attribute
local ltjc_is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char
luatexja.userid_table.OTF = luatexbase.newuserwhatsitid('char_by_cid', 'luatexja')
local ltjc_is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char
luatexja.userid_table.OTF = luatexbase.newuserwhatsitid('char_by_cid', 'luatexja')
local OTF, VSR = luatexja.userid_table.OTF, luatexja.userid_table.VSR
local function get_ucs_from_rmlgbm(c)
local OTF, VSR = luatexja.userid_table.OTF, luatexja.userid_table.VSR
local function get_ucs_from_rmlgbm(c)
i,w = tonumber(string.sub(w,1,4),16), tonumber(string.sub(w,-4),16)
if (w>=0xD800) and (w<=0xDB7F) and (i>=0xDC00) and (i<=0xDFFF) then -- Surrogate pair
return (w-0xD800)*0x400 + (i-0xDC00)
i,w = tonumber(string.sub(w,1,4),16), tonumber(string.sub(w,-4),16)
if (w>=0xD800) and (w<=0xDB7F) and (i>=0xDC00) and (i<=0xDFFF) then -- Surrogate pair
return (w-0xD800)*0x400 + (i-0xDC00)
local function cid(key)
if key==0 then return append_jglyph(char) end
local curjfnt = identifiers[tex.attribute[attr_curjfnt]]
local function cid(key)
if key==0 then return append_jglyph(char) end
local curjfnt = identifiers[tex.attribute[attr_curjfnt]]
curjfnt.cidinfo.ordering ~= "Japan1" and
curjfnt.cidinfo.ordering ~= "GB1" and
curjfnt.cidinfo.ordering ~= "CNS1" and
curjfnt.cidinfo.ordering ~= "Japan1" and
curjfnt.cidinfo.ordering ~= "GB1" and
curjfnt.cidinfo.ordering ~= "CNS1" and
ltjb.package_warning('luatexja-otf',
'Current Japanese font (or other CJK font) "'
..curjfnt.psname..'" does not have the specified CID character ('
ltjb.package_warning('luatexja-otf',
'Current Japanese font (or other CJK font) "'
..curjfnt.psname..'" does not have the specified CID character ('
set_attr(g, attr_curjfnt, puid==OTF and v or -1)
-- VSR yields ALchar
v = has_attr(p, attr_yablshift)
set_attr(g, attr_curjfnt, puid==OTF and v or -1)
-- VSR yields ALchar
v = has_attr(p, attr_yablshift)
set_attr(g, attr_yablshift, v)
else
unset_attr(g, attr_yablshift)
set_attr(g, attr_yablshift, v)
else
unset_attr(g, attr_yablshift)
cid_to_char, "ltj.otf.define_jfont", 1)
-- 既に読み込まれているフォントに対しても,同じことをやらないといけない
for fn, v in pairs(ltjf_font_metric_table) do
cid_to_char, "ltj.otf.define_jfont", 1)
-- 既に読み込まれているフォントに対しても,同じことをやらないといけない
for fn, v in pairs(ltjf_font_metric_table) do
for i,_ in pairs(ivs[bu]) do
if i==vs then uniq_flag = false; break end
end
for i,_ in pairs(ivs[bu]) do
if i==vs then uniq_flag = false; break end
end
-- if the cache is present, read it
local newsum = checksum(fname) -- MD5 checksum of the fontfile
local v = "ivs_" .. string.lower(file.nameonly(fname))
-- if the cache is present, read it
local newsum = checksum(fname) -- MD5 checksum of the fontfile
local v = "ivs_" .. string.lower(file.nameonly(fname))
function (t) return (t.version~=cache_ver) or (t.chksum~=newsum) end
)
-- if the cache is not found or outdated, save the cache
function (t) return (t.version~=cache_ver) or (t.chksum~=newsum) end
)
-- if the cache is not found or outdated, save the cache
font_ivs_basename[bname] = dat[1] or {}
else
dat = make_ivs_table(id, fname)
font_ivs_basename[bname] = dat or {}
ltjb.save_cache( v,
{
font_ivs_basename[bname] = dat[1] or {}
else
dat = make_ivs_table(id, fname)
font_ivs_basename[bname] = dat or {}
ltjb.save_cache( v,
{
-- q is a variation selector
if qc>=0xE0100 then qc = qc - 0xE0100 end
local pt = font_ivs_table[pf]
-- q is a variation selector
if qc>=0xE0100 then qc = qc - 0xE0100 end
local pt = font_ivs_table[pf]
if pt then
local np = ivs_jglyph(pt, p, pf,
(has_attr(p,attr_curjfnt) or 0)==pf and OTF or VSR)
if pt then
local np = ivs_jglyph(pt, p, pf,
(has_attr(p,attr_curjfnt) or 0)==pf and OTF or VSR)
- -- font define
- local function font_callback(name, size, id, fallback)
- local d = fallback(name, size, id)
- prepare_ivs_data(id, d)
- return d
- end
-
enable_ivs = function ()
if is_ivs_enabled then
ltjb.package_warning('luatexja-otf',
'luatexja.otf.enable_ivs() was already called, so this call is ignored', '')
else
enable_ivs = function ()
if is_ivs_enabled then
ltjb.package_warning('luatexja-otf',
'luatexja.otf.enable_ivs() was already called, so this call is ignored', '')
else
do_ivs_repr, 'do_ivs', 1)
local ivs_callback = function (name, size, id)
return font_callback(
do_ivs_repr, 'do_ivs', 1)
local ivs_callback = function (name, size, id)
return font_callback(
function (name, size, id) return luatexja.font_callback(name, size, id) end
)
end
function (name, size, id) return luatexja.font_callback(name, size, id) end
)
end
- luatexbase.add_to_callback('define_font',ivs_callback,"luatexja.ivs_font_callback", 1)
+ luatexbase.add_to_callback('luatexja.define_font',
+ function (res, name, size, id)
+ prepare_ivs_data(id, res)
+ end,
+ 'prepare_ivs_data', 1)
for i=1,font.nextid()-1 do
if identifiers[i] then prepare_ivs_data(i, identifiers[i]) end
end
for i=1,font.nextid()-1 do
if identifiers[i] then prepare_ivs_data(i, identifiers[i]) end
end