OSDN Git Service

Update the manual, and fix placement of \dtou box in \yoko dir.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 18 May 2014 03:51:42 +0000 (12:51 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 18 May 2014 03:51:42 +0000 (12:51 +0900)
doc/luatexja.dtx
src/ltj-direction.lua
src/ltj-jfmglue.lua
test/test51-vtest.pdf
test/test51-vtest.tex

index ed343fe..6d3a676 100644 (file)
@@ -48,6 +48,7 @@
 
 \usepackage{amsmath,array,tikz,pict2e,multienum,float}
 \usepackage{booktabs,multicol,luatexja-ruby}
+\usepackage{xy}
 
 %%%%%%%% listings
 
@@ -390,12 +391,10 @@ The followings are major changes from \pTeX:
 但し,制御綴中に使える和文文字が\pTeX・\upTeX と全く同じではないことに注意すること.
 %</ja>
 
-%<*en>
-\item At the present, vertical typesetting (\emph{tategaki}), is not
-      supported in \LuaTeX-ja.
-%</en>
 %<*ja>
-\item 現時点では,縦書きは\LuaTeX-jaではサポートされていない.
+\item ****版からは,不安定ながらも\LuaTeX-ja における縦組みをサポートしている.
+\LuaTeX のコールバックの制限などにより,特に異なった組方向のボックスを扱う場合には
+仕様が異なるので注意すること.
 %</ja>
 \end{itemize}
 
@@ -533,6 +532,7 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}.
 \item \Pkg{luatexbase} v0.6
 \item \Pkg{xunicode} v0.981~(2011/09/09)
 \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files)
+\item \Pkg{everysel}
 \end{itemize}
 
 %<*en>
@@ -570,7 +570,7 @@ $ tlmgr install luatexja
   \item W32\TeX\ (\texttt{luatexja.tar.xz})
   \end{itemize}
 
-例えば\TeX~Live~2013を利用しているなら,\LuaTeX-jaは\TeX~Live manager (\texttt{tlmgr})を
+例えば\TeX~Live~2013以降を利用しているなら,\LuaTeX-jaは\TeX~Live manager (\texttt{tlmgr})を
 使ってインストールすることができる.
 \begin{verbatim}
 $ tlmgr install luatexja
@@ -703,7 +703,7 @@ IPA mj明朝などの大きいフォントを用いた場合には\LuaTeX より
 %<*en>
 \textbf{Note for MiK\TeX\ users}\quad
 \LuaTeX-ja requires that several CMap files%
-\footnote{\texttt{UniJIS2004-UTF32-H} and \texttt{Adobe-Japan1-UCS2}.}
+\footnote{\texttt{UniJIS2004-UTF32-\{H,V\}} and \texttt{Adobe-Japan1-UCS2}.}
 must be found from \LuaTeX.
 Strictly speaking, those CMaps are needed 
 only in the first run of \LuaTeX-ja after installing or updating.
@@ -712,7 +712,7 @@ so you will encounter an error like the following:
 %</en>
 %<*ja>
 \LuaTeX-jaが動作するためには,\emph{導入・更新後の初回起動時に}
-\texttt{UniJIS2004-UTF32-H}, \texttt{Adobe-Japan1-UCS2}という2つのCMapが
+\texttt{UniJIS2004-UTF32-\{H,V\}}, \texttt{Adobe-Japan1-UCS2}という3つのCMapが
 \LuaTeX によって見つけられることが必要である.
 しかしMiK\TeX ではそのようになっていないので,次のエラーが発生するだろう:
 %</ja>
@@ -751,25 +751,36 @@ run \LuaTeX-ja in this directory, and finally delete the temporaly directory.
 
 \begin{itemize}
 %<*en>
-\item The following 6~Japanese fonts are preloaded:
+\item The following 12~Japanese fonts are preloaded:
 \begin{center}\small
-\begin{tabular}{ccccc}
+\begin{tabular}{cccccc}
 \toprule
+\textbf{direction}&
 \textbf{classification}&\textbf{font name}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
+\smash{\raisebox{-1ex}{\emph{yoko} (horizontal)}}&
 \emph{mincho}&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
 \emph{gothic}&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
+\midrule
+\smash{\raisebox{-1ex}{\emph{tate} (vertical)}}&
+\emph{mincho}&Ryumin-Light    &\verb+\tentmin+&\verb+\seventmin+&\verb+\fivetmin+\\
+\emph{gothic}&GothicBBB-Medium&\verb+\tentgt+ &\verb+\seventgt+ &\verb+\fivetgt+\\
 \bottomrule
 \end{tabular}
 \end{center}
 %</en>
 %<*ja>
-\item 以下の6つの和文フォントが定義される:
+\item 以下の12個の和文フォントが定義される:
 \begin{center}\small
-\begin{tabular}{ccccc}
+\begin{tabular}{cccccc}
 \toprule
-\emph{字体}&\emph{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
+\emph{組方向}&\emph{字体}&\emph{フォント名}&\bf `10\,pt'&\bf`7\,pt'&\bf`5\,pt'\\\midrule
+\smash{\raisebox{-1ex}{横組}}&
 明朝体&Ryumin-Light    &\verb+\tenmin+&\verb+\sevenmin+&\verb+\fivemin+\\
 ゴシック体&GothicBBB-Medium&\verb+\tengt+ &\verb+\sevengt+ &\verb+\fivegt+\\
+\midrule
+\smash{\raisebox{-1ex}{縦組}}&
+明朝体&Ryumin-Light    &\verb+\tentmin+&\verb+\seventmin+&\verb+\fivetmin+\\
+ゴシック体&GothicBBB-Medium&\verb+\tentgt+ &\verb+\seventgt+ &\verb+\fivetgt+\\
 \bottomrule
 \end{tabular}
 \end{center}
@@ -846,13 +857,12 @@ plfonts.dtx} and \texttt{pldefs.ltx}):
 
 \begin{itemize}
 %<*en>
-\item \texttt{JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
-When vertical typesetting is supported by \LuaTeX-ja in the future, \texttt{JT3} will be used for vertical fonts.
+\item The font encoding for Japanese fonts (in horizontal direction) is \texttt{JY3}.\\
+\texttt{JT3} is used for Japanese fonts in vertical diraction.
 %</en>
 %<*ja>
-\item \texttt{JY3}は和文フォント用のフォントエンコーディングである(横書き用).\\
-将来的に,\LuaTeX-jaで縦書きがサポートされる際には,\texttt{JT3}を縦書き用として
-用いる予定である.
+\item 和文フォントのエンコーディングとしては,横組用には \texttt{JY3},縦組用には\ 
+\texttt{JT3}が用いられる.
 %</ja>
 
 %<*en>
@@ -943,10 +953,11 @@ Okumura), namely, \Pkg{ltjclasses} and \Pkg{ltjsclasses}.
 \paragraph{plain \TeX}
 %<*en>
 To change Japanese fonts in plain \TeX, you must use the command
-\verb+\jfont+. So please see Subsection~\ref{ssec-jfont}.
+\verb+\jfont+~and~\verb+\tfont+. So please see Subsection~\ref{ssec-jfont}.
 %</en>
 %<*ja>
-plain \TeX で和文フォントを変更するためには,\pTeX のように \verb+\jfont+ 命令を直接用いる.
+plain \TeX で和文フォントを変更するためには,
+\pTeX のように \verb+\jfont+ 命令や \verb+\tfont+ 命令を直接用いる.
 \ref{ssec-jfont}節を参照.
 %</ja>
 
@@ -2443,6 +2454,363 @@ JIS~X~0213の範囲に広げると,差異はさらに大きくなる.
 %</ja>
 
 
+
+
+%<*ja>
+\section{縦組}
+\label{sec-direction}
+\LuaTeX 本体でも,$\Omega$・$\aleph$由来の機能として,複数の組方向をサポートしている.
+しかし,\LuaTeX がサポートするのは \texttt{TLT},~\texttt{TRT}, \texttt{RTT},~\texttt{LTL}\ 
+のみであり,日本語の縦書きに使うのは望ましくない\footnote{%
+和文文字だけならば \texttt{RTT} を使えばなんとかなると思うが,
+欧文文字が入ってきた場合はうまくいかず,\texttt{RTR} という組方向が必要になる.
+}.そのため,\LuaTeX-jaでは横組(\texttt{TLT})で組んだボックスを回転させる方式で
+縦組を実装した.
+
+\subsection{サポートする組方向}
+\begin{table}[t]
+\caption{\LuaTeX-ja のサポートする組方向}
+%<en>\medskip
+\label{tab-dir}
+\centering\small
+\def\obox#1{%
+  \setbox0=\hbox{\yoko\hbox{#1%
+  \large\ltjsetparameter{talbaselineshift=0pt}%
+  \vrule height 25pt width 0.4pt depth 15pt\kern-.2pt%
+  \raise25pt\hbox to 0pt{\hss\composite{*r^@{>>}}\hss}%
+  \raise-15pt\hbox to 0pt{\hss\composite{*l^@{>|}}\hss}\kern.2pt%
+  \vrule height.2pt depth.2pt width 60pt\hbox to 0pt{\hss\composite{*d^@{>}}\hss}\kern-60pt
+  \hbox to 60pt{\,銀は、Ag\hss}}}%
+  \raise\dimexpr 0.5\ltjgetdp0-0.5\ltjgetht0\box0%
+}
+\begin{tabular}{>{\bfseries}lccc}
+\toprule
+&\texttt{\textbackslash yoko}(横組)&\texttt{\textbackslash tate}(縦組)
+ &\texttt{\textbackslash dtou}\\
+\midrule
+字送り方向&水平右向き(→)&垂直下向き(↓)&垂直上向き(↑)\\
+行送り方向&垂直下向き(↓)&水平左向き(←)&水平右向き(→)\\
+使用する和文フォント&横組用(\verb+\jfont+)&縦組用(\verb+\tfont+)&横組用(\verb+\jfont+)の
+            $90^\circ$回転\\[\smallskipamount]
+組版例\null $^*$ &\obox{\yoko}&\obox{\tate}&\obox{\dtou}\\
+\noalign{\medskip}
+\bottomrule
+\end{tabular}
+
+\medskip\raggedright
+\def\R#1{%
+  \raise0.38\zw\hbox{%
+    \vrule height.2pt  depth.2pt width2\zw%
+    \hbox to 0pt{\hss\composite{*d^@{#1}}\hss}%
+  }%
+}
+$^*$\ 幅(width),高さ(height),深さ(depth)の増加方向を,
+それぞれ「\R{>}」,「\R{>>}」,「\R{>|}」で表している.
+\raggedright
+
+\end{table}
+
+\LuaTeX-jaがサポートする組方向は表\ref{tab-dir}に示す3つである.
+4列目の \verb+\dtou+ は聞き慣れない命令だと思うが,
+実は\pTeX に同名の命令が(ドキュメントには書かれていないが)存在する.
+Down-TO-Upの意味なのだろう.\verb+\dtou+ を使用する機会はないだろうが,
+\LuaTeX-jaではデバッグ用に実装している.
+
+
+組方向は,\verb+\yoko+,~\verb+\tate+,~\verb+\dtou+ をそれぞれ使用することで,
+現在作成中のリストやボックスが空の時にのみ変更可能である.
+
+
+\subsection{異方向のボックス}
+
+縦組の中に「42」などの2桁以上の算用数字を横組で組むなど,
+異なる組方向を混在させることがしばしば行われる.
+組方向の混在も\pTeX と同じようにできる:
+\begin{LTXexample}
+ここは横組%     yoko
+\hbox{\tate %   tate
+  \hbox{縦組}%  tate
+  の中に
+  \hbox{\yoko 横組の内容}% yoko
+  を挿入する
+}
+また横組に戻る% yoko
+\end{LTXexample}
+
+異なる組方向のボックスを配置した場合にどう組まれるかの仕様も,\pTeX を
+踏襲している.表\ref{tab-diffdir}に示す.
+
+\begin{table}[t]
+\caption{異方向のボックスの配置}
+%<en>\medskip
+\label{tab-diffdir}
+ \centering\small\unitlength3mm
+ \def\TATEeg{%
+   \hbox{\smash{\begin{picture}(0,0)(-2,0)
+     \thicklines
+     \polyline(-2,0)(-2,-7)(5,-7)(5,0)
+     \put(0,0){\circle*{0.3}}
+     \put(0,0){\vector(1,0){5}} \put(2.5,-0.2){\makebox(0,0)[t]{$h_{\mathrm{T}}$}}
+     \put(0,0){\vector(-1,0){2}}\put(-1,-0.2){\makebox(0,0)[t]{$d_{\mathrm{T}}$}}
+     \put(0,0){\vector(0,-1){7}}\put(0.2,-3.5){\makebox(0,0)[l]{$w_{\mathrm{T}}$}}
+   \end{picture}}}
+ }
+ \def\DTOUeg{%
+   \hbox{\smash{\begin{picture}(0,0)(-5,0)
+     \thicklines
+     \polyline(-5,0)(-5,7)(2,7)(2,0)
+     \put(0,0){\circle*{0.3}}
+     \put(0,0){\vector(-1,0){5}} \put(-2.5,0.3){\makebox(0,0)[b]{$h_{\mathrm{D}}$}}
+     \put(0,0){\vector(1,0){2}}\put(1,0.3){\makebox(0,0)[b]{$d_{\mathrm{D}}$}}
+     \put(0,0){\vector(0,1){7}}\put(-0.2,3.5){\makebox(0,0)[r]{$w_{\mathrm{D}}$}}
+   \end{picture}}}
+ }
+ \def\YOKOeg{%
+   \hbox{\smash{\begin{picture}(0,0)
+     \thicklines
+     \polyline(0,5)(7,5)(7,-2)(0,-2)
+     \put(0,0){\circle*{0.3}}
+     \put(0,0){\vector(0,1){5}} \put(0.3,2.5){\makebox(0,0)[l]{$h_{\mathrm{Y}}$}}
+     \put(0,0){\vector(0,-1){2}}\put(0.3,-1){\makebox(0,0)[l]{$d_{\mathrm{Y}}$}}
+     \put(0,0){\vector(1,0){7}}\put(3.5,0.2){\makebox(0,0)[b]{$w_{\mathrm{Y}}$}}
+   \end{picture}}}
+ }
+\begin{tabular}{ccc}
+\toprule
+\emph{横組中に配置}&\emph{縦組中に配置}&%
+\emph{組方向\hskip\ltjgetparameter{xkanjiskip}\texttt{\textbackslash dtou}中に配置}\\
+\midrule
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+   \put(0,0){\line(1,0){3.8}}
+   \put(4,7){\TATEeg}
+   \put(11.2,0){\line(1,0){3.8}}
+%
+   \put(2,7){\line(1,0){1.8}}
+   \put(3,3.5){\vector(0,1){3.5}\vector(0,-1){3.5}}
+   \put(2.8,3.5){\makebox(0,0)[r]{$H_{\mathrm{Y}}$}}
+   \put(3,-2){\vector(0,1){2}}
+   \put(2.8,-1){\makebox(0,0)[r]{$D_{\mathrm{Y}}$}}
+%
+   \put(4,7.2){\line(0,1){1.8}}
+   \put(11,7.2){\line(0,1){1.8}}
+   \put(6,8){\vector(-1,0){2}}
+   \put(9,8){\vector(1,0){2}}
+   \put(7.5,8){\makebox(0,0){$W_{\mathrm{Y}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+   \begin{align*}
+   W_{\mathrm{Y}} &= h_{\mathrm{T}}+d_{\mathrm{T}},\\
+   H_{\mathrm{Y}} &= w_{\mathrm{T}},\\
+   D_{\mathrm{Y}} &=0\,\mathrm{pt}
+   \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+   \put(7.5,-0.2){\line(0,-1){2.8}}
+   \put(4,2){\YOKOeg}
+   \put(7.5, 7.2){\line(0,1){3.8}}
+%
+   \put(2,7){\line(1,0){1.8}}
+   \put(2,0){\line(1,0){1.8}}
+   \put(3,5){\vector(0,1){2}}
+   \put(3,2){\vector(0,-1){2}}
+   \put(3,3.5){\makebox(0,0){$W_{\mathrm{T}}$}}
+%
+   \put(4,7.2){\line(0,1){1.8}}
+   \put(11,7.2){\line(0,1){1.8}}
+   \put(8,8){\vector(-1,0){0.5}\vector(1,0){3}}
+   \put(7,8){\vector(-1,0){3}\vector(1,0){0.5}}
+   \put(9.25,8.2){\makebox(0,0)[b]{$H_{\mathrm{T}}$}}
+   \put(5.75,8.2){\makebox(0,0)[b]{$D_{\mathrm{T}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+   \begin{align*}
+   W_{\mathrm{T}} &= h_{\mathrm{Y}}+d_{\mathrm{Y}},\\
+   H_{\mathrm{T}} &= w_{\mathrm{Y}}/2,\\
+   D_{\mathrm{T}} &= w_{\mathrm{Y}}/2
+   \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+   \put(11,-0.2){\line(0,-1){2.8}}
+   \put(4,2){\YOKOeg}
+   \put(11, 7.2){\line(0,1){3.8}}
+%
+   \put(2,7){\line(1,0){1.8}}
+   \put(2,0){\line(1,0){1.8}}
+   \put(3,5){\vector(0,1){2}}
+   \put(3,2){\vector(0,-1){2}}
+   \put(3,3.5){\makebox(0,0){$W_{\mathrm{D}}$}}
+%
+   \put(4,7.2){\line(0,1){1.8}}
+   \put(11,7.2){\line(0,1){1.8}}
+   \put(7.5,8){\vector(-1,0){3.5}\vector(1,0){3.5}}
+   \put(13,8){\vector(-1,0){2}}
+   \put(7.5,8.2){\makebox(0,0)[b]{$H_{\mathrm{D}}$}}
+   \put(12,8.2){\makebox(0,0)[b]{$D_{\mathrm{D}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+   \begin{align*}
+   W_{\mathrm{D}} &= h_{\mathrm{Y}}+d_{\mathrm{Y}},\\
+   H_{\mathrm{D}} &= w_{\mathrm{Y}},\\
+   D_{\mathrm{D}} &= 0\,\mathrm{pt}
+   \end{align*}%
+ }%
+\\\midrule
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+   \put(0,0){\line(1,0){3.8}}
+   \put(4,0){\DTOUeg}
+   \put(11.2,0){\line(1,0){3.8}}
+%
+   \put(2,7){\line(1,0){1.8}}
+   \put(3,3.5){\vector(0,1){3.5}\vector(0,-1){3.5}}
+   \put(2.8,3.5){\makebox(0,0)[r]{$H_{\mathrm{Y}}$}}
+   \put(3,-2){\vector(0,1){2}}
+   \put(2.8,-1){\makebox(0,0)[r]{$D_{\mathrm{Y}}$}}
+%
+   \put(4,7.2){\line(0,1){1.8}}
+   \put(11,7.2){\line(0,1){1.8}}
+   \put(6,8){\vector(-1,0){2}}
+   \put(9,8){\vector(1,0){2}}
+   \put(7.5,8){\makebox(0,0){$W_{\mathrm{Y}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+   \begin{align*}
+   W_{\mathrm{Y}} &= h_{\mathrm{D}}+d_{\mathrm{D}},\\
+   H_{\mathrm{Y}} &= w_{\mathrm{D}},\\
+   D_{\mathrm{Y}} &= 0\,pt
+   \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+   \put(9,-0.2){\line(0,-1){2.8}}
+   \put(4,0){\DTOUeg}
+   \put(9, 7.2){\line(0,1){3.8}}
+%
+   \put(2,7){\line(1,0){1.8}}
+   \put(2,0){\line(1,0){1.8}}
+   \put(3,5){\vector(0,1){2}}
+   \put(3,2){\vector(0,-1){2}}
+   \put(3,3.5){\makebox(0,0){$W_{\mathrm{T}}$}}
+%
+   \put(4,7.2){\line(0,1){1.8}}
+   \put(11,7.2){\line(0,1){1.8}}
+   \put(6.5,8){\vector(-1,0){2.5}\vector(1,0){2.5}}
+   \put(10,8){\vector(-1,0){1}\vector(1,0){1}}
+   \put(10,8.2){\makebox(0,0)[b]{$H_{\mathrm{T}}$}}
+   \put(6.5,8.2){\makebox(0,0)[b]{$D_{\mathrm{T}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+   \begin{align*}
+   W_{\mathrm{T}} &= h_{\mathrm{D}}+d_{\mathrm{D}},\\
+   H_{\mathrm{T}} &= d_{\mathrm{D}},\\
+   D_{\mathrm{T}} &= h_{\mathrm{D}}
+   \end{align*}%
+ }&
+ \parbox[c]{15\unitlength}{\begin{picture}(15,15)(0,-4)
+   \put(6,-0.2){\line(0,-1){2.8}}
+   \put(4,7){\TATEeg}
+   \put(6, 7.2){\line(0,1){3.8}}
+%
+   \put(2,7){\line(1,0){1.8}}
+   \put(2,0){\line(1,0){1.8}}
+   \put(3,5){\vector(0,1){2}}
+   \put(3,2){\vector(0,-1){2}}
+   \put(3,3.5){\makebox(0,0){$W_{\mathrm{D}}$}}
+%
+   \put(4,7.2){\line(0,1){1.8}}
+   \put(11,7.2){\line(0,1){1.8}}
+   \put(5,8){\vector(-1,0){1}\vector(1,0){1}}
+   \put(8.5,8){\vector(-1,0){2.5}\vector(1,0){2.5}}
+   \put(5,8.2){\makebox(0,0)[b]{$H_{\mathrm{D}}$}}
+   \put(8.5,8.2){\makebox(0,0)[b]{$D_{\mathrm{D}}$}}
+%
+ \end{picture}\vspace{-\baselineskip}
+   \begin{align*}
+   W_{\mathrm{D}} &= w_{\mathrm{T}},\\
+   H_{\mathrm{D}} &= d_{\mathrm{T}},\\
+   D_{\mathrm{D}} &= h_{\mathrm{T}}
+   \end{align*}%
+ }\\
+\bottomrule
+\end{tabular}
+\end{table}
+
+
+\paragraph{\texttt{\textbackslash wd} は組方向には対応しない}
+ボックスレジスタ \verb+\box+<num> にセットされているボックスの幅・高さ・深さの取得や
+変更にはそれぞれ \verb+\wd+,~\verb+\ht+,~\verb+\dp+ プリミティブを用いるのであった.
+\pTeX ではこれらのプリミティブは,「現在の組方向におけるボックスの寸法」を指すものであった.
+
+\LuaTeX-jaにおいては状況が異なり,\verb+\wd+,~\verb+\ht+,~\verb+\dp+ は\emph{組方向が
+混在する状況においては正しく機能しない}.まず,現在の組方向に依存しないことが挙げられる.
+\begin{LTXexample}
+% yoko direction
+\setbox0=\hbox to 20pt{foo}
+\the\wd0,~\hbox{\tate\vrule\the\wd0}
+\wd0=100pt
+\the\wd0,~\hbox{\tate \the\wd0}
+\end{LTXexample}
+また,異方向のボックスの配置処理の関係で,
+\verb+\lastbox+ を駆使してボックスのコピーを
+作成した場合でも,\verb+\wd+ 等の値が異なる場合もある.
+例えば,下の実行例における \verb+\wd1+ の値は,「縦組で組んだ時の \verb+\box0+ の
+専有する幅」となる.
+\begin{LTXexample}
+% yoko direction
+\setbox0=\hbox to 20pt{Xy}
+\the\wd0,
+\setbox0=\hbox{\tate\copy0}
+\setbox0=\hbox{\tate\unhbox0
+  \global\setbox1\lastbox}
+\the\wd1
+\end{LTXexample}
+
+\paragraph{\texttt{\textbackslash wd} 等の代替命令}
+
+\pTeX のように現在の組方向に応じたボックスの寸法の取得・設定を行うため,
+次の命令を新設した.
+
+\begin{cslist}
+
+ \item[ltjgetwd<num>\textrm{, }\textbackslash ltjgetht<num>\textrm{, }%
+  \textbackslash ltjgetdp<num>] 
+現在の組方向に応じたボックスの寸法の取得を行う.結果は内部長さであるため,
+{\let\item=\origitem
+\begin{verbatim}
+\dimexpr 2\ltjgetwd42-3pt\relax, \the\ltjgetwd1701
+\end{verbatim}
+のように \verb+\wd+<num> の代わりとして扱うことができる.使用例は以下の通りである.
+\begin{LTXexample}[width=0.3\textwidth]
+\parindent0pt
+\setbox32767=\hbox{\yoko よこぐみ}
+\fboxsep=0mm\fbox{\copy32767}
+\vbox{\hsize=20mm 
+\yoko YOKO \the\ltjgetwd32767, \\
+  \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\vbox{\hsize=20mm\raggedleft
+\tate TATE \the\ltjgetwd32767, \\
+  \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\vbox{\hsize=20mm\raggedleft
+\dtou DTOU \the\ltjgetwd32767, \\
+  \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\end{LTXexample}}
+
+ \item[ltjsetwd<num>=<dimen>\textrm{, }\textbackslash ltjsetht<num>=<dimen>\textrm{, }%
+  \textbackslash ltjsetdp<num>=<dimen>]
+現在の組方向に応じたボックスの寸法の設定を行う.\verb+\afterassignment+ を2回利用して
+実装しているので,次の4通りは全て同じ意味である.
+{\let\item=\origitem
+\begin{verbatim}
+ \ltjsetwd42 20pt,  \ltjsetwd42=20pt,  \ltjsetwd=42 20pt,  \ltjsetwd=42=20pt
+\end{verbatim}
+}%
+
+
+設定値は組方向ごとに独立して記録される.
+
+
+
+\end{cslist} 
+%</ja>
+
 %<en>\section{Font Metric and Japanese Font}
 %<ja>\section{フォントメトリックと和文フォント}
 %<en>\subsection{\texttt{\textbackslash jfont}}
@@ -2450,14 +2818,14 @@ JIS~X~0213の範囲に広げると,差異はさらに大きくなる.
 \label{ssec-jfont}
 
 %<*en>
-To load a font as a Japanese font, you must use the
+To load a font as a Japanese font (for horizontal direction), you must use the
 \verb+\jfont+ instead of~\verb+\font+, while
 \verb+\jfont+ admits the same syntax used in~\verb+\font+.
 \LuaTeX-ja automatically loads \Pkg{luaotfload} package,
 so TrueType/OpenType fonts with features can be used for Japanese fonts:
 %</en>
 %<*ja>
-フォントを和文フォントとして読み込むためには,\verb+\jfont+ を
+フォントを(横組用)和文フォントとして読み込むためには,\verb+\jfont+ を
 \verb+\font+ プリミティブの代わりに用いる.
 \verb+\jfont+ の文法は \verb+\font+ と同じである.
 \LuaTeX-jaは\Pkg{luaotfload}パッケージを自動的に読み込むので,
@@ -2525,8 +2893,8 @@ which JFM will be used for this font by the following keys:
 \toprule
 &\tt jfm-ujis.lua&\tt jfm-jis.lua&\tt jfm-min.lua\\
 \midrule
-%<en>Example~1\cite{min10}
-%<ja>例1\cite{min10}
+%<en>Example~1~\cite{min10}
+%<ja>例1~\cite{min10}
 &\r{ujis}&\r{jis}&\r{min}\\
 %<en>Example~2
 %<ja>例2
@@ -2541,14 +2909,15 @@ Bounding Box&\t{ujis}&\t{jis}&\t{min}\\
 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}\advance\leftmargin1\zw}
 \item[jfm=<name>]
 %<*en>
-Specify the name of JFM. If specified JFM has not been loaded, \LuaTeX-ja search and load
+Specify the name of (horizontal) JFM. 
+If specified JFM has not been loaded, \LuaTeX-ja search and load
 a file named \texttt{jfm-<name>.lua}.
 
 The following JFMs are shipped with \LuaTeX-ja:
 %</en>
 %<*ja>
-JFMの名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
-\texttt{jfm-<name>.lua}を読み込む.以下のJFMが\LuaTeX-jaには同梱されている:
+用いる(横組用)JFMの名前を指定する.もし以前に指定されたJFMが読み込まれていなければ,
+\texttt{jfm-<name>.lua}を読み込む.以下の横組用JFMが\LuaTeX-jaには同梱されている:
 %</ja>
 \begin{description}
 %<*en>
@@ -2715,6 +3084,30 @@ letter-spacing and the width of italic correction are not correct:
 \S あいう\/ABC
 \end{LTXexample}
 
+%<en>\subsection{\texttt{\textbackslash tfont}}
+%<ja>\subsection{\texttt{\textbackslash tfont} 命令}
+
+%<*en>
+...
+%</en>
+%<*ja>
+\verb+\tfont+ はフォントを縦組用の和文フォントとして読み込む命令であり,
+\verb+\jfont+ の文法は \verb+\jfont+ と同じである.
+\verb+\tfont+ で定義された縦組用和文フォントは,
+以下の点が \verb+\jfont+ による横組用和文フォントとは異なる:
+\begin{itemize}
+ \item 出力時に,自動的に「\verb+vert+ feature相当」のグリフ置換が行われる.
+       これは,\Pkg{luaotfload}による各種featureのサポートとは全く別個に行われるもので,
+       いちいち \verb+vert+ featureを指定する必要はない.
+\begin{verbatim}
+\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujis % OK
+\end{verbatim}
+ \item \ref{ssec-math}節で述べる,数式中の和文フォントには縦組用和文フォントは指定できない.
+ \item \texttt{jfm=<name>}\ の部分には縦組用JFMを指定する.現在同梱されているのは,
+OTFパッケージの \verb+upnmlminr-v.tfm+ を元にした\texttt{jfm-ujisv.lua}\ のみである.
+\end{itemize}
+%</ja>
+
 %<en>\subsection{Prefix \texttt{psft}}
 %<ja>\subsection{\texttt{psft}プリフィックス}
 \label{ssec-psft}
@@ -2843,8 +3236,13 @@ floating-point numbers in design-size unit.
 %<en>(required)
 %<ja>(必須)
 
-%<en>The direction of JFM. At the present, only \texttt{'yoko'} is supported.
-%<ja>JFMの書字方向.現時点では横書き(\texttt{'yoko'})のみがサポートされる.
+%<*en>
+The direction of JFM. \texttt{'yoko'}~(horizontal)
+or \texttt{'tate'}~(vertical) are supported.
+%</en>
+%<*ja>
+JFMの書字方向.\texttt{'yoko'}(横組)と \texttt{'tate'}(縦組)がサポートされる.
+%</ja>
 
 \item[zw=<length>]
 %<en>(required)
@@ -3852,6 +4250,8 @@ for the same character.
 %<ja>[\TeX の \verb+\scriptscriptfont+]
 \item[\Param{yjabaselineshift}\,=<dimen>]\
 \item[\Param{yalbaselineshift}\,=<dimen>] [\verb+\ybaselineshift+]
+\item[\Param{tjabaselineshift}\,=<dimen>]\
+\item[\Param{talbaselineshift}\,=<dimen>] [\verb+\tbaselineshift+]
 
 \item[\Param{jaxspmode}\,=\{<chr\_code>,<mode>\}$^\ast$]
 
@@ -4369,22 +4769,23 @@ but on the other hand \verb+\zw+~and~\verb+\zh+ are specified by JFM.
 
 
 \item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
+\item[DeclareYokoKanjiEncoding\{<encoding>\}\{<text-settings>\}\{<math-settings>\}]
 
 %<*en>
 In NFSS2 under \LuaTeX-ja, distinction between alphabetic font families
             and Japanese font families are only made by their
             encodings. For example, encodings OT1 and T1 are for
             alphabetic font families, and a Japanese font family cannot
-            have these encodings. This command defines a new encoding
-            scheme for Japanese font family (in horizontal direction).
+            have these encodings. These command define a new encoding
+            scheme for Japanese font family.
 %</en>
 %<*ja>
 \LuaTeX-jaのNFSS2においては,欧文フォントファミリと和文フォントファミリは
 そのエンコーディングによってのみ区別される.
 例えば,OT1とT1のエンコーディングは欧文フォントファミリに対するものであり,
 和文フォントファミリはこれらのエンコーディングを持つことはできない.
\81\93ã\81®ã\82³ã\83\9eã\83³ã\83\89ã\81¯æ¨ªæ\9b¸ã\81\8d用和文フォントのための新しいエンコーディングを
-定義する.
\81\93ã\82\8cã\82\89ã\82³ã\83\9eã\83³ã\83\89ã\81¯æ¨ªçµ\84ç\94¨ã\83»ç¸¦çµ\84用和文フォントのための新しいエンコーディングを
+それぞれ定義する.
 %</ja>
 
 \item[DeclareKanjiEncodingDefaults\{<text-settings>\}\{<math-settings>\}]
@@ -4472,9 +4873,7 @@ to match the vertical center of ``M'' and that of ``あ''  in vertical typesetti
   + d_{\text{あ}} - d_{\text{M}},
 \]
 where $h_{a}$~and~$d_{a}$ denote the height of ``$a$'' and the depth, respectively.
-
-Current \LuaTeX-ja does not support vertical typesetting, so
-this \verb+\adjustbaseline+ has almost no effect.
+In \LuaTeX-ja, this \verb+\adjustbaseline+ does same task.
 %</en>
 %<*ja>
 \pLaTeXe では,\verb+\adjustbaseline+ は縦書時に「M」と「あ」の中心線を一致させるために,
@@ -4485,9 +4884,7 @@ this \verb+\adjustbaseline+ has almost no effect.
   + d_{\text{あ}} - d_{\text{M}},
 \]
 ここで,$h_{a}$,~$d_{a}$はそれぞれ「$a$」の高さ・深さを表す.
-
-現在の\LuaTeX-jaは縦書きをサポートしていないので,この \verb+\adjustbaseline+ は
-ほとんど何もしていない.
+\LuaTeX-jaにおいても\verb+\adjustbaseline+ は同様の処理を行っている.
 %</ja>
 
 \item[fontfamily\{<family>\}]
@@ -4521,7 +4918,8 @@ to <family>. Which family will be changed is determined as follows:
       \verb+\DeclareKanijFamily+.
 %</en>
 %<*ja>
-\item エンコーディング<ja-enc>におけるファミリ<family>が既に \verb+\DeclareKanjiFamily+ によって定義されている.
+\item エンコーディング<ja-enc>におけるファミリ<family>が
+既に \verb+\DeclareKanjiFamily+ によって定義されている.
 %</ja>
 %<*en>
 \item A font definition named \texttt{<ja-enc><family>.fd} (the file name is
@@ -4562,8 +4960,10 @@ In this case, the default family for font substitution is used for
   \null\hfill\{<alt-encoding>\}\{<alt-family>\}\{<alt-series>\}\{<alt-shape>\}\{<range>\}]
 %<*ja>
 \ref{ssec-altfont}節の\
-\verb+\ltjdeclarealtfont+ と同様に,前半の4引数の和文フォント(基底フォント)のうち<range>中の文字を
-第5--第8引数の和文フォントを使って組むように指示する.使用例を図\ref{fig:altkanji}に載せた.
+\verb+\ltjdeclarealtfont+ と同様に,前半の4引数の
+和文フォント(基底フォント)のうち<range>中の文字を
+第5--第8引数の和文フォントを使って組むように指示する.
+使用例を図\nobreak\ref{fig:altkanji}に載せた.
 
 {\let\item\origitem
 %<en>\advance\linewidth-2em
@@ -7354,6 +7754,13 @@ nilでない<data>をキャッシュ<filename>に保存する.
 \end{list}
 %</ja>
 
+
+%<*ja>
+\section{縦組の実装}
+
+
+%</ja>
+
 \begin{thebibliography}{99}
   \addcontentsline{toc}{section}{\refname}
 \bibitem{texbytopic}
@@ -7373,10 +7780,14 @@ TUG 2013, October 2013.
 Requirements for Japanese Text Layout (W3C Working Group Note), 2011, 2012. \newblock
 \url{http://www.w3.org/TR/jlreq/}%
 %<ja> \\日本語訳の書籍版:W3C日本語組版タスクフォース(編),『W3C技術ノート 日本語組版処理の要件』,東京電機大学出版局,2012.
-\bibitem{min10} ä¹\99é\83¨å\8e³å·±ï¼\8cmin10フォントについて.\\\null\hfill
+\bibitem{min10} ä¹\99é\83¨å\8e³å·±ï¼\8emin10フォントについて.\\\null\hfill
 \url{http://argent.shinshu-u.ac.jp/~otobe/tex/files/min10.pdf}
-\bibitem{x4051} 日本工業規格(Japanese Industrial Standard), JIS~X~4051,
+\bibitem{x4051} 日本工業規格(Japanese Industrial Standard). JIS~X~4051,
 日本語文書の組版方法(Formatting rules for Japanese documents), 1993, 1995, 2004.
+\bibitem{ptexdoc} 濱野尚人,田村明史,倉沢良一.\TeX の出版への応用—縦組み機能の組み込み—.
+\\\null\hfill\texttt{.../texmf-dist/doc/ptex/base/ptexdoc.pdf}
+\bibitem{ptextug} Hisato Hamano. \newblock 
+\textit{Vertical Typesetting with \TeX}, TUGBoat~\textbf{11}(3), 346--352, 1990.
 \end{thebibliography}
 
 \newpage
index 759f5a5..f3d6cc4 100644 (file)
@@ -270,20 +270,21 @@ do
       [dir_dtou] = { -- dtou を
         [dir_yoko] = { -- yoko 中で組む
            width  = get_h_d,
-           height = zero,
-           depth  = get_w,
+           height = get_w, 
+           depth  = zero,
            [id_hlist] = {
               { 'whatsit', sid_save },
               { 'rotate', '0 1 -1 0' },
-               { 'kern', get_w_neg },
+              { 'kern', zero },
               { 'box', get_h },
+              { 'kern', get_w_neg },
               { 'whatsit', sid_restore },
            },
            [id_vlist] = {
-               { 'kern', get_w },
+               { 'kern', zero },
               { 'whatsit', sid_save },
               { 'rotate', '0 1 -1 0' },
-              { 'box', zero },
+              { 'box', get_w_neg },
               { 'kern', get_h_d_neg },
               { 'whatsit', sid_restore },
            },
@@ -331,9 +332,9 @@ end
 
 -- dir_node に包まれている「本来の中身」を取り出し,
 -- dir_node を全部消去
-local function unwrap_dir_node(b, head)
-   -- head: nil or nil-nil
-   -- if head is non-nil, return values are (new head), (next of b), (contents)
+local function unwrap_dir_node(b, head, box_dir)
+   -- b: dir_node, head: the head of list, box_dir: 
+   -- return values are (new head), (next of b), (contents), (dir of contents)
    local bh = getlist(b)
    local bc = node_next(node_next(node_next(bh)))
    local nh, nb
@@ -344,15 +345,24 @@ local function unwrap_dir_node(b, head)
       nh, nb = node_remove(nh, b)
       setfield(b, 'next', nil)
       setfield(b, 'head', nil)
-      luatexja.ext_show_node(to_node(b), ' ', print)
-      --node_free(b) -- TODO: これを入れると test51-vtest が途中で泊まる
+      node_free(b)
    end
-   local d, wh = get_box_dir(bc, 0)
+   local shift_old, b_dir, wh = nil, get_box_dir(bc, 0)
    if wh then
       Dnode.flush_list(getfield(wh, 'value'))
       setfield(wh, 'value', nil)
    end
-   return nh, nb, bc
+   -- recalc. info
+   local info = dir_node_aux[b_dir][box_dir%dir_node_auto][getid(bc)]
+   for _,v in ipairs(info) do 
+      if v[1]=='box' then
+        shift_old = v[2](
+           getfield(bc,'width'), getfield(bc, 'height'), getfield(bc, 'depth'))
+        break
+      end
+   end
+   setfield(bc, 'shift', getfield(bc, 'shift') - shift_old)
+   return nh, nb, bc, b_dir
 end
 
 -- is_manual: 寸法変更に伴うものか?
@@ -388,19 +398,23 @@ do
       if box_dir==new_dir then
         return head, node_next(b), b, false
       elseif  box_dir%dir_node_auto == new_dir  then
--- TODO. we have to free  all other ...
+        local bc = node_next(node_next(node_next(bh)))
+        local _, dnc = get_box_dir(b, 0)
+        if dnc then -- free all other dir_node
+           Dnode.flush_list(getfield(dnc, 'value'))
+           setfield(dnc, 'value', nil)
+        end
         set_attr(b, attr_dir, box_dir%dir_node_auto + dir_node_auto)
         return head, node_next(b), b, true
       else
          local nh, nb, ret, flag
         if box_dir>= dir_node_auto then -- unwrap
-            nh, nb, ret = unwrap_dir_node(b, head)
-           head, b = nh, ret; 
-           bh = getlist(b); 
-           box_dir, dn =  get_box_dir(b, ltjs.list_dir)
-           if box_dir==new_dir then
-              return head, nb, b, fals
-           end
+           local b_dir
+            head, nb, b, b_dir = unwrap_dir_node(b, head, box_dir)
+           bh = getlist(b)
+           if b_dir==new_dir then -- no need to create new dir_node
+              return head, nb, b, false 
+           else box_dir = b_dir end
         end
             local db
             local dnh = getfield(dn, 'value')
@@ -410,6 +424,7 @@ do
                   db=x; break
                end
             end
+           Dnode.flush_list(dnh)
             db = db or create_dir_node(b, box_dir, new_dir, false)
             local w = getfield(b, 'width')
             local h = getfield(b, 'height')
@@ -501,10 +516,8 @@ do
          elseif b_dir%dir_node_auto==l_dir then
             setdimen('ltj@tempdima', getfield(s, key))
          else
-            get_box_dim_common(
-               key, 
-               node_next(node_next(node_next(getlist(s)))),
-               l_dir)
+            get_box_dim_common(key, 
+                              node_next(node_next(node_next(getlist(s)))), l_dir)
          end
       else
          setdimen('ltj@tempdima', 0)
@@ -566,6 +579,8 @@ do
         elseif b_dir%dir_node_auto == l_dir then
            setfield(s, key, tex.getdimen('ltj@tempdima'))
            if b_dir<dir_node_manual then
+              set_attr(s, attr_dir, b_dir%dir_node_auto + dir_node_manual)
+              tex_set_attr('global', attr_dir, 0)
            end
          else
            local sid, sl = getid(s), getlist(s)
@@ -582,7 +597,7 @@ do
            if set_box_dim_common(key, b, l_dir) then
               local bw, bh, bd 
                  = getfield(b,'width'), getfield(b, 'height'), getfield(b, 'depth')
-              -- re-calculate shifting info
+              -- re-calculate shift
               for i,v in ipairs(info[sid]) do 
                  if getid(sl)==id_kern then
                     setfield(sl, 'kern', v[2](bw,bh,bd) )
index ea78b52..330de54 100644 (file)
@@ -205,7 +205,6 @@ local function check_box(box_ptr, box_end)
       end
       if pid==id_kern then
         local pa = get_attr_icflag(p)
-        --if pa==IC_PROCESSED or pa == PACKED then
         if pa==IC_PROCESSED then
            -- do nothing
         elseif getsubtype(p)==2 then
@@ -296,16 +295,17 @@ local function check_next_ickern(lp)
 end
 
 local function calc_np_pbox(lp, last)
+   local first, lpa, nc = (not Np.first), KINSOKU, nil
    Np.first = Np.first or lp; Np.id = id_pbox
-   local lpa, nc = KINSOKU, nil
    set_attr(lp, attr_icflag, get_attr_icflag(lp));
    while lp ~=last and (lpa>=PACKED) and (lpa<BOXBDD) do
       if getid(lp)==id_hlist or getid(lp)==id_vlist then
         head, lp, nc = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm pbox')
+        if first then Np.first = nc end
       else
         nc, lp = lp, node_next(lp)
       end
-      lpa = lp and has_attr(lp, attr_icflag) or 0
+      first, lpa = false, (lp and has_attr(lp, attr_icflag) or 0)
      -- get_attr_icflag() ではいけない!
    end
    Np.nuc = nc
@@ -432,7 +432,8 @@ function calc_np(lp, last)
          if lpa%PROCESSED_BEGIN_FLAG == BOXBDD then
            local lq = node_next(lp)
             head = node_remove(head, lp); node_free(lp); lp = lq
-         else return calc_np_pbox(lp, last)
+         else 
+           return calc_np_pbox(lp, last)
          end -- id_pbox
       else
         k, lp = calc_np_auxtable[getid(lp)](lp)
index 9b94069..46dcbaa 100644 (file)
Binary files a/test/test51-vtest.pdf and b/test/test51-vtest.pdf differ
index 3f56a34..270fcb9 100644 (file)
@@ -43,7 +43,7 @@
         \kern-.15em%
         \TeX}
 
-\tentgt\hfuzz10000 \vfuzz10000
+\tentgt\hfuzz10000pt\relax\vfuzz10000pt
 
 \def\H{\vrule width 2pt height 10pt depth 0pt%
 \vrule width 4pt height 0pt depth 4pt}
@@ -276,48 +276,54 @@ abc&かきくけこ&xyz\cr}}%
 \vfill\eject
 
 \message{^^Jdir node^^J}
+\font\seventt=cmtt10 at 7pt
 
-\setbox0=\hbox{\tate ABCD}
-\setbox1=\hbox{\yoko\box0}
+\setbox0=\hbox{\yoko pF}
+\setbox1=\hbox{\tate\box0}
 \fbox{\copy1}
 \unhcopy1\setbox1=\lastbox %% box1: dir_node
+\setbox0=\hbox{\yoko \ltjsetwd1=50pt}
+\setbox0=\hbox{\dtou \ltjsetwd1=2pt}
+{\obeylines\seventt\baselineskip=10pt
+\directlua{luatexja.ext_show_node_list(tex.box[1], 'dir node>  ', tex.print)}\par}
+
+\setbox0=\hbox{\yoko \ltjsetht1=30pt}
+{\obeylines\seventt\baselineskip=10pt
+\directlua{luatexja.ext_show_node_list(tex.box[1], 'alter Yht> ', tex.print)}\par}
+
 \setbox0=\hbox{\tate \ltjsetwd1=50pt}
-{\fbox{\copy1}}
-\setbox2=\hbox{\tate \ltjsetdp1=42pt\copy1}%% unwrap
+{\obeylines\seventt\baselineskip=10pt
+\directlua{luatexja.ext_show_node_list(tex.box[1], 'alter Twd> ', tex.print)}\par}
 
-{\obeylines\tentt
-\directlua{luatexja.ext_show_node_list(tex.box[2], 'A> ', tex.print)}}
+\setbox0=\hbox{\yoko \ltjsetht1=70pt}
+{\obeylines\seventt\baselineskip=10pt
+\directlua{luatexja.ext_show_node_list(tex.box[1], 'alter Yht> ', tex.print)}\par}
 
-\setbox2=\hbox{\tate \unhbox2\global\setbox1=\lastbox}%% unwrap
-{\obeylines\tentt
-\directlua{luatexja.ext_show_node_list(tex.box[1], 'B> ', tex.print)}}
+%% unwrap
+\setbox2=\hbox{\yoko \copy1}
+\setbox2=\hbox{\yoko \unhbox2\global\setbox1=\lastbox}
+{\obeylines\seventt
+\directlua{luatexja.ext_show_node_list(tex.box[1], 'unwrapped> ', tex.print)}}
 
 
 
 \setbox0\hbox{\yoko a あ }\setbox1=\hbox{\tate\ltjsetht0=2pt}
 
 \fbox{\copy0}
-\message{Y\the\ltjgetwd0, \the\ltjgetht0, \the\ltjgetdp0}
-\hbox{\tate
-  \message{T\the\ltjgetwd0, \the\ltjgetht0, \the\ltjgetdp0}
-}
-\hbox{\dtou
-  \message{D\the\ltjgetwd0, \the\ltjgetht0, \the\ltjgetdp0}
-}
+\vbox{\yoko\hsize=60pt\noindent\the\ltjgetwd0,\\\the\ltjgetht0,\\\the\ltjgetdp0}
+\vbox{\tate\hsize=60pt\noindent\the\ltjgetwd0,\\\the\ltjgetht0,\\\the\ltjgetdp0}
+\vbox{\dtou\hsize=60pt\noindent\the\ltjgetwd0,\\\the\ltjgetht0,\\\the\ltjgetdp0}
+%
 \ltjsetwd0=40pt
-\message{Y\the\ltjgetwd0, \the\ltjgetht0, \the\ltjgetdp0}
-\hbox{\tate
-  \message{T\the\ltjgetwd0, \the\ltjgetht0, \the\ltjgetdp0}
-}
-\hbox{\dtou
-  \message{D\the\ltjgetwd0, \the\ltjgetht0, \the\ltjgetdp0}
-}
+\vbox{\yoko\hsize=60pt\noindent\the\ltjgetwd0,\\\the\ltjgetht0,\\\the\ltjgetdp0}
+\vbox{\tate\hsize=60pt\noindent\the\ltjgetwd0,\\\the\ltjgetht0,\\\the\ltjgetdp0}
+\vbox{\dtou\hsize=60pt\noindent\the\ltjgetwd0,\\\the\ltjgetht0,\\\the\ltjgetdp0}
 
-% pTeX bug (2011-02-24)
-\setbox0=\hbox{\tate a}
+p\kern-.15em\TeX\ bug (2011-02-24)
+\setbox0=\hbox{\tate a}\fbox{\copy0}%
 \hbox{\yoko\ltjsetht0=30pt
 \hbox{\dtou\dimen0=\ltjgetht0}
-\message{\the\ltjgetht0}}% OK. 30pt
+\the\ltjgetht0}% OK. 30pt
 
 
 \end