--
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
local qs = getfield(q, 'spec')
if not getfield(qs, 'writable') then return 0 end
if gs == 1 then -- stretching
- if getfield(qs, 'stretch_order') == go then
- return getfield(qs, 'stretch')
+ if getfield(qs, 'stretch_order') == go then
+ return getfield(qs, 'stretch')
+ else return 0
end
else -- shrinking
if getfield(qs, 'shrink_order') == go then
return getfield(qs, 'shrink')
+ else return 0
end
end
end
local function aw_step1(p, res, total)
local head = getlist(p)
local x = node_tail(head); if not x then return false end
+ -- x: \rightskip
x = node_prev(x); if not x then return false end
- -- 本当の行末の node を格納
if getid(x) == id_glue and getsubtype(x) == 15 then
-- 段落最終行のときは,\penalty10000 \parfillskip が入るので,
-- その前の node が本来の末尾文字となる
return false-- それ以外は対象外.
end
local xk = ltjf_font_metric_table[getfont(xc)]
- xk = xk.char_type[has_attr(xc, attr_jchar_class) or 0]
- xk = xk['end_' .. res.name] or 0
+ xk = xk.char_type[has_attr(xc, attr_jchar_class) or 0]
+ xk = xk['end_' .. res.name] or 0
if xk>0 and total>=xk then
total = total - xk