--
-- ltj-adjust.lua
--
+luatexja.load_module('base'); local ltjb = luatexja.base
luatexja.load_module('jfont'); local ltjf = luatexja.jfont
luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue
luatexja.load_module('stack'); local ltjs = luatexja.stack
return to_node(head)
end
local is_reg = false
- function enable_cb(status_le, status_pr)
+ function enable_cb(status_le, status_pr, status_lp, status_ls)
if (status_le>0 or status_pr>0) and (not is_reg) then
- luatexbase.add_to_callback('post_linebreak_filter',
- adjust_width, 'Adjust width', 100)
+ ltjb.add_to_callback('post_linebreak_filter',
+ adjust_width, 'Adjust width',
+ luatexbase.priority_in_callback('post_linebreak_filter', 'ltj.lineskip')-1)
is_reg = true
elseif is_reg and (status_le==0 and status_pr==0) then
luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width')
end
if status_le==2 then
if not luatexbase.in_callback('luatexja.adjust_jfmglue', 'luatexja.adjust') then
- luatexbase.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust')
+ ltjb.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust')
end
myaw_step1, myaw_step1_last = dummy, aw_step1_last
else
end
end
myaw_step2 = (status_pr>0) and aw_step2 or aw_step2_dummy
+ luatexja.lineskip.setting(
+ status_lp>0 and 'profile' or 'dummy',
+ status_ls>0 and 'step' or 'dummy'
+ )
end
function disable_cb() -- only for compatibility
- enable_cs(0)
+ enable_cs(0,0,0,0)
end
luatexja.adjust.enable_cb=enable_cb
luatexja.adjust.disable_cb=disable_cb
end
-- -----------------------------------
-ltjl.step_factor = 0.5
+luatexja.adjust.step_factor = 0.5
do
local insert = table.insert
local rangedimensions, max = node.direct.rangedimensions, math.max
if h>hmax then hmax=h end
if (bw-h-d)<lmin then lmin=bw-h-d end
end
- if lmin==1/0 then lmin = 0 end
+ if lmin==1/0 then lmin = bw end
return lmin,
bw - lmin - getfield(before, 'depth')
- getfield(after, mirrored and 'depth' or 'height')
end
do
+ local ltja = luatexja.adjust
local copy_glue = ltjl.copy_glue
local floor, max = math.floor, math.max
function ltjl.l_step(dist, g, adj, normal, bw)
if dist < tex.lineskiplimit then
- local f = max(1, bw*ltjl.step_factor)
+ local f = max(1, bw*ltja.step_factor)
copy_glue(g, tex.baselineskip, 1, normal - f * floor((dist-tex.lineskip.width)/f))
else
copy_glue(g, tex.baselineskip, 2, normal)