--
luatexbase.provides_module({
name = 'luatexja.adjust',
- date = '2014/05/08',
+ date = '2014/09/30',
description = 'Advanced line adjustment for LuaTeX-ja',
})
module('luatexja.adjust', package.seeall)
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
- if getid(x) == id_glue and getsubtype(x) == 15 then
+ local xi, xc = getid(x)
+ if xi == id_glue and getsubtype(x) == 15 then
-- 段落最終行のときは,\penalty10000 \parfillskip が入るので,
-- その前の node が本来の末尾文字となる
- x = node_prev(node_prev(x))
+ x = node_prev(node_prev(x)); xi = getid(x)
end
-- local xi = getid(x)
-- while (get_attr_icflag(x) == PACKED)
-- and ((xi == id_penalty) or (xi == id_kern) or (xi == id_kern)) do
-- x = node_prev(x); xi = getid(x)
-- end
- local xi, xc = getid(x)
if xi == id_glyph and has_attr(x, attr_curjfnt) == getfont(x) then
-- 和文文字
xc = x
elseif xi == id_hlist and get_attr_icflag(x) == PACKED then
-- packed JAchar
xc = ltjd_glyph_from_packed(x)
- while getid(xc) == id_whatsit do xc = node_next(xc) end
+ while getid(xc) == id_whatsit do xc = node_next(xc) end -- これはなんのために?
else
return false-- それ以外は対象外.
end
local xk = ltjf_font_metric_table[getfont(xc)]
- .char_type[has_attr(xc, attr_jchar_class) or 0]['end_' .. res.name] or 0
+ .char_type[has_attr(xc, attr_jchar_class) or 0]['end_' .. res.name] or 0
if xk>0 and total>=xk then
total = total - xk
local ltjw_apply_ashift_math = ltjw.apply_ashift_math
local function calc_np_aux_glyph_common(lp)
Np.nuc = lp
- local npi = (getfont(lp) == (has_attr(lp, attr_curjfnt) or -1))
- and id_jglyph or id_glyph
- Np.id = npi
- if npi==id_jglyph then
- set_np_xspc_jachar(Np, lp)
- lp, head, npi = capsule_glyph(lp, Np.met, Np.class, head, tex_dir)
- Np.first = (Np.first~=Np.nuc) and Np.first or npi
- Np.nuc = npi
- else
- set_np_xspc_alchar(Np, getchar(lp), lp, 1)
- set_attr(lp, attr_icflag, PROCESSED)
- setfield(lp, 'yoffset',
- getfield(lp, 'yoffset') - (has_attr(lp,attr_ablshift) or 0))
- lp = node_next(lp)
- end
- return true, check_next_ickern(lp);
+ Np.id = npi
+ if (getfont(lp) == (has_attr(lp, attr_curjfnt) or -1)) then
+ Np.id = id_jglyph
+ set_np_xspc_jachar(Np, lp)
+ local npi
+ lp, head, npi = capsule_glyph(lp, Np.met, Np.class, head, tex_dir)
+ Np.first = (Np.first~=Np.nuc) and Np.first or npi
+ Np.nuc = npi
+ else
+ Np.id = id_glyph
+ set_np_xspc_alchar(Np, getchar(lp), lp, 1)
+ set_attr(lp, attr_icflag, PROCESSED)
+ setfield(lp, 'yoffset',
+ getfield(lp, 'yoffset') - (has_attr(lp,attr_ablshift) or 0))
+ lp = node_next(lp)
+ end
+ return true, check_next_ickern(lp);
end
local calc_np_auxtable = {
[id_glyph] = function (lp)
head, lp, op, flag = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm hlist')
set_attr(op, attr_icflag, PROCESSED)
Np.first = Np.first or op; Np.last = op; Np.nuc = op;
- local npi = (flag or getfield(op, 'shift')~=0) and id_box_like or id_hlist
- Np.id = npi
- if npi==id_hlist then
- Np.last_char = check_box_high(Np, getlist(lp), nil)
+ if (flag or getfield(op, 'shift')~=0) then
+ Np.id = id_box_like
+ else
+ Np.id = id_hlist
+ Np.last_char = check_box_high(Np, getlist(op), nil)
end
return true, lp
end,