OSDN Git Service

Merge branch 'kmaeda-manual' into kitagawa_test, and fix the ticket #28171.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Tue, 24 Apr 2012 21:08:43 +0000 (06:08 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Tue, 24 Apr 2012 21:08:43 +0000 (06:08 +0900)
1  2 
doc/luatexja-en.pdf
doc/luatexja-ja.pdf
doc/luatexja.dtx
src/ltj-jfmglue.lua
src/luatexja-core.sty
src/luatexja.lua
test/test04-jfm.pdf

index 7d59798,87357e3..ab26aa6
Binary files differ
index 842ada4,276cedf..04c944e
Binary files differ
@@@ -2874,7 -2883,7 +2883,7 @@@ the beginning of a box and `あ', and a
  \inhibitglue\par\noindent あ1
  \par\inhibitglue\noindent あ2
  \par\noindent\inhibitglue あ3
--\par\inhibitglue\hrule あoff\inhibitglue ice
++\par\hrule\noindent あoff\inhibitglue ice
  \end{LTXexample}
  
  %<*en>
@@@ -2886,24 -2895,24 +2895,24 @@@ With the help of this example, we remar
  \begin{itemize}
  %<*en>
  \item The call of \verb+\inhibitglue+ in the (internal) vertical mode is
--      effective at the beginning of the next paragraph. This is realized
--      by hacking \verb+\everypar+.
++      simply ignored.
  %</en>
  %<*ja>
--\item \verb+\inhibitglue+ の垂直モード中での呼び出しは次の段落の始めで効力を持つ.
--  これは \verb+\everypar+ のハックによって実現されている.
++\item \verb+\inhibitglue+ の垂直モード中での呼び出しは意味を持たない.
++4行目の入力で有効にならないのは,\verb+\inhibitglue+ の時点では垂直モードであり,
++\verb+\noindent+ の時点で水平モードになるからである.
  %</ja>
  
  %<*en>
  \item The call of \verb+\inhibitglue+ in the (restricted) horizontal
        mode is only effective on the spot; does not get over boundary of
        paragraphs. Moreover, \verb+\inhibitglue+ cancels ligatures and
--      kernings, as shown in line~4 of above example.
++      kernings, as shown in the last line of above example.
  %</en>
  %<*ja>
  \item \verb+\inhibitglue+ の(制限された)水平モード中での呼び出しはその場でのみ
    有効であり,段落の境界を乗り越えない.
--  さらに,\verb+\inhibitglue+ は上の例の4行目のようにリガチャとカーニングを
++  さらに,\verb+\inhibitglue+ は上の例の最終行のようにリガチャとカーニングを
    打ち消す.
  %</ja>
  
@@@ -3142,8 -3151,8 +3151,8 @@@ These 2 font features correspond to \te
  \verb+\jfont+ primitive, respectively. See Subsection~\ref{ssec-jfont}.
  %</en>
  %<*ja>
 -これらの2つはそれぞれ \verb+\jfont+ プリミティブに対する
 +これら2つのキーはそれぞれ \verb+\jfont+ プリミティブに対する
- \texttt{jfm}, \texttt{jfmvar} キーとそれぞれ対応する.
+ \texttt{jfm}, \texttt{jfmvar}キーとそれぞれ対応する.
  \ref{ssec-jfont} 節を参照.
  %</ja>
  
@@@ -3153,22 -3162,9 +3162,22 @@@ By specifying this font feature, you ca
  will not be embedded in the output PDF file. See Subsection~\ref{ssec-psft}.
  %</en>
  %<*ja>
- これを指定することで,PDF に埋め込まれない「名前だけ」のフォントを指定することが
+ これを指定することで,PDFに埋め込まれない「名前だけ」のフォントを指定することが
  できる.\ref{ssec-psft} 節を参照.
  %</ja>
 +
 +\item[CID=<name>]
 +%<*en>
 +This feature is effective only when with NoEmbed feature.
 +You can use the non-embedded CID-keyed font whose glyphs are addressed according
 +to the specified character collection defined by Adobe Inc.
 +The default value is Adobe-Japan1. See also Subsection~\ref{ssec-psft}.
 +%</en>
 +%<*ja>
 +NoEmbed キーと合わせて用いる.
 +非埋め込みの CID-keyed フォントがどの文字コレクションに基づくものかを指定する.
 +デフォルトは Adobe-Japan1 である.\ref{ssec-psft} 節も参照.
 +%</ja>
  \end{list}
  
  \subsection{\texttt{luatexja-otf.sty}}
@@@ -3466,13 -3462,13 +3475,13 @@@ $i$ã\81¯7ã\82\88ã\82\8aå°\8fã\81\95ã\81\84è\87ªç\84¶æ\95°ï¼
  
  %<*en>
  Furthermore, \LuaTeX-ja uses several `user-defined' whatsit nodes for
 -typesetting. All those nodes store a natural number (hence the node's
 -\texttt{type} is 100).
 +inrernal processing. All those nodes store a natural number (hence the node's
 +\texttt{type} is 100). The following \verb+user_id+s are used:
  %</en>
  %<*ja>
- さらに,\LuaTeX-ja はいくつかの「ユーザ定義の」whatsit ノードを内部処理に用いる.
- これらの全てのノードは自然数を格納している(したがってノードの \texttt{type} は
- 100 である).次の \verb+user_id+ が使用される:
 -さらに,\LuaTeX-jaはいくつかの「ユーザ定義の」whatsitノードを組版に用いる.
++さらに,\LuaTeX-jaはいくつかの「ユーザ定義の」whatsit ノードを内部処理に用いる.
+ これらの全てのノードは自然数を格納している(したがってノードの\texttt{type}は
 -100である).
++100である).次の \verb+user_id+ が使用される:
  %</ja>
  \begin{description}
  \item[30111]
@@@ -3499,24 -3495,17 +3508,24 @@@ Nodes for \LuaTeX-ja's stack system (se
  \item[30113]
  %<*en>
  Nodes for Japanese Characters which the callback process of
-          luaotfload won't be applied, and the character code is
+          \Pkg{luaotfload} won't be applied, and the character code is
           stored in the \texttt{value} field. Each node having this
           \verb+user_id+ is converted to a `glyph\_node' \emph{after}
-          the callback process of luaotfload. 
 -         the callback process of \Pkg{luaotfload}.
++         the callback process of luaotfload.
 +         This \verb+user_id+ is only used by the \Pkg{luatexja-otf} package.
  %</en>
  %<*ja>
- luaotfload のコールバックによる処理が適用されない和文文字のためのノードで,
- \texttt{value} フィールドにその文字のコードが格納されている.
- この \verb+user_id+ を持つノードはそれぞれが luaotfload のコールバックの処理の
- \textbf{後で} `glyph\_node' に変換される.この \verb+user_id+ は %
+ \Pkg{luaotfload}のコールバックによる処理が適用されない和文文字のためのノードで,
+ \texttt{value}フィールドにその文字のコードが格納されている.
+ この \verb+user_id+ を持つノードはそれぞれが\Pkg{luaotfload}のコールバックの処理の
 -\textbf{後で}`glyph\_node'に変換される.
++\textbf{後で}`glyph\_node'に変換される.この \verb+user_id+ は %
 +\Pkg{luatexja-otf} パッケージでのみ使用される.
  %</ja>
 +
 +\item[30114]
 +Nodes for indicating beginning of a paragraph. 
 +A paragraph which is started by \verb+\item+ in list-like environments has a horizontal box
 +for its label before the actual contents. So \dots
  \end{description}
  %<*en>
  These whatsits will be removed during the process of inserting \textbf{JAglue}s.
@@@ -3,8 -3,8 +3,8 @@@
  --
  luatexbase.provides_module({
    name = 'luatexja.jfmglue',
--  date = '2012/04/02',
--  version = '0.3',
++  date = '2012/04/25',
++  version = '0.4',
    description = 'Insertion process of JFM glues and kanjiskip',
  })
  module('luatexja.jfmglue', package.seeall)
@@@ -331,20 -331,20 +331,20 @@@ local calc_np_auxtable = 
               end,
     [id_whatsit] = function() 
                  if lp.subtype==sid_user then
--             if lp.user_id==30111 then
--                local lq = node_next(lp)
--                head = node_remove(head, lp); node_free(lp); lp = lq; ihb_flag = true
--             else
--                set_attr_icflag_processed(lp)
--                luatexbase.call_callback("luatexja.jfmglue.whatsit_getinfo"
--                                       , Np, lp, Nq, box_stack_level)
--                lp = node_next(lp)
--                if Np.nuc then 
--                   Np.id = id_pbox_w; Np.first = Np.nuc; Np.last = Np.nuc; return true
--                end
--             end
--          else
--            set_attr_icflag_processed(lp)
++                   if lp.user_id==30111 then
++                      local lq = node_next(lp)
++                      head = node_remove(head, lp); node_free(lp); lp = lq; ihb_flag = true
++                   else
++                      set_attr_icflag_processed(lp)
++                      luatexbase.call_callback("luatexja.jfmglue.whatsit_getinfo"
++                                               , Np, lp, Nq, box_stack_level)
++                      lp = node_next(lp)
++                      if Np.nuc then 
++                         Np.id = id_pbox_w; Np.first = Np.nuc; Np.last = Np.nuc; return true
++                      end
++                   end
++                else
++                   set_attr_icflag_processed(lp); lp = node_next(lp)
                  end
                  return false
                  end,
@@@ -821,11 -822,11 +821,21 @@@ local function handle_nq_ja_hlist(
     end
  end
  
++-- Nq が前側のクラスタとなることによる修正
++local function adjust_nq()
++   if Nq.id==id_glyph then after_alchar(Nq)
++   elseif Nq.id==id_hlist or Nq.id==id_pbox or Nq.id==id_disc then after_hlist(Nq)
++   elseif Nq.id == id_pbox_w then 
++      luatexbase.call_callback("luatexja.jfmglue.whatsit_after",
++                             false, Nq, Np, box_stack_level)
++   end
++end
++
  -------------------- 開始・終了時の処理
  
  -- リスト末尾の処理
  local function handle_list_tail()
--   Np = Nq
++   adjust_nq(); Np = Nq
     if mode then
        -- the current list is to be line-breaked:
        if Np.id == id_jglyph or (Np.id==id_pbox and Np.met) then 
            head = node_insert_after(head, Np.last, g)
         end
        end
--      head = node_remove(head, last); node_free(last);-- remove the sentinel
     end
--   node_free(kanji_skip); node_free(xkanji_skip)
  end
  
  -- リスト先頭の処理
@@@ -912,13 -913,13 +920,22 @@@ local function init_var(
     end
  end
  
---- Nq が前側のクラスタとなることによる修正
--local function adjust_nq()
--   if Nq.id==id_glyph then after_alchar(Nq)
--   elseif Nq.id==id_hlist or Nq.id==id_pbox or Nq.id==id_disc then after_hlist(Nq)
--   elseif Nq.id == id_pbox_w then 
--      luatexbase.call_callback("luatexja.jfmglue.whatsit_after",
--                             false, Nq, Np, box_stack_level)
++local function cleanup()
++   -- adjust attr_icflag for avoiding error
++   tex.attribute[attr_icflag] = -(0x7FFFFFFF)
++   node_free(kanji_skip); node_free(xkanji_skip)
++   if mode then
++      local h = node_next(head)
++      if h.id == id_penalty and h.penalty == 10000 then
++       h = h.next
++       if h.id == id_glue and h.subtype == 15 and not h.next then
++          return false
++       end
++      end
++      return head
++   else
++      head = node_remove(head, last); node_free(last);-- remove the sentinel
++      return head
     end
  end
  -------------------- 外部から呼ばれる関数
@@@ -930,8 -931,8 +947,7 @@@ function main(ahead, amode
     if Np then 
        extract_np(); handle_list_head()
     else
--      if not mode then head = node_remove(head, last); node_free(last) end
--      return head
++      return cleanup()
     end
     calc_np()
     while Np do
        calc_np()
     end
     handle_list_tail()
--   -- adjust attr_icflag
--   tex.attribute[attr_icflag] = -(0x7FFFFFFF)
--   return head
++   return cleanup()
  end
  
  -- \inhibitglue
    \directlua{luatexja.global_temp = tex.globaldefs; tex.globaldefs = 0}}
  \protected\def\ltj@restore@globaldefs{\directlua{tex.globaldefs = luatexja.global_temp}}
  \let\new@everypar=\everypar
--\protected\def\inhibitglue{\relax%
--  \ifvmode
--    \ltj@reset@globaldefs
-     \edef\ltj@@tmp{%
-       \everypar={\the\everypar}\the\everypar\noexpand\ltj@@ihb}%
-     \everypar\expandafter{\ltj@@tmp}%
 -    \xdef\@@tempa{\the\everypar}%
 -    \xdef\@@tempb{\everypar={\@@tempa}\@@tempa\noexpand\ltj@@ihb}%
 -    \everypar\expandafter{\@@tempb}%
--    \ltj@restore@globaldefs
--  \else\ifhmode\ltj@@ihb\fi\fi}
++\protected\def\inhibitglue{\ifhmode\ltj@@ihb\fi}
  \def\ltj@@ihb{\directlua{luatexja.jfmglue.create_inhibitglue_node()}}
  
  %%%%%%%% \yoko, \tate, \ifydir, \iftdir
@@@ -216,7 -216,7 +216,7 @@@ en
  local function main_process(head, mode, dir)
     local p = head
     p = ltjj.main(p,mode)
--   p = ltjw.set_ja_width(p, dir)
++   if p then p = ltjw.set_ja_width(p, dir) end
     return p
  end
  
index b336b6a,b336b6a..a4a6fa0
Binary files differ