local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
local unset_attr = Dnode.unset_attribute
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)
ltjb.package_warning('luatexja-otf',
'luatexja.otf.enable_ivs() was already called, so this call is ignored', '')
else
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