OSDN Git Service

lltjfont.sty: fix definition of \font{series,shape}force
[luatex-ja/luatexja.git] / src / ltj-jfmglue.lua
index d4d5e94..d3f9d99 100644 (file)
@@ -789,7 +789,7 @@ do
       local abs, log, log264, floor = math.abs, math.log, math.log(2)*64, math.floor
       blend_diffmet_inf = function (b, a, bo, ao, rb, ra)
          local nb, na = (bo and b*2.0^(64*bo) or 0), (ao and a*2.0^(64*ao) or 0)
-         local r = luatexja.jfmglue.diffmet_rule((1-rb)*b+rb*a, (1-ra)*b+ra*a)
+         local r = luatexja.jfmglue.diffmet_rule((1-rb)*nb+rb*na, (1-ra)*nb+ra*na)
          local ro = (r~=0) and floor(log(abs(r))/log264+0.0625) or 0
          return round(r/2.^(64*ro)), ro
       end
@@ -825,7 +825,7 @@ do
          if not gbst then gr = ga; node_free(gb) else node_free(ga) end
          gbw = blend_diffmet(gbw or 0, gaw or 0, db, da) -- 結果の自然長
          gbst, gbsto = blend_diffmet_inf(gbst, gast, gbsto, gasto, db, da) -- 伸び
-        gbsh, gbsho = blend_diffmet_inf(-(gbsh or 0), -(gash or 0), gbsto, gasto, db, da) -- -(縮み)
+         gbsh, gbsho = blend_diffmet_inf(-(gbsh or 0), -(gash or 0), gbsho, gasho, db, da) -- -(縮み)
         setglue(gr, gbw, gbst, -gbsh, gbsto, gbsho)
         return gr
       end
@@ -855,13 +855,14 @@ do
            set_attr(g, attr_icflag, KANJI_SKIP_JFM)
            return g
         elseif flag then
-           local g = node_new(id_glue);
+           local g = node_new(id_glue)
+            local st = bp and (bp*getfield(kanji_skip, 'stretch')) or 0
+            local sh = bh and (bh*getfield(kanji_skip, 'shrink')) or 0
            setglue(g,
               bn and (bn*getfield(kanji_skip, 'width')) or 0,
-              bp and (bp*getfield(kanji_skip, 'stretch')) or 0,
-              bh and (bh*getfield(kanji_skip, 'shrink')) or 0,
-              bp and bp~=0 and getfield(kanji_skip, 'stretch_order') or 0,
-              bh and bh~=0 and getfield(kanji_skip, 'shrink_order') or 0)
+              st, sh, 
+              (st==0) and 0 or getfield(kanji_skip, 'stretch_order'),
+              (sh==0) and 0 or getfield(kanji_skip, 'shrink_order'))
            set_attr(g, attr_icflag, KANJI_SKIP_JFM)
            return g
         end