X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=src%2Fltj-setwidth.lua;h=ebd7393b55b1affce9b1989c60c206d15cfcd09d;hb=a693b63eadfcabe5f4f513a4cc90302f2360b18b;hp=7e264adc7086d17028cac0c9b36602538c178559;hpb=8a1e0ce3e39f07de447d73c4ae6b312f8b13ccf3;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-setwidth.lua b/src/ltj-setwidth.lua index 7e264ad..ebd7393 100644 --- a/src/ltj-setwidth.lua +++ b/src/ltj-setwidth.lua @@ -6,7 +6,6 @@ luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('jfont'); local ltjf = luatexja.jfont local Dnode = node.direct or node - local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end @@ -17,7 +16,7 @@ local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n. local node_traverse = Dnode.traverse local node_new = Dnode.new -local node_remove = Dnode.remove +local node_remove = luatexja.Dnode_remove -- Dnode.remove local node_tail = Dnode.tail local node_next = Dnode.getnext local has_attr = Dnode.has_attribute @@ -77,16 +76,13 @@ local function capsule_glyph(p, met, class) fshift = call_callback("luatexja.set_width", fshift, met, class) local fheight, fdepth = char_data.height, char_data.depth if (pwidth ~= fwidth or getfield(p, 'height') ~= fheight or getfield(p, 'depth') ~= fdepth) then - local y_shift, ca - = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0), char_data.align + local y_shift + = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0) local q head, q = node_remove(head, p) setfield(p, 'yoffset', -fshift.down); setfield(p, 'next', nil) - ca = (ca~='left') - and -fshift.left + (((ca=='right') and fwidth-pwidth) or round((fwidth-pwidth)*0.5)) - or -fshift.left - setfield(p, 'xoffset', getfield(p, 'xoffset') + ca) - local box = node_new(id_hlist); + setfield(p, 'xoffset', getfield(p, 'xoffset') + char_data.align*(fwidth-pwidth)) + local box = node_new(id_hlist) setfield(box, 'width', fwidth) setfield(box, 'height', fheight) setfield(box, 'depth', fdepth)