local node_free = node.direct.flush_node or node.direct.free
local node_prev = node.direct.getprev
local node_tail = node.direct.tail
-local has_attr = node.direct.has_attribute
+local get_attr = node.direct.get_attribute
local set_attr = node.direct.set_attribute
local insert_after = node.direct.insert_after
do
local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG
get_attr_icflag = function(p)
- return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
+ return (get_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
end
end
return total, false-- それ以外は対象外.
end
local eadt = ltjf_font_metric_table[getfont(xc)]
- .char_type[has_attr(xc, attr_jchar_class) or 0].end_adjust
+ .char_type[get_attr(xc, attr_jchar_class) or 0].end_adjust
if not eadt then
return total, false
end
end
end
local eadt = ltjf_font_metric_table[getfont(xc)]
- .char_type[has_attr(xc, attr_jchar_class) or 0].end_adjust
+ .char_type[get_attr(xc, attr_jchar_class) or 0].end_adjust
if not eadt then
return total, false
end
local dir_tate = luatexja.dir_table.dir_tate
local get_dir_count = ltjd.get_dir_count
local ltjf_font_metric_table = ltjf.font_metric_table
+ local has_attr = node.direct.has_attribute
local function get_current_metric(n)
- local fn = has_attr(n, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
+ local fn = get_attr(n, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
return fn and ltjf_font_metric_table[fn]
end
local function whatsit_callback(Np, lp, Nq)
luatexja.load_module 'base'; local ltjb = luatexja.base
local getchar = node.direct.getchar
-local has_attr = node.direct.has_attribute
-local has_attr_node = node.has_attribute
+local get_attr = node.direct.get_attribute
+local get_attr_node = node.get_attribute
local tex_getattr = tex.getattribute
local UNSET = -0x7FFFFFFF
local ka = luatexbase.attributes['ltj@kcat0']
for i = 0, 30 do
local pw = 2^i; kcat_attr_table[i], pow_table[i] = ka, pw
- fn_table[i] = function(p) return has_attr(p, ka)&pw==0 end
- nfn_table[i] = function(p) return has_attr_node(p, ka)&pw==0 end
+ fn_table[i] = function(p) return get_attr(p, ka)&pw==0 end
+ nfn_table[i] = function(p) return get_attr_node(p, ka)&pw==0 end
end
end
for i = 31, 31*ATTR_RANGE-1 do
local ka, pw = luatexbase.attributes['ltj@kcat'..floor(i/31)], 2^(i%31)
kcat_attr_table[i], pow_table[i] = ka, pw
- fn_table[i] = function(p) return (has_attr(p, ka) or 0)&pw==0 end
- nfn_table[i] = function(p) return (has_attr_node(p, ka) or 0)&pw==0 end
+ fn_table[i] = function(p) return (get_attr(p, ka) or 0)&pw==0 end
+ nfn_table[i] = function(p) return (get_attr_node(p, ka) or 0)&pw==0 end
end
fn_table[-1] = function() return false end -- for char --U+007F
nfn_table[-1] = function() return false end -- for char --U+007F
local cat_lp = luatexbase.catcodetables['latex-package']
local to_node = dnode.tonode
local to_direct = dnode.todirect
-local has_attr = dnode.has_attribute
+local get_attr = dnode.get_attribute
local set_attr = dnode.set_attribute
local insert_before = dnode.insert_before
local insert_after = dnode.insert_after
local dir_node_auto = luatexja.dir_table.dir_node_auto
local dir_node_manual = luatexja.dir_table.dir_node_manual
local function get_attr_icflag(p)
- return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
+ return (get_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
end
local page_direction
local get_dir_count, get_adjust_dir_count
do
- local node_attr = node.has_attribute
+ local node_attr = node.get_attribute
local function get_dir_count_inner(h)
if h then
if h.id==id_whatsit and h.subtype==sid_user and h.user_id==DIR then
end
end
if hd==wh[1] then
- ltjs.list_dir = has_attr(hd, attr_dir)
+ ltjs.list_dir = get_attr(hd, attr_dir)
local x = node_next(hd)
while x and getid(x)==id_glue and getsubtype(x)==3 do
node_remove(hd,x); node_free(x); x = node_next(hd)
-- 2nd ret val はその DIR whatsit
function get_box_dir(b, default)
start_time_measure 'get_box_dir'
- local dir = has_attr(b, attr_dir) or 0
+ local dir = get_attr(b, attr_dir) or 0
local bh = getfield(b, 'head') -- We cannot use getlist since b may be an unset_node.
local c
if bh~=0 then -- bh != nil
for bh in traverse_id(id_whatsit, bh) do
if getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR then
- c = bh; dir = (dir==0) and has_attr(bh, attr_dir) or dir
+ c = bh; dir = (dir==0) and get_attr(bh, attr_dir) or dir
end
end
end
local db
local dnh = getfield(dn, 'value')
for x in traverse(dnh) do
- if has_attr(x, attr_dir)%dir_math_mod == new_dir then
+ if get_attr(x, attr_dir)%dir_math_mod == new_dir then
setfield(dn, 'value', to_node(node_remove(dnh, x)))
db=x; break
end
if s_dir ~= l_dir then
local not_found = true
for x in traverse(getfield(wh, 'value')) do
- if l_dir == has_attr(x, attr_dir)%dir_node_auto then
+ if l_dir == get_attr(x, attr_dir)%dir_node_auto then
setdimen('ltj@tempdima', getfield(x, key))
not_found = false; break
end
local db
local dnh = getfield(wh, 'value')
for x in traverse(dnh) do
- if has_attr(x, attr_dir)%dir_node_auto==l_dir then
+ if get_attr(x, attr_dir)%dir_node_auto==l_dir then
db = x; break
end
end
-- change dimension of dir_nodes which are created "automatically"
local bw, bh, bd = getwhd(s)
for x in traverse(getfield(wh, 'value')) do
- local x_dir = has_attr(x, attr_dir)
+ local x_dir = get_attr(x, attr_dir)
if x_dir<dir_node_manual then
local info = dir_node_aux[s_dir][x_dir%dir_node_auto]
setwhd(x, info.width(bw,bh,bd), info.height(bw,bh,bd), info.depth(bw,bh,bd))
local bh = getlist(p)
if getid(bh)==id_whatsit and getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR
and node_next(bh) then
- ltjs.list_dir = has_attr(bh, attr_dir)
+ ltjs.list_dir = get_attr(bh, attr_dir)
setlist(p, (node_remove(bh,bh)))
split_dir_head, split_dir_2nd = bh, false
else
local w = node_next(bh)
if getid(w)==id_whatsit and getsubtype(w)==sid_user and getfield(w, 'user_id')==DIR then
- ltjs.list_dir = has_attr(w, attr_dir)
+ ltjs.list_dir = get_attr(w, attr_dir)
setlist(p, (node_remove(bh,w)))
split_dir_head, split_dir_2nd = w, true
end
split_dir_whatsit = hd
elseif gc=='split_off' then
if split_dir_head then
- ltjs.list_dir = has_attr(split_dir_head, attr_dir)
+ ltjs.list_dir = get_attr(split_dir_head, attr_dir)
if split_dir_2nd then hd = insert_after(hd, hd, split_dir_head)
else hd = insert_before(hd, hd, split_dir_head)
end
local setpenalty = node.direct.setpenalty
local setkern = node.direct.setkern
-local has_attr = node.direct.has_attribute
+local get_attr = node.direct.get_attribute
local set_attr = node.direct.set_attribute
local insert_before = node.direct.insert_before
local insert_after = node.direct.insert_after
local ltjs_orig_char_table = ltjs.orig_char_table
local function get_attr_icflag(p)
- return (has_attr(p, attr_icflag) or 0)%PROCESSED_BEGIN_FLAG
+ return (get_attr(p, attr_icflag) or 0)%PROCESSED_BEGIN_FLAG
end
-------------------- Helper functions
else
nc, lp = lp, node_next(lp)
end
- first, lpa = false, (lp and has_attr(lp, attr_icflag) or 0)
+ first, lpa = false, (lp and get_attr(lp, attr_icflag) or 0)
-- get_attr_icflag() ではいけない!
end
Np.nuc = nc
local ln = node_next(lp)
if ltju.specified_feature(getfont(lp), 'notdef') and ln and getid(ln)==id_glyph then
set_attr(lp, attr_icflag, PROCESSED)
- set_attr(ln, attr_jchar_code, has_attr(lp, attr_jchar_code) or getchar(lp))
- set_attr(ln, attr_jchar_class, has_attr(lp, attr_jchar_class) or 0)
+ set_attr(ln, attr_jchar_code, get_attr(lp, attr_jchar_code) or getchar(lp))
+ set_attr(ln, attr_jchar_class, get_attr(lp, attr_jchar_class) or 0)
Np.nuc, lp = ln, ln
end
end
-- loop
local first_glyph, last_glyph = lp
set_attr(lp, attr_icflag, PROCESSED); Np.last = lp
- local y_adjust = has_attr(lp,attr_ablshift) or 0
+ local y_adjust = get_attr(lp,attr_ablshift) or 0
local node_depth = getdepth(lp) + min(y_adjust, 0)
local adj_depth = (y_adjust>0) and (getdepth(lp) + y_adjust) or 0
setfield(lp, 'yoffset', getfield(lp, 'yoffset') - y_adjust); lp = node_next(lp)
if lid==id_glyph and not if_lang_ja(lx) then
-- 欧文文字
last_glyph = lx; set_attr(lx, attr_icflag, PROCESSED); Np.last = lx
- y_adjust = has_attr(lx,attr_ablshift) or 0
+ y_adjust = get_attr(lx,attr_ablshift) or 0
node_depth = max(getdepth(lx) + min(y_adjust, 0), node_depth)
adj_depth = (y_adjust>0) and max(getdepth(lx) + y_adjust, adj_depth) or adj_depth
setfield(lx, 'yoffset', getfield(lx, 'yoffset') - y_adjust); lx = node_next(lx)
set_attr(lx, attr_icflag, PROCESSED)
lx = node_next(lx) -- lx: アクセント本体
if getid(lx)==id_glyph then
- setfield(lx, 'yoffset', getfield(lx, 'yoffset') - (has_attr(lx,attr_ablshift) or 0))
+ setfield(lx, 'yoffset', getfield(lx, 'yoffset') - (get_attr(lx,attr_ablshift) or 0))
else -- アクセントは上下にシフトされている
- setshift(lx, getshift(lx) + (has_attr(lx,attr_ablshift) or 0))
+ setshift(lx, getshift(lx) + (get_attr(lx,attr_ablshift) or 0))
end
set_attr(lx, attr_icflag, PROCESSED)
lx = node_next(lx); set_attr(lx, attr_icflag, PROCESSED)
Np.first = Np.first or lp
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
if getid(lp)==id_glyph then -- アクセント本体
- setfield(lp, 'yoffset', getfield(lp, 'yoffset') - (has_attr(lp,attr_ablshift) or 0))
+ setfield(lp, 'yoffset', getfield(lp, 'yoffset') - (get_attr(lp,attr_ablshift) or 0))
else -- アクセントは上下にシフトされている
- setshift(lp, getshift(lp) + (has_attr(lp,attr_ablshift) or 0))
+ setshift(lp, getshift(lp) + (get_attr(lp,attr_ablshift) or 0))
end
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
for k = 1,#Bp do Bp[k] = nil end
while lp ~= last do
- local lpa = has_attr(lp, attr_icflag) or 0
+ local lpa = get_attr(lp, attr_icflag) or 0
-- unbox 由来ノードの検出
if (lpa>=PACKED) and (lpa%PROCESSED_BEGIN_FLAG<=BOXBDD) then
if lpa%PROCESSED_BEGIN_FLAG == BOXBDD then
local dir_tate = luatexja.dir_table.dir_tate
-- 和文文字のデータを取得
+ local has_attr = node.direct.has_attribute
local attr_jchar_class = luatexbase.attributes['ltj@charclass']
local attr_jchar_code = luatexbase.attributes['ltj@charcode']
local attr_autospc = luatexbase.attributes['ltj@autospc']
end
function set_np_xspc_jachar_hbox(Nx, x)
local m = ltjf_font_metric_table[getfont(x)]
- local c = has_attr(x, attr_jchar_code) or getchar(x)
- Nx.met, Nx.char = m, c; Nx.class = has_attr(x, attr_jchar_class) or 0;
+ local c = get_attr(x, attr_jchar_code) or getchar(x)
+ Nx.met, Nx.char = m, c; Nx.class = get_attr(x, attr_jchar_class) or 0;
local mc = m.char_type; Nx.char_type = mc
Nx.pre = table_current_stack[PRE + c] or 0
Nx.post = table_current_stack[POST + c] or 0
if w~=1073741823 then
setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, lxi)
else
- local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)]
+ local m = ltjf_font_metric_table[get_attr(lx, attr_tablshift)]
setglue(lx, bk[1], bk[2], bk[3], 0, 0)
set_attr(lx, attr_icflag, lxi_jfm)
end
end
local function special_jaglue_after(lx)
if get_attr_icflag(lx)==SPECIAL_JAGLUE then
- lxi=has_attr(lx, attr_yablshift)
+ lxi=get_attr(lx, attr_yablshift)
if lxi>=PROCESSED_BEGIN_FLAG then
lxi = lxi%PROCESSED_BEGIN_FLAG
if lxi == KANJI_SKIP then
special_jaglue_after_inner(lx, lxi, KANJI_SKIP_JFM, kanji_skip,
- ltjf_font_metric_table[has_attr(lx, attr_tablshift)].kanjiskip or null_skip_table)
+ ltjf_font_metric_table[get_attr(lx, attr_tablshift)].kanjiskip or null_skip_table)
else -- lxi == XKANJI_SKIP
special_jaglue_after_inner(lx, lxi, XKANJI_SKIP_JFM, xkanji_skip,
- ltjf_font_metric_table[has_attr(lx, attr_tablshift)].xkanjiskip or null_skip_table)
+ ltjf_font_metric_table[get_attr(lx, attr_tablshift)].xkanjiskip or null_skip_table)
end
else
set_attr(lx, attr_icflag, lxi)
local node_new = node.direct.new
local node_free = node.direct.flush_node or node.direct.free
-local has_attr = node.direct.has_attribute
+local get_attr = node.direct.get_attribute
local set_attr = node.direct.set_attribute
local round = tex.round
local font_getfont = font.getfont
if p and getid(p)==id_glyph then
if is_ucs_in_japanese_char(p) then
local j = font_metric_table[
- has_attr(p, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
+ get_attr(p, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
]
local g = new_ic_kern()
setkern(g, j.char_type[find_char_class(getchar(p), j)].italic)
local node_next = node.direct.getnext
local node_remove = node.direct.remove
local node_free = node.direct.flush_node or node.direct.free
-local has_attr = node.direct.has_attribute
+local get_attr = node.direct.get_attribute
local set_attr = node.direct.set_attribute
local tex_getcount = tex.getcount
if getid(hd)==id_whatsit and getsubtype(hd)==sid_user
and getfield(hd, 'user_id')==DIR then
local d = node_next(hd)
- if getid(d)==id_vlist and has_attr(d, attr_dir)>=dir_node_auto then
+ if getid(d)==id_vlist and get_attr(d, attr_dir)>=dir_node_auto then
node_free(hd); setlist(h, nil); node_free(h)
setlist(sb, d); set_attr(d, attr_icflag, 0)
end
setlist(p, conv_jchar_to_hbox(getlist(p), sty))
end
elseif pid == id_mchar then
- local pc, fam = getchar (p), has_attr(p, attr_jfam) or -1
+ local pc, fam = getchar (p), get_attr(p, attr_jfam) or -1
if (not is_math_letters[pc]) and is_ucs_in_japanese_char(p) and fam>=0 then
local f = ltjs.get_stack_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack'))
if f ~= -1 then
local q = node_new(id_sub_box)
local r = node_new(id_glyph, 256); setnext(r, nil)
setchar(r, pc); setfont(r, f)
- local k = has_attr(r,attr_ykblshift) or 0; set_attr(r, attr_ykblshift, 0)
+ local k = get_attr(r,attr_ykblshift) or 0; set_attr(r, attr_ykblshift, 0)
-- ltj-setwidth 内で実際の位置補正はおこなうので,補正量を退避
local met = ltjf_font_metric_table[f]
r = capsule_glyph_math(r, met, met.char_type[ltjf_find_char_class(pc, met)]);
local node_remove = node.direct.remove
local node_next = node.direct.getnext
local node_free = node.direct.flush_node or node.direct.free
-local has_attr = node.direct.has_attribute
+local get_attr = node.direct.get_attribute
local set_attr = node.direct.set_attribute
local unset_attr = node.direct.unset_attribute
local node_insert_after = node.direct.insert_after
if puid==OTF then
local g = node_new(id_glyph, 0)
setchar(g, getfield(p, 'value'))
- setfont(g, has_attr(p, attr_curfnt))
+ setfont(g, get_attr(p, attr_curfnt))
setlang(g, lang_ja)
- set_attr(g, attr_kblshift, has_attr(p, attr_kblshift))
+ set_attr(g, attr_kblshift, get_attr(p, attr_kblshift))
head = node_insert_after(head, p, g)
head = node_remove(head, p)
node_free(p); p = g
local pairs = pairs
local floor = math.floor
+local get_attr = node.direct.get_attribute
local has_attr = node.direct.has_attribute
local set_attr = node.direct.set_attribute
local node_traverse = node.direct.traverse
if uid==STCK then
wt[#wt+1] = p; node_remove(head, p)
elseif uid==DIR then
- if has_attr(p, attr_icflag)<PROCESSED_BEGIN_FLAG then
- ltjs.list_dir = has_attr(p, attr_dir)
+ if get_attr(p, attr_icflag)<PROCESSED_BEGIN_FLAG then
+ ltjs.list_dir = get_attr(p, attr_dir)
else -- こっちのケースは通常使用では起こらない
wtd[#wtd+1] = p; node_remove(head, p)
end
return node_next(p)
end,
}
- setmetatable(suppress_hyphenate_ja_aux,
+ setmetatable(suppress_hyphenate_ja_aux,
{ __index = function() return node_next end, })
local id_boundary = node.id('boundary')
local node_new, insert_before = node.direct.new, node.direct.insert_before
setfield(b, 'type', 100); setfield(b, 'user_id', JA_AL_BDD);
insert_before(head, p, b)
end
- local pf = has_attr(p, attr_curjfnt)
+ local pf = get_attr(p, attr_curjfnt)
pf = (pf and pf>0 and pf) or getfont(p)
setfont(p, ltjf_replace_altfont(pf, pc))
setlang(p, lang_ja)
if ltjs.list_dir == dir_tate then
for p in traverse_id(id_glyph,to_direct(head)) do
if has_attr(p, attr_icflag, 0) and getlang(p)==lang_ja then
- local nf = ltjf_replace_altfont( has_attr(p, attr_curtfnt) or getfont(p) , ltjs_orig_char_table[p])
+ local nf = ltjf_replace_altfont( get_attr(p, attr_curtfnt) or getfont(p) , ltjs_orig_char_table[p])
setfont(p, nf)
if ltjf_font_metric_table[nf].vert_activated then
local pc = getchar(p); pc = ltjf_font_metric_table[nf].vform[pc]
local node_next = node.direct.getnext
local node_copy, node_tail = node.direct.copy, node.direct.tail
local node_free = node.direct.flush_node or node.direct.free
-local has_attr, set_attr = node.direct.has_attribute, node.direct.set_attribute
+local get_attr, set_attr = node.direct.get_attribute, node.direct.set_attribute
local insert_before, insert_after = node.direct.insert_before, node.direct.insert_after
local hpack = node.direct.hpack
-- ルビ組版が行われている段落/hboxでの設定が使われる.
-- ルビ文字を格納しているボックスでの設定ではない!
local function get_attr_icflag(p)
- return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
+ return (get_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
end
local concat
do
local _, hh, hd = getwhd(box)
local hx = h
while hx do
- local hic = has_attr(hx, attr_icflag) or 0
+ local hic = get_attr(hx, attr_icflag) or 0
if (hic == KANJI_SKIP) or (hic == KANJI_SKIP_JFM)
or (hic == XKANJI_SKIP) or (hic == XKANJI_SKIP_JFM)
or ((hic<=FROM_JFM+63) and (hic>=FROM_JFM)) then
local nv = getfield(n, 'value')
local rst = getfield(nv, 'value')
max_allow_pre = rst.pre or 0
- local atr = has_attr(n, attr_ruby) or 0
+ local atr = get_attr(n, attr_ruby) or 0
if max_allow_pre < 0 then
-- 直前のルビで intrusion がおこる可能性あり.
-- 前 run のデータが残っていればそれを使用,
local post_lown
do
local function write_aux(wv, num, bool)
- local id = has_attr(wv, attr_ruby_id) or 0
+ local id = get_attr(wv, attr_ruby_id) or 0
if id>0 and cache_handle then
cache_handle:write(
'lrob[' .. tostring(id) .. ']=' .. num .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n')
post_lown = function (rs, rw, cmp, ch)
-- ch: the head of `current' hlist
if #rs ==0 or not rw then return ch end
- local hn = has_attr(rs[1], attr_ruby)
- local fn = has_attr(rs[#rs], attr_ruby)
+ local hn = get_attr(rs[1], attr_ruby)
+ local fn = get_attr(rs[#rs], attr_ruby)
local wv = getfield(rw, 'value')
if hn==1 then
if fn==2*cmp+2 then
node_remove(wv, hn)
insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
- write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))-- 行中形
+ write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))-- 行中形
else
local deg, hn = (fn-1)/2, wv
for i = 1, deg do hn = node_next(hn) end;
setnext(hn, nil)
insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
- write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))
+ write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))
end
else
local deg, hn = max((hn-1)/2,2), wv
insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
if fn == 2*cmp-1 then
- write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))
+ write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))
end
end
for i = 1,#rs do
or (hai == id_rule and getsubtype(ha)==0)
or (hai == id_whatsit and getsubtype(ha)==sid_user
and getfield(ha, 'user_id', RUBY_POST)))
- and has_attr(ha, attr_ruby) or 0
+ and get_attr(ha, attr_ruby) or 0
if i==0 then
ha = node_next(ha)
elseif i==1 then
or (hai == id_rule and getsubtype(ha)==0)
or (hai == id_whatsit and getsubtype(ha)==sid_user
and getfield(ha, 'user_id', RUBY_POST)))
- and has_attr(ha, attr_ruby) or 0
+ and get_attr(ha, attr_ruby) or 0
if i==0 then
ha = node_next(ha)
elseif i==1 then
end
rst.post = p
end
- Np.prev_ruby = has_attr(getfield(Nq.nuc, 'value'), attr_ruby_id)
+ Np.prev_ruby = get_attr(getfield(Nq.nuc, 'value'), attr_ruby_id)
-- 前のクラスタがルビであったことのフラグ
else -- 直前が文字以外
local nqnv = getfield(Nq.nuc, 'value')
local node_remove = node.direct.remove
local node_tail = node.direct.tail
local node_next = node.direct.getnext
-local has_attr = node.direct.has_attribute
+local get_attr = node.direct.get_attribute
local set_attr = node.direct.set_attribute
local node_insert_before = node.direct.insert_before
local node_insert_after = node.direct.insert_after
local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG
local floor = math.floor
get_pr_begin_flag = function (p)
- local i = has_attr(p, attr_icflag) or 0
+ local i = get_attr(p, attr_icflag) or 0
return i - i%PROCESSED_BEGIN_FLAG
end
end
if not char_data then return node_next(p), head, p end
fshift.down = char_data.down; fshift.left = char_data.left
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
- local kbl = has_attr(p, attr_ykblshift) or 0
+ local kbl = get_attr(p, attr_ykblshift) or 0
--
-- f*: whd specified in JFM
local pwidth, pheight,pdepth = getwhd(p)
local function capsule_glyph_tate_rot(p, met, char_data, head, dir, asc)
fshift.down = char_data.down; fshift.left = char_data.left
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
- local kbl = has_attr(p, attr_tkblshift) or 0
+ local kbl = get_attr(p, attr_tkblshift) or 0
-- f*: whd specified in JFM
local pwidth, pheight,pdepth = getwhd(p)
local fwidth = char_data.width or pwidth
if met.rotation and met.vert_activated then
local f = font_getfont(pf)
local r, l = met.rotation[pc], f.properties and f.properties.language
- if ((r==true) or (type(r)=="table" and not r[l])) and (has_attr(p, attr_vert_ori) or 0)<=0 then
+ if ((r==true) or (type(r)=="table" and not r[l])) and (get_attr(p, attr_vert_ori) or 0)<=0 then
return capsule_glyph_tate_rot(p, met, char_data, head, dir,
0.5*(get_ascender(pf)-get_descender(pf)))
end
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
local fheight = char_data.height or 0
local fdepth = char_data.depth or 0
- local y_shift = xo + (has_attr(p,attr_tkblshift) or 0)
+ local y_shift = xo + (get_attr(p,attr_tkblshift) or 0)
local q
head, q = node_remove(head, p)
local box = node_new(id_hlist, nil, p)
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
local fheight, fdepth = char_data.height, char_data.depth
local y_shift
- = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0)
+ = - getfield(p, 'yoffset') + (get_attr(p,attr_ykblshift) or 0)
setfield(p, 'yoffset', -fshift.down)
setfield(p, 'xoffset', getfield(p, 'xoffset') + char_data.align*(fwidth-pwidth) - fshift.left)
local box = node_new(id_hlist, nil, p);
local pid = getid(p)
if p==last then
return
- elseif (has_attr(p, attr_icflag) or 0) ~= PROCESSED then
+ elseif (get_attr(p, attr_icflag) or 0) ~= PROCESSED then
if pid==id_hlist or pid==id_vlist then
- setshift(p, getshift(p) + (has_attr(p,attr_ablshift) or 0))
+ setshift(p, getshift(p) + (get_attr(p,attr_ablshift) or 0))
elseif pid==id_rule then
- local v = has_attr(p,attr_ablshift) or 0
+ local v = get_attr(p,attr_ablshift) or 0
setheight(p, getheight(p)-v); setdepth(p, getdepth(p)+v)
set_attr(p, attr_icflag, PROCESSED)
elseif pid==id_glyph then
-- 欧文文字; 和文文字は pid == id_hlist の場合で処理される
-- (see conv_jchar_to_hbox_A in ltj-math.lua)
setfield(p, 'yoffset',
- getfield(p, 'yoffset') - (has_attr(p,attr_ablshift) or 0))
+ getfield(p, 'yoffset') - (get_attr(p,attr_ablshift) or 0))
end
set_attr(p, attr_icflag, PROCESSED)
end
if not head then return end
local y_adjust, node_depth, adj_depth = 0, 0, 0
for lp in node_traverse_id(id_glyph, head) do
- y_adjust = has_attr(lp,attr_ablshift) or 0
+ y_adjust = get_attr(lp,attr_ablshift) or 0
local ld = getdepth(lp)
node_depth = max(ld + min(y_adjust, 0), node_depth)
adj_depth = (y_adjust>0) and max(ld + y_adjust, adj_depth) or adj_depth
local node_type = node.type
local node_next = node.next
-local has_attr = node.has_attribute
+local get_attr = node.get_attribute
local id_penalty = node.id('penalty')
local id_glyph = node.id('glyph')
local function debug_show_node_X(p,print_fn, limit, inner_depth)
local k = prefix
local s
- local pt, pic = node_type(p.id), (has_attr(p, attr_icflag) or 0) % icflag_table.PROCESSED_BEGIN_FLAG
+ local pt, pic = node_type(p.id), (get_attr(p, attr_icflag) or 0) % icflag_table.PROCESSED_BEGIN_FLAG
local base = prefix .. string.format('%X', pic) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' '
if pt == 'glyph' then
s = base .. ' '
if pt=='ins' then
s = base .. '(' .. print_scaled(p.height) .. '+'
.. print_scaled(p.depth) .. ')'
- .. ', dir=' .. tostring(node.has_attribute(p, attr_dir))
+ .. ', dir=' .. tostring(node.get_attribute(p, attr_dir))
else
s = base .. '(' .. print_scaled(p.height) .. '+'
.. print_scaled(p.depth) .. ')x' .. print_scaled(p.width)
- .. ', dir=' .. tostring(node.has_attribute(p, attr_dir))
+ .. ', dir=' .. tostring(node.get_attribute(p, attr_dir))
end
if (p.shift or 0)~=0 then
s = s .. ', shifted ' .. print_scaled(p.shift)
elseif pt=='rule' then
s = base .. '(' .. print_scaled(p.height) .. '+'
.. print_scaled(p.depth) .. ')x' .. print_scaled(p.width)
- .. ', dir=' .. tostring(node.has_attribute(p, attr_dir))
+ .. ', dir=' .. tostring(node.get_attribute(p, attr_dir))
print_fn(s)
elseif pt=='disc' then
print_fn(s)
else
s = s .. ' userid:' .. t .. '(node list)'
if p.user_id==uid_table.DIR then
- s = s .. ' dir: ' .. tostring(node.has_attribute(p, attr_dir))
+ s = s .. ' dir: ' .. tostring(node.get_attribute(p, attr_dir))
end
print_fn(s)
local bid = inner_depth