OSDN Git Service

Cherry-picked several commits from kitagawa_tfont branch
[luatex-ja/luatexja.git] / src / ltj-adjust.lua
index 5c0a781..729f186 100644 (file)
@@ -82,12 +82,14 @@ local function get_stretched(q, go, gs)
    local qs = getfield(q, 'spec')
    if not getfield(qs, 'writable') then return 0 end
    if gs == 1 then -- stretching
-      if getfield(qs, 'stretch_order') == go then 
-        return getfield(qs, 'stretch') 
+      if getfield(qs, 'stretch_order') == go then
+        return getfield(qs, 'stretch')
+      else return 0
       end
    else -- shrinking
       if getfield(qs, 'shrink_order') == go then 
         return getfield(qs, 'shrink')
+      else return 0
       end
    end
 end
@@ -172,8 +174,8 @@ end
 local function aw_step1(p, res, total)
    local head = getlist(p)
    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
-   -- 本当の行末の node を格納
    if getid(x) == id_glue and getsubtype(x) == 15 then 
       -- 段落最終行のときは,\penalty10000 \parfillskip が入るので,
       -- その前の node が本来の末尾文字となる
@@ -196,8 +198,8 @@ local function aw_step1(p, res, total)
      return false-- それ以外は対象外.
    end
    local xk = ltjf_font_metric_table[getfont(xc)]
-     xk = xk.char_type[has_attr(xc, attr_jchar_class) or 0]
-     xk = xk['end_' .. res.name] or 0
+   xk = xk.char_type[has_attr(xc, attr_jchar_class) or 0]
+   xk = xk['end_' .. res.name] or 0
 
    if xk>0 and total>=xk then
       total = total - xk