Np.first = Np.first or lp; Np.id = id_pbox
set_attr(lp, attr_icflag, get_attr_icflag(lp));
while lp ~=last and (lpa>=PACKED) and (lpa<BOXBDD) do
- if getid(lp)==id_hlist or getid(lp)==id_vlist then
+ local lpi = getid(lp)
+ if lpi==id_hlist or lpi==id_vlist then
head, lp, nc = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm pbox')
Np.first = first and nc or Np.first
+ elseif (lpi==id_rule) and (lpa==PACKED) then
+ lp = node_next(lp)
+ nc, lp = lp, node_next(lp)
else
nc, lp = lp, node_next(lp)
end
end
end
-
function define_jfm(t)
local real_char -- Does current character class have the 'real' character?
if t.dir~=jfm_dir then
if type(i) == 'number' then -- char_type
if not v.chars then
if i ~= 0 then defjfm_res= nil; return end
- real_char = true
else
- real_char = false
for j,w in pairs(v.chars) do
if type(w) == 'number' and w~=-1 then
- real_char = true;
elseif type(w) == 'string' and utf.len(w)==1 then
- real_char = true; w = utf.byte(w)
+ w = utf.byte(w)
elseif type(w) == 'string' and utf.len(w)==2 and utf.sub(w,2) == '*' then
- real_char = true; w = utf.byte(utf.sub(w,1,1))
+ w = utf.byte(utf.sub(w,1,1))
end
if not t.chars[w] then
t.chars[w] = i
defjfm_res= nil; return
end
end
- if type(v.align)~='string' then
- v.align = 'left' -- left
- end
- if real_char then
- if type(v.width)~='number' and v.width~='prop' then
- defjfm_res= nil; return
- else
- if v.width=='prop' and jfm_dir=='tate' then
- v.width = 1.0
- end
- if type(v.height)~='number' then
- v.height = 0.0
- end
- if type(v.depth)~='number' then
- v.depth = 0.0
- end
- if type(v.italic)~='number' then
- v.italic = 0.0
- end
- if type(v.left)~='number' then
- v.left = 0.0
- end
- if type(v.down)~='number' then
- v.down = 0.0
- end
- end
- end
v.chars = nil
end
+ if type(v.align)~='string' then
+ v.align = 'left' -- left
+ end
+ if type(v.width)~='number' then
+ v.width = (jfm_dir=='tate') and 1.0
+ end
+ if type(v.height)~='number' then
+ v.height = (jfm_dir=='tate') and 0.0
+ end
+ if type(v.depth)~='number' then
+ v.depth = (jfm_dir=='tate') and 0.0
+ end
+ if type(v.italic)~='number' then
+ v.italic = 0.0
+ end
+ if type(v.left)~='number' then
+ v.left = 0.0
+ end
+ if type(v.down)~='number' then
+ v.down = 0.0
+ end
v.kern = v.kern or {}; v.glue = v.glue or {}
for j,x in pairs(v.glue) do
if v.kern[j] then defjfm_res= nil; return end
-- 和文文字の位置補正(横)
local function capsule_glyph_yoko(p, met, char_data, head, dir)
if not char_data then return node_next(p), head, p end
- -- f*: whd specified in JFM
- local fwidth, pwidth = char_data.width, getfield(p, 'width')
- fwidth = (fwidth ~= 'prop') and fwidth or pwidth
fshift.down = char_data.down; fshift.left = char_data.left
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
- local fheight, fdepth = char_data.height, char_data.depth
local kbl = has_attr(p, attr_ykblshift) or 0
--
+ -- f*: whd specified in JFM
+ local fwidth, pwidth = char_data.width, getfield(p, 'width')
+ fwidth = fwidth or pwidth
+ local fheight, pheight = char_data.height, getfield(p, 'height')
+ fheight = fheight or pheight
+ local fdepth, pdepth = char_data.depth,getfield(p, 'depth')
+ fdepth = fdepth or pdepth
if pwidth==fwidth then
-- 補正後glyph node は ht: p.height - kbl - down, dp: p.depth + min(0, kbl+down) を持つ
-- 設定されるべき寸法: ht: fheight - kbl, dp: fdepth + kbl
- local ht_diff = fheight + fshift.down - getfield(p, 'height')
- local dp_diff = fdepth + kbl - getfield(p, 'depth') - min(kbl + fshift.down, 0)
+ local ht_diff = fheight + fshift.down - pheight
+ local dp_diff = fdepth + kbl - pdepth - min(kbl + fshift.down, 0)
if ht_diff == 0 and dp_diff ==0 then -- offset only
set_attr(p, attr_icflag, PROCESSED)
setfield(p, 'xoffset', getfield(p, 'xoffset') - fshift.left)
setfield(box, 'depth', fdepth + kbl)
setfield(box, 'dir', dir)
set_attr(box, attr_icflag, PACKED)
- set_attr(p, attr_icflag, PACKED)
+ --set_attr(p, attr_icflag, PACKED)
head = p and node_insert_before(head, p, box)
or node_insert_after(head, node_tail(head), box)
return node_next(p), head, p, box
pwidth = pwidth + (met.v_advance[pc] or 0)
ascent = met.v_origin[pc] and ascent - met.v_origin[pc] or ascent
end
- fwidth = (fwidth ~= 'prop') and fwidth or pwidth
+ fwidth = fwidth or pwidth
fshift.down = char_data.down; fshift.left = char_data.left
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
- local fheight, fdepth = char_data.height, char_data.depth
-
+ local fheight = char_data.height or 0
+ local fdepth = char_data.depth or 0
local y_shift
= getfield(p, 'xoffset') + (has_attr(p,attr_tkblshift) or 0)
local q