--
luatexbase.provides_module({
name = 'luatexja.adjust',
- date = '2014/02/01',
+ date = '2014/02/02',
description = 'Advanced line adjustment for LuaTeX-ja',
})
module('luatexja.adjust', package.seeall)
local node_new = Dnode.new
local node_copy = Dnode.copy
local node_hpack = Dnode.hpack
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
local node_free = Dnode.free
-local node_prev = Dnode.getprev
+local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev
local node_tail = Dnode.tail
local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
--
luatexbase.provides_module({
name = 'luatexja.jfmglue',
- date = '2014/02/01',
+ date = '2014/02/02',
description = 'Insertion process of JFM glues and kanjiskip',
})
module('luatexja.jfmglue', package.seeall)
local set_attr = Dnode.set_attribute
local insert_before = Dnode.insert_before
local insert_after = Dnode.insert_after
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
local round = tex.round
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_find_char_class = ltjf.find_char_class
end
local function check_next_ickern(lp)
- if getid(lp) == id_kern and ITALIC == get_attr_icflag(lp) then
+ if lp and getid(lp) == id_kern and ITALIC == get_attr_icflag(lp) then
set_attr(lp, attr_icflag, IC_PROCESSED)
Np.last = lp; return node_next(lp)
else
local lpa, nc = KINSOKU, nil
set_attr(lp, attr_icflag, get_attr_icflag(lp));
while lp and (lpa>=PACKED) and (lpa<BOXBDD) do
- nc, lp = lp, node_next(lp); lpa = has_attr(lp, attr_icflag) or 0
+ nc, lp = lp, node_next(lp); lpa = lp and has_attr(lp, attr_icflag) or 0
-- get_attr_icflag() ではいけない!
end
Np.nuc = nc
function main(ahead, mode)
if not ahead then return ahead end
head = ahead;
- local lp, par_indented = init_var(mode);
+ local lp, par_indented = init_var(mode)
lp = calc_np(lp, last)
if Np then
extract_np(); handle_list_head(par_indented)
do
local IHB = luatexja.userid_table.IHB
local BPAR = luatexja.userid_table.BPAR
- local node_prev = Dnode.getprev
+ local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev
local node_write = Dnode.write
-- \inhibitglue
local node_traverse = Dnode.traverse
local node_new = Dnode.new
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
local node_free = Dnode.free
local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
local node_new = Dnode.new
local node_remove = luatexja.Dnode_remove -- Dnode.remove
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
local node_free = Dnode.free
local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
local set_attr = Dnode.set_attribute
local node_traverse = Dnode.traverse
local node_remove =luatexja.Dnode_remove -- Dnode.remove
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
local node_free = Dnode.free
local node_end_of_math = Dnode.end_of_math
local tex_getcount = tex.getcount
local node_new = Dnode.new
local node_remove = luatexja.Dnode_remove -- Dnode.remove
local node_tail = Dnode.tail
-local node_next = Dnode.getnext
+local node_next = (Dnode ~= node) and Dnode.getnext or node.next
local has_attr = Dnode.has_attribute
local set_attr = Dnode.set_attribute
local node_insert_before = Dnode.insert_before
end
local Dnode = node.direct or node
- local Dnode_remove, Dnode_next, Dnode_prev = Dnode.remove, Dnode.getnext, Dnode.getprev
- local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end
- local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end
- function luatexja.Dnode_remove (head, current)
- if head==current then
- local q, r = Dnode_next(current), Dnode_prev(current)
- setfield(current, 'next', nil)
- if q then setfield(q, 'prev', r) end
- if r and Dnode_next(r) == current then -- r is "real prev"
- setfield(r, 'next', q)
+ if Dnode~=node then
+ local Dnode_remove = Dnode.remove
+ local Dnode_next, Dnode_prev = Dnode.getnext, node.getprev
+ local getfield, setfield = Dnode.getfield, Dnode.setfield
+ function luatexja.Dnode_remove (head, current)
+ if head==current then
+ local q, r = Dnode_next(current), Dnode_prev(current)
+ setfield(current, 'next', nil)
+ if q then setfield(q, 'prev', r) end
+ if r and Dnode_next(r) == current then -- r is "real prev"
+ setfield(r, 'next', q)
+ end
+ return q, q
+ else
+ return Dnode_remove(head, current)
end
- return q, q
- else
- return Dnode_remove(head, current)
end
+ else
+ luatexja.Dnode_remove = luatexja.node_remove
end
end