OSDN Git Service

Updated the manual, and ad hoc fix of the stack system around \globaldefs
[luatex-ja/luatexja.git] / doc / man-en.tex
index 5f52ac3..ca90c91 100644 (file)
@@ -1,6 +1,7 @@
 %#!lualatex
 \documentclass[a4paper,titlepage]{article}
-\usepackage{booktabs,amsmath}
+\usepackage{amsmath,amssymb,xcolor,pict2e}
+\usepackage{booktabs,listings,lltjlisting,showexpl}
 \usepackage{luatexja}
 %\usepackage{luatexja-fontspec}
 \usepackage[margin=20mm]{geometry}
 \author{The Lua\TeX-ja project team}
 
 
-\makeatletter
+\lstset{
+  basicstyle=\ttfamily\small, pos=o, breaklines=true,
+  numbers=none, rframe={}
+}
+
 \catcode`\<=13
 \def<#1>{{\normalfont\itshape$\langle$#1$\rangle$}}
 \begin{document}
 \maketitle
-\part{User's manual}
+
+\tableofcontents
+\bigskip
 {\Large\bf This documentation is far from complete. It may have many
-grammatical errors.}
+grammatical (and contextual) errors.}
+
+\newpage
+\part{User's manual}
+\makeatletter\the\ltj@@stack,\the\ltj@@group@level,\the\currentgrouplevel.
 
 
 \section{Introduction}
@@ -64,7 +75,7 @@ The followings are major changes from p\TeX:
       completely, because of a specification of Lua\TeX.
 \item The insertion process of glues/kerns between two Japanese
       characters and between a Japanese character and other characters
-      (we refer these glue/kerns as \textbf{JAglue}) is rewritten from
+      (we refer these glues/kerns as \textbf{JAglue}) is rewritten from
       scratch.
 
 \begin{itemize}
@@ -101,6 +112,20 @@ In this document, the following terms and notations are used:
       Lua\TeX-ja.
 \end{itemize}
 
+\subsection{About the project}
+\paragraph{Project Wiki} \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}
+
+This project is hosted by SourceForge.JP.
+\paragraph{Members}
+
+%h7k
+%kmaeda
+%abenori
+%kuroky
+%munepi
+%thonda
+%zrbabbler
+
 \newpage
 \section{Getting Started}
 \subsection{Installation}
@@ -108,7 +133,7 @@ To install the Lua\TeX-ja\ package, you will need:
 \begin{itemize}
 \item Lua\TeX, version 0.65.0-beta or later.\\
 If you are using \TeX~Live\ 2011 or W32\TeX, you don't have to worry.
-\item The source archive or Lua\TeX-ja, of course{\tt:)}
+\item The source archive of Lua\TeX-ja, of course{\tt:)}
 \end{itemize}
 
 The installation methods are as follows:
@@ -126,13 +151,13 @@ or download the archive of HEAD in the master branch from
 \url{http://git.sourceforge.jp/view?p=luatex-ja/luatexja.git;a=snapshot;h=HEAD;sf=tgz}.
 \end{flushleft}
 \item Extract the archive. You will see {\tt src/} and several other sub-directories.
-\item Copy all the contents of {\tt src/} into your TEXMF trees.
+\item Copy all the contents of {\tt src/} into one of your \texttt{TEXMF} tree.
 \item If {\tt mktexlsr} is needed to update the filename database, make it so.
 \end{enumerate}
 
 \subsection{Cautions}
 \begin{itemize}
-\item The encording of your source file must be UTF-8. 
+\item The encoding of your source file must be UTF-8. 
 \item conflicts with unicode-math
 \end{itemize}
 
@@ -172,10 +197,9 @@ This does the minimal setting (like {\tt ptex.tex}) for typesetting Japanese doc
 \[
  0.25\,\hbox{\verb+\zw+}^{+1\,\text{pt}}_{-1\,\text{pt}} = \frac{27}{32}\,\mathrm{mm}^{+1\,\text{pt}}_{-1\,\text{pt}}.
 \]
-Here \verb+\zw+ is the virtual width of `current' Japanese font.
+Here \verb+\zw+ is a counterpart of \texttt{em} for Japanese fonts, that is, the length of `full-width' in the current Japanese font.
 \end{itemize}
 
-
 \subsection{Using in \LaTeX}
 \paragraph{\LaTeXe}
 Using in \LaTeXe\ is basically same. To set up the minimal environment
@@ -215,12 +239,36 @@ The better alternatives are:
 \paragraph{Remark: Japanese Characters in Math Mode}
 Since p\TeX\ supports Japanese characters in math mode, there are
 sources like the following:
-\begin{verbatim}
-$T_{高圧}$, $$ y=(x-1)^2+2\quad よって\quad y>0$$ 
-\end{verbatim}
-However, ...
 
-So in this chapter, we don't describe how to change Japanese fonts in
+\begin{LTXexample}
+$f_{高温}$~($f_{\text{high temperature}}$).
+\[ y=(x-1)^2+2\quad{}よって\quad y>0 \]
+$5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
+\end{LTXexample}
+
+We (the project members of Lua\TeX-ja) think that using
+Japanese characters in math mode are allowed if these are used as identifiers.
+In this point of view, 
+\begin{itemize}
+\item The lines 1~and~2 above are not correct, since `高温' in above is used as a textual label, and
+`よって' is used as a conjunction. 
+\item However, the line~3 is correct, since `素' is used as an identifier.
+\end{itemize}
+
+Hence, in our opinion, the above input should be corrected as:
+\begin{LTXexample}
+$f_{\text{高温}}$~%
+($f_{\text{high temperature}}$).
+\[ y=(x-1)^2+2\quad 
+  \mathrel{\text{よって}}\quad y>0 \]
+$5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
+\end{LTXexample}
+%BUG?: \{\}がなければ「素」がでない.上の段落の「よって」もでてない.
+
+
+どう繋ごうか?
+
+In this chapter, we don't describe how to change Japanese fonts in
 math mode. For the method, please see Part~\ref{part-ref}.
 
 
@@ -276,7 +324,7 @@ alphabetic fonts
 \end{center}
 
 Note that there is no command named \verb+\setmonojfont+, since it is
-popular for Japansese fonts that (nearly) all Japanese glyphs have the same width.
+popular for Japanese fonts that (nearly) all Japanese glyphs have the same width.
 
 
 \section{Changing Parameters}
@@ -298,18 +346,18 @@ $\uparrow$ TODO: CHANGE THIS!
 
 
 
-\subsection{\textsf{kanjiskip} and \textsf{xkanjiskip}}
+\subsection{\textsf{kanjiskip} and \textsf{xkanjiskip}}\label{subs-kskip}
 \textbf{JAglue} is divided into the following three categories:
 \begin{itemize}
-\item Glue/kerns specified in JFM. If \verb+\inhibitglue+ is issued,
+\item Glues/kerns specified in JFM. If \verb+\inhibitglue+ is issued,
       this glue will be not inserted.
 \item The default glue which inserted between two \textbf{JAchar}s ({\sf
       kanjiskip}).
 \item The default glue which inserted between a \textbf{JAchar} and an
       \textbf{ALchar} (\textsf{xkanjiskip}).
 \end{itemize}
-The value (a skip) of \textsf{kanjiskip} or \textsf{xkanjiskip} can be changed as the
-following.
+The value (a skip) of \textsf{kanjiskip} or \textsf{xkanjiskip} can be
+changed as the following.
 \begin{verbatim}
 \ltjsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt}, 
                  xkanjiskip={0.25\zw plus 1pt minus 1pt}}
@@ -330,17 +378,11 @@ boundary between \textbf{JAchar} and \textbf{ALchar}. For example,
 Lua\TeX-ja can control whether \textsf{xkanjiskip} can be inserted
 before/after a character, by using \textsf{jaxspmode} and
 \textsf{alxspmode} parameters. 
-
-For example, the following source
-\begin{verbatim}
-\ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}} 
-pあq い!う
-\end{verbatim}
-yields
-\begin{center}
+\begin{LTXexample}
 \ltjsetparameter{jaxspmode={`あ,preonly}, alxspmode={`\!,postonly}} 
 pあq い!う
-\end{center}
+\end{LTXexample}
+
 The second argument {\tt preonly} means `the insertion of
 \textsf{xkanjiskip} is allowed before this character, but not after'.
 the other possible values are {\tt postonly}, {\tt allow} and {\tt
@@ -353,7 +395,7 @@ parameters to {\tt false}, respectively.
 
 \subsection{Shifting Baseline}
 To make a match between a Japanese font and an alphabetic font, sometimes
-the shifting of baseline of one of the pair. In p\TeX, this is achived
+the shifting of baseline of one of the pair. In p\TeX, this is achieved
 by setting \verb+\ybaselineshift+ to a non-zero length (the
 baseline of alphabetic fonts is shifted below). However, for documents
 whose main language is not Japanese,it is good to shift the baseline of
@@ -363,40 +405,31 @@ of the baseline of alphabetic fonts (\textsf{yalbaselineshift}
 parameter) and that of Japanese fonts (\textsf{yjabaselineshift}
 parameter). 
 
-For example, the following 
-\begin{verbatim}
-\vrule width 150pt height 0.4pt depth 0.4pt\hskip-120pt
-\ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう.
-\ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
-\end{verbatim}
-yields
-\begin{center}
-\vrule width 150pt height 0.4pt depth 0.4pt\hskip-120pt
-\ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう.
+\begin{LTXexample}
+\vrule width 150pt height 0.4pt depth 0pt\hskip-120pt
+\ltjsetparameter{yjabaselineshift=0pt, yalbaselineshift=0pt}abcあいう
 \ltjsetparameter{yjabaselineshift=5pt, yalbaselineshift=2pt}abcあいう
-\end{center}
+\end{LTXexample}
+
 Here the horizontal line in above is the baseline of a line.
 
 There is an interesting side-effect from that the baseline of
 Japanese fonts can be shifted: characters in different size can be
 vertically aligned center in a line, by setting two parameters appropriately.
-For example, 
-\begin{verbatim}
+
+\begin{LTXexample}
 xyz漢字 
-{\scriptsize\ltjsetparameter{yjabaselineshift-1pt, yalbaselineshift=-1pt}
-XYZひらがな}abcかな
-\end{verbatim}
-yields
-\begin{center}
-xyz漢字
-{\scriptsize\ltjsetparameter{yjabaselineshift=-1pt, yalbaselineshift=-1pt}
-XYZひらがな}abcかな
-\end{center}
+{\scriptsize
+  \ltjsetparameter{yjabaselineshift=-1pt, 
+    yalbaselineshift=-1pt}
+  XYZひらがな
+}abcかな
+\end{LTXexample}
 
 
 \subsection{`tombow'}
-`tombow' is a mark for indicating 4~corners and horizontal/vartical
-center of the paper. p\LaTeX and this Lua\TeX-ja suport `tombow' by
+`tombow' is a mark for indicating 4~corners and horizontal/vertical
+center of the paper. p\LaTeX and this Lua\TeX-ja support `tombow' by
 their kernel. The following steps are needed to typeset tombow:
 
 \begin{enumerate}
@@ -421,7 +454,200 @@ For example, the following sets banner as `{\tt filename (2012-01-01 17:01)}':
 
 \part{Reference}\label{part-ref}
 \section{Font Metric and Japanese Font}
+\subsection{\texttt{\char92jfont} primitive}
+To load a font as a Japanese font, you must use the
+\verb+\jfont+ primitive instead of~\verb+\font+, while
+\verb+\jfont+ admits the same syntax used in~\verb+\font+. 
+Lua\TeX-ja automatically loads \texttt{luaotfload} package,
+so TrueType/OpenType fonts with features can be used for Japanese fonts:
+\begin{LTXexample}
+\jfont\tradgt={file:ipaexg.ttf:script=latn;%
+  +trad;jfm=ujis} at 14pt
+\tradgt{}当/体/医/区
+\end{LTXexample}
+
+Note that the defined control sequence (\verb+\tradgt+ in the example above) using \verb+\jfont+ is not a \textit{font\_def} token.
+
+\paragraph{Prefix}
+Besides \texttt{file:} and \texttt{name:} prefixes, \texttt{psft:} can
+be used a prefix in \verb+\jfont+ (and~\verb+\font+) primitive..  Using
+this prefix, you can specify a font that has its name only and is not
+related to any real font.
+
+The typical use of this \texttt{psft:} prefix is ...
+
+\paragraph{Features}
+
+
+
+
+\subsection{Structure of JFM file}
+A JFM file is a Lua script which has only one function call:
+\begin{verbatim}
+luatexja.jfont.define_jfm { ... }
+\end{verbatim}
+Real data are stored in the table which indicated above by
+\verb+{ ... }+.  So, the rest of subsection are devoted to describe the
+structure of this table.  Note that all lengths in a JFM file are
+floating-point numbers in design-size unit.
+
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
+\item[dir=<direction>] (required)
+
+The direction of JFM. At the present, only \texttt{'yoko'} is supported.
+
+\item[zw=<length>] (required)
+
+The amount of the length of the `full-width.
+
+\item[zh=<length>] (required)
+
+\item[kanjiskip=\{<natural>, <stretch>, <shrink>\}] (optional)
+
+This field specifies the `ideal' amount of \textsf{kanjiskip}. As noted
+            in Subsection~\ref{subs-kskip}, if \textsf{kanjiskip} is
+            \verb+\maxdimen+, the value specified in this field is used
+            (if this field is not specified in JFM, 0\,pt is
+            used). Note that <stretch> and <shrink> fields are in
+            design-size unit too.
+
+
+\item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}] (optional)
+
+Like the \texttt{kanjiskip} field, this field specifies the `ideal'
+            amount of \textsf{xkanjiskip}.
+
+\end{list}
+
+Besides from above fields, a JFM file have several sub-tables those
+indices are natural numbers.  The table indexed by~$i\in\omega$ stores
+informations of `character class'~$i$. At least, the character class~0 is
+always present, so each JFM file must have a sub-table whose index is
+\texttt{[0]}.  Each sub-table (its numerical index is denoted by $i$) has
+the following fields:
+
+\begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
+\item[chars=\{<character>, ...\}] (required except character class~0)
+
+This field is a list of \textbf{JAchar}s which are in this character
+            type~$i$. This field is not required if $i=0$, since all
+            \textbf{JAchar} which are not in any character class other
+            than 0 (hence, the character class~0 contains most of
+            \textbf{JAchar}s). In the list, a \textbf{JAchar} can be
+            specified by its code number, or by the character itself
+            (as a string of length~1).
+
+In addition to those `real' characters, the following `imaginary
+            characters' can be specified in the list:
+
+\item[width=<length>, height=<length>, depth=<length>, italic=<length>]\ 
+
+Specify width of characters in character class~$i$, height, depth and
+the amount of italic correction.  These fields are required.
+
+
+\item[left=<length>, down=<length>, align=<align>]\ 
+
+These are for adjusting the position of the `real' glyph. Legal
+            values of \texttt{align} field are \texttt{'left'},
+            \texttt{'middle'} and \texttt{'right'}. If one of these
+            3~fields are omitted, \texttt{left} and \texttt{down} are
+            treated as~0, and \texttt{align} field is treated as
+            \texttt{'left'}.
+The effects of these 3~fields are indicated in Figure~\ref{fig-pos}.
+
+In most cases, \texttt{left} and \texttt{down} fields are~0, while
+it is not uncommon that the \texttt{align} field is \texttt{'middle'} or \texttt{'right'}.
+For example, setting the \texttt{align} field to \texttt{'right'} is practically needed 
+when the current character class is the class for opening delimiters'. 
+\begin{figure}[tb]
+\begin{minipage}{0.4\textwidth}%
+\begin{center}\unitlength=10pt\small
+\begin{picture}(15,12)(-1,-4)
+\color{black!10!white}% real glyph :step1
+\put(0,0){\vrule width 12\unitlength height 8\unitlength depth 3\unitlength}
+
+\color{red!20!white}% real glyph :step1
+\put(-1,-1.5){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
+
+\color{red}% real glyph
+\thicklines
+\put(-1,-1.5){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
+\put(5,-1.5){\line(0,1){7}\line(0,-1){2.5}}
+\put(-1,5.5){\line(1,0){6}}
+\put(-1,-4){\line(1,0){6}}
+
+\color{green!20!white}% real glyph :step1
+\put(3,0){\vrule width 6\unitlength height 7\unitlength depth 2.5\unitlength}
+
+\color{black}% real glyph :step1
+\thicklines
+\put(0,0){\vector(0,1){8}\line(0,-1){3}\vector(1,0){12}}
+\put(12,0){\line(0,1){8}\vector(0,-1){3}}
+\put(0,8){\line(1,0){12}}
+\put(0,-3){\line(1,0){12}}
+\put(0.2,4){\makebox(0,0)[l]{\texttt{height}}}
+\put(12.2,-1.5){\makebox(0,0)[l]{\texttt{depth}}}
+\put(6,0.2){\makebox(0,0)[b]{\texttt{width}}}
+
+\color{green!50!black}% real glyph :step1
+\thicklines
+\put(3,0){\vector(0,1){7}\vector(0,-1){2.5}\vector(1,0){6}}
+\put(9,0){\line(0,1){7}\line(0,-1){2.5}}
+\put(3,7){\line(1,0){6}}
+\put(3,-2.5){\line(1,0){6}}
+\newsavebox{\eqdist}
+\savebox{\eqdist}(0,0)[b]{%
+  \thinlines
+  \put(-0.08,0.2){\line(0,-1){0.4}}%
+  \put(0.08,0.2){\line(0,-1){0.4}}}
+\put(1.5,0){\usebox{\eqdist}}
+\put(10.5,0){\usebox{\eqdist}}
+
+\color{blue}% shifted
+\thicklines
+\put(3,-1.5){\vector(-1,0){4}}
+\put(1,-1.7){\makebox(0,0)[t]{\texttt{left}}}
+\put(3,0){\vector(0,-1){1.5}}
+\put(3.2,-0.75){\makebox(0,0)[l]{\texttt{down}}}
+\end{picture} 
+\end{center}
+\end{minipage}%
+\begin{minipage}{0.6\textwidth}%
+Consider a node containing Japanese character whose value of the \texttt{align} 
+field is \texttt{'middle'}.
+\begin{itemize}
+\item The black rectangle is a frame of the node.
+Its width, height and depth are specified by JFM.
+\item Since the \texttt{align} field is \texttt{'middle'}, 
+the `real' glyph is centered horizontally (the green rectangle).
+\item Furthermore, the glyph is shifted according to values of fields
+      \texttt{left} and \texttt{down}. The ultimate position of the real
+      glyph is indicated by the red rectangle.
+\end{itemize}
+\end{minipage}
+\caption{The position of the `real' glyph}
+\label{fig-pos}
+\end{figure}
+
+
+\item[kern=\{\}]
+\item[glue=\{\}]
+\end{list}
+
+\subsection{Math Font Family}
+
 \section{Parameters}
+\subsection{{\tt\char92 ltjsetparameter} primitive}
+
+\subsection{List of Parameters}
+In the following list of parameters, 
+\begin{itemize}
+\item `\ast' : local
+\item `\dagger' always global
+\item No mark: the last of paragraph
+\end{itemize}
+
 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
 \item[\textsf{kcatcode}\,=\{<chr\_code>,<value>\}]
 \item[\textsf{prebreakpenalty}\,=\{<chr\_code>,<penalty>\}]
@@ -429,19 +655,101 @@ For example, the following sets banner as `{\tt filename (2012-01-01 17:01)}':
 \item[\textsf{jatextfont}\,=\{<jfam>,<jfont\_cs>\}]
 \item[\textsf{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}]
 \item[\textsf{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}]
-\item[\textsf{yjabaselineshift}\,=<dimen>]
-\item[\textsf{yalbaselineshift}\,=<dimen>]
+\item[\textsf{yjabaselineshift}\,=<dimen>$^\ast$]
+\item[\textsf{yalbaselineshift}\,=<dimen>$^\ast$]
 \item[\textsf{jaxspmode}\,=\{<chr\_code>,<mode>\}]
 \item[\textsf{alxspmode}\,=\{<chr\_code>,<mode>\}]
-\item[\textsf{autospacing}\,=<bool>]
-\item[\textsf{autoxspacing}\,=<bool>]
+\item[\textsf{autospacing}\,=<bool>$^\ast$]
+\item[\textsf{autoxspacing}\,=<bool>$^\ast$]
 \item[\textsf{kanjiskip}\,=<skip>]
 \item[\textsf{xkanjiskip}\,=<skip>]
 \item[\textsf{jcharwidowpenalty}\,=<penalty>]
-\item[\textsf{differentjfm}\,=<mode>]
-\item[\textsf{jacharrange}\,=<ranges>]
+\item[\textsf{differentjfm}\,=<mode>$^\dagger$]
+\item[\textsf{jacharrange}\,=<ranges>$^\ast$]
 \end{list}
 \section{Other Primitives}
 \section{Control Sequences for \LaTeXe}
 \part{Implementations}\label{part-imp}
+\section{Storing Parameters}
+\subsection{Used Dimensions and Attributes}
+Here the following is the list of dimension and attributes which are used in Lua\TeX-ja.
+\begin{list}{}{%
+\def\makelabel{\ttfamily}
+\def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
+\def\attr#1{\item[\char92 #1\ \textrm{(attribute)}]}
+}
+
+\dim{jQ}
+\dim{jH}
+\dim{ltj@zw}
+\dim{ltj@zh}
+\attr{jfam} 
+\attr{ltj@curjfnt} The font index of current Japanese font.
+\attr{ltj@charclass} The character class of Japanese \textit{glyph\_node}.
+\attr{ltj@yablshift} The amount of shifting the baseline of alphabetic
+                       fonts in scaled point ($2^{-16}\,\textrm{pt}$).
+\attr{ltj@ykblshift} The amount of shifting the baseline of Japanese
+                       fonts in scaled point ($2^{-16}\,\textrm{pt}$).
+\attr{ltj@autospc} Whether the auto insertion of \textsf{kanjiskip} is allowed at the node.
+\attr{ltj@autoxspc} Whether the auto insertion of \textsf{xkanjiskip} is allowed at the node.
+\attr{ltj@icflag} For distinguishing `kinds' of the node. To this
+                       attribute, one of the following value is
+                       assigned:
+\begin{description}
+\item[ITALIC (1)]
+\item[PACKED (2)]
+\item[KINSOKU (3)]
+\item[FROM\_JFM (4)]
+\item[LINE\_END (5)]
+\item[KANJI\_SKIP (6)]
+\item[XKANJI\_SKIP (7)]
+\item[PROCESSED (8)]
+\item[IC\_PROCESSED (9)]
+\item[BOXBDD (15)]
+\end{description}
+\attr{ltj@kcat$i$} Where $i$~is a natural number which is less than~8.
+These 8~attributes store bit~vectors indicating ...
+\end{list}
+
+\subsection{Stack System of Lua\TeX-ja}
+\paragraph{Overview}
+Lua\TeX-ja has its own stack system, and most parameters of Lua\TeX-ja
+are stored in it.  To clarify the reason, imagine the parameter
+\textsf{kanjiskip} is stored by a skip, and consider the following
+source:
+\begin{LTXexample}
+\ltjsetparameter{kanjiskip=0pt}ふがふが.%
+\setbox0=\hbox{\ltjsetparameter{kanjiskip=5pt}ほげほげ}
+\box0.ぴよぴよ\par
+\end{LTXexample}
+
+As described in Part~\ref{part-ref}, the only effective value of
+\textsf{kanjiskip} in an hbox is the latest value, so the value of
+\textsf{kanjiskip} which applied in the entire hbox should be 5\,pt.
+However, by the implementation method of Lua\TeX, this `5\,pt' cannot be
+known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
+file in the source of Lua\TeX), there are the following codes:
+\begin{lstlisting}
+void package(int c)
+{
+    scaled h;                   /* height of box */
+    halfword p;                 /* first node in a box */
+    scaled d;                   /* max depth */
+    int grp;
+    grp = cur_group;
+    d = box_max_depth;
+    unsave();
+    save_ptr -= 4;
+    if (cur_list.mode_field == -hmode) {
+        cur_box = filtered_hpack(cur_list.head_field,
+                                 cur_list.tail_field, saved_value(1),
+                                 saved_level(1), grp, saved_level(2));
+        subtype(cur_box) = HLIST_SUBTYPE_HBOX;
+\end{lstlisting}
+Notice that \verb+unsave+ is executed \emph{before}
+\verb+filtered_hpack+ (this is where \verb+hpack_filter+ callback is
+executed): so `5\,pt' in the above source is orphaned at
+\texttt+unsave+, and hence it can't be accessed from \verb+hpack_filter+
+callback.
+
 \end{document}
\ No newline at end of file