X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-jfont.lua;h=3acba6d58bf9f4160854370d9e3b62cd51e4eb05;hb=c35bc9236b8c249d3089a824fe197d0d1cde7e78;hp=9b791a67df1240c43ebc30f3acba6bbe3837b357;hpb=f085560bb8c26829d23b3c20a3b628e8b0690c4b;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-jfont.lua b/src/ltj-jfont.lua index 9b791a6..3acba6d 100644 --- a/src/ltj-jfont.lua +++ b/src/ltj-jfont.lua @@ -25,7 +25,7 @@ local id_glue_spec = node.id('glue_spec') local id_glue = node.id('glue') local cat_lp = luatexbase.catcodetables['latex-package'] local ITALIC = 1 -local FROM_JFM = 4 +local FROM_JFM = 6 ------------------------------------------------------------------------ -- LOADING JFM ------------------------------------------------------------------------ @@ -61,7 +61,12 @@ function define_jfm(t) elseif type(w) == 'string' and utf.len(w)==1 then real_char = true; 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)) + real_char = true; w = utf.byte(utf.sub(w,1,1)) + if not t.chars[-w] then + t.chars[-w] = i + else + defjfm_res= nil; return + end end if not t.chars[w] then t.chars[w] = i @@ -69,6 +74,9 @@ function define_jfm(t) defjfm_res= nil; return end end + if type(v.align)~='string' then + v.align = 'left' -- left + end if real_char then if not (type(v.width)=='number' or v.width~='prop') then defjfm_res= nil; return @@ -88,9 +96,6 @@ function define_jfm(t) if type(v.down)~='number' then v.down = 0.0 end - if type(v.align)=='nil' then - v.align = 'left' - end end end v.chars = nil @@ -100,6 +105,13 @@ function define_jfm(t) for j in pairs(v.glue) do if v.kern[j] then defjfm_res= nil; return end end + for j,x in pairs(v.kern) do + if type(x)=='number' then + v.kern[j] = {x, 0} + elseif type(x)=='table' then + v.kern[j] = {x[1], x[2] or 0} + end + end t.char_type[i] = v t[i] = nil end @@ -134,10 +146,15 @@ local function update_jfm_cache(j,sz) for i,v in pairs(t.char_type) do if type(i) == 'number' then -- char_type for k,w in pairs(v.glue) do - local g, h = node.new(id_glue), node_new(id_glue_spec); v.glue[k] = g + local g, h = node.new(id_glue), node_new(id_glue_spec) + v.glue[k] = {g, (w[5] and w[5]/sz or 0)} h.width, h.stretch, h.shrink = w[1], w[2], w[3] h.stretch_order, h.shrink_order = 0, 0 - g.subtype = 0; g.spec = h; set_attr(g, attr_icflag, FROM_JFM); + g.subtype = 0; g.spec = h; set_attr(g, attr_icflag, FROM_JFM + + (w[4] and w[4]/sz or 0)); + end + for k,w in pairs(v.kern) do + w[2] = w[2]/sz end end end