\begin{itemize}
%<*en>
-\item The font encoding for Japanese fonts (in horizontal direction) is \texttt{JY3}.\\
-\texttt{JT3} is used for Japanese fonts in vertical diraction.
+\item The font encoding for Japanese fonts (fot horizontal direction) is \texttt{JY3}.\\
+\texttt{JT3} is used for Japanese fonts for vertical diraction.
%</en>
%<*ja>
\item 和文フォントのエンコーディングとしては,横組用には \texttt{JY3},縦組用には\
\begin{cslist}
- \item[ltjgetwd<num>\textrm{, }\textbackslash ltjgetht<num>\textrm{, }%
- \textbackslash ltjgetdp<num>]
+ \item[ltjgetwd\{<num>\}\textrm{, }\textbackslash ltjgetht\{<num>\}\textrm{, }%
+ \textbackslash ltjgetdp\{<num>\}]
現在の組方向に応じたボックスの寸法の取得を行う.結果は内部長さであるため,
{\let\item=\origitem
\begin{verbatim}
-\dimexpr 2\ltjgetwd42-3pt\relax, \the\ltjgetwd1701
+\dimexpr 2\ltjgetwd{42}-3pt\relax, \the\ltjgetwd{1701}
\end{verbatim}
-のように \verb+\wd+<num> の代わりとして扱うことができる.使用例は以下の通りである.
+のように \verb+\wd+<num> の代わりとして扱うことができる.引数が1桁の場合は,
+\verb+\ltjgetwd3+ のように引数をグループで括らなくても良いが,そうでない場合は
+(通常の命令への引数のように)\verb+\ltjgetwd{42}+ とグループに括る必要がある.
+使用例は以下の通りである.
\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.}
+\yoko YOKO \the\ltjgetwd{32767}, \\
+ \the\ltjgetht{32767}, \\ \the\ltjgetdp{32767}.}
\vbox{\hsize=20mm\raggedleft
-\tate TATE \the\ltjgetwd32767, \\
- \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\tate TATE \the\ltjgetwd{32767}, \\
+ \the\ltjgetht{32767}, \\ \the\ltjgetdp{32767}.}
\vbox{\hsize=20mm\raggedleft
-\dtou DTOU \the\ltjgetwd32767, \\
- \the\ltjgetht32767, \\ \the\ltjgetdp32767.}
+\dtou DTOU \the\ltjgetwd{32767}, \\
+ \the\ltjgetht{32767}, \\ \the\ltjgetdp{32767}.}
\end{LTXexample}}
\item[ltjsetwd<num>=<dimen>\textrm{, }\textbackslash ltjsetht<num>=<dimen>\textrm{, }%
実装しているので,次の4通りは全て同じ意味である.
{\let\item=\origitem
\begin{verbatim}
- \ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt
+\ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt
\end{verbatim}
}%
-
設定値は組方向ごとに独立して記録される.
+\end{cslist}
+\subsection{組方向の取得・条件判断}
+「現在の組方向」や「<num>番のボックスの組方向」は,以下の命令によって
+知ることができる.
+
+\begin{cslist}
+ \item[ifydir\textrm{, }\textbackslash iftdir\textrm{, }\textbackslash ifddir]
+現在の組方向が横組(\verb+\yoko+),縦組(\verb+\tate+),\verb+\dtou+ 方向であるかを
+それぞれ判定する.
+
+ \item[ifybox\{<num>\}\textrm{, }\textbackslash iftbox\{<num>\}\textrm{, }%
+ \textbackslash ifdbox\{<num>\}]
+<num>番のレジスタの中身が横組ボックス,縦組ボックス,\verb+\dtou+ 方向の
+ボックスか否かをそれぞれ判定する.
+
+\end{cslist}
-\end{cslist}
%</ja>
%<en>\section{Font Metric and Japanese Font}
\begin{list}{}{%
\def\makelabel{\ttfamily}\advance\leftmargin1\zw
\def\dim#1{\item[\textbackslash #1\ \textrm{(dimension)}]}
+\def\cnt#1{\item[\textbackslash #1\ \textrm{(counter)}]}
\def\attr#1{\item[\textbackslash #1\ \textrm{(attribute)}]}
}
\attr{ltj@curjfnt}
%<*en>
-The font index of current Japanese font.
+The font index of current Japanese font for horizontal direction.
%</en>
%<*ja>
-現在の和文フォントのフォント番号.
+現在の横組用和文フォントのフォント番号.
+%</ja>
+
+\attr{ltj@curtfnt}
+%<*en>
+The font index of current Japanese font for vertical direction.
+%</en>
+%<*ja>
+現在の縦組用和文フォントのフォント番号.
%</ja>
\attr{ltj@charclass}
スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした和文フォントのベースラインの移動量.
%</ja>
+\attr{ltj@tablshift}
+\attr{ltj@tkblshift}
+
\attr{ltj@autospc}
%<*en>
Whether the auto insertion of \Param{\hyperlink{fld:kanjiskip}{kanjiskip}} is allowed at the node.
これら7つの属性レジスタは,どの文字ブロックが\textbf{JAchar}のブロックとして
扱われるかを示すビットベクトルを格納する.
%</ja>
+
+\cnt{ltj@dir@count}
+%<*ja>
+現在の組方向を表す.
+%</ja>
+\begin{description}
+\item[\textit{dir\_dtou} (1)]
+\item[\textit{dir\_tate} (3)]
+\item[\textit{dir\_yoko} (4)]
+\end{description}
+
+\attr{ltj@dir}
+%<*ja>
+ボックスにおける組方向を示す.上記の3つの値(1,~3,~4)の他に,
+それらに次を加えた値(17,~19, 20, 33, 35,~36)もとり得る.
+%</ja>
+\begin{description}
+\item[\textit{dir\_node\_auto} (16)]
+\item[\textit{dir\_node\_manual} (32)]
+\end{description}
+
+
\end{list}
%<*en>
Furthermore, \LuaTeX-ja uses several user-defined whatsit nodes for
-inrernal processing. All those nodes store a natural number (hence the node's
-\texttt{type} is 100).
+inrernal processing. All those nodes except \emph{direction} whatsits
+store a natural number (hence its \texttt{type} is 100).
+\emph{direction} whatsits store a node list, hence its \texttt{type} is 110.
Their \texttt{user\_id} (used for distinguish user-defined whatsits)
are allocated by \texttt{luatexbase.newuserwhatsitid}.
%</en>
%<*ja>
さらに,\LuaTeX-jaはいくつかのuser-defined whatsit nodeを内部処理に用いる.
-これらのwhatsitノードの \texttt{type} は100であり,ノードは自然数を格納している.
+\textit{direction} whatsitはノードリストを格納するが,
+それ以外のwhatsitノードの \texttt{type} は100であり,ノードは自然数を格納している.
user-defined whatsitを識別するための \texttt{user\_id} は\
\texttt{luatexbase.newuserwhatsitid} により確保されており,
下の見出しは単なる識別用でしかない.
「段落の開始」を意味するノード.
list環境,itemize環境などにおいて,\verb+\item+ で始まる各項目は……
%</ja>
+
+\item[\textit{direction}]
+
\end{description}
%<*en>
\ltj@dir@count=1\ydirfalse\tdirfalse\ddirtrue}
\yoko
-%%%%%%%% \ifybox, \iftbox
-%%%%%%%% \ltjgetwd{<box_num>} etc.
-\def\ltjgetwd{\expandafter\expandafter\expandafter\ltj@@getwd\ltj@grab@num}
-\def\ltjgetht{\expandafter\expandafter\expandafter\ltj@@getht\ltj@grab@num}
-\def\ltjgetdp{\expandafter\expandafter\expandafter\ltj@@getdp\ltj@grab@num}
+%%%%%%%% \ltjgetwd<box_num> etc.
+%\def\ltjgetwd{\expandafter\expandafter\expandafter\ltj@@getwd\ltj@grab@num}
+%\def\ltjgetht{\expandafter\expandafter\expandafter\ltj@@getht\ltj@grab@num}
+%\def\ltjgetdp{\expandafter\expandafter\expandafter\ltj@@getdp\ltj@grab@num}
\def\ltj@@getwd#1{%
\directlua{luatexja.direction.get_box_dim('width', \the\numexpr#1\relax)}%
\ltj@tempdima%
\directlua{luatexja.direction.get_box_dim('depth', \the\numexpr#1\relax)}%
\ltj@tempdima%
}
+\let\ltjgetwd=\ltj@@getwd\let\ltjgetht=\ltj@@getht\let\ltjgetdp=\ltj@@getdp
+%%%%%%%% \ltjsetwd<box_num>=<dimen> etc.
\protected\def\ltjsetwd{\begingroup
\ltj@reset@globaldefs\afterassignment\ltj@@setwd@a\ltj@tempcnta}
\def\ltj@@setwd@a{\afterassignment\ltj@@setwd@b\ltj@tempdima}
\directlua{luatexja.direction.set_box_dim('depth')}%
\ltj@restore@globaldefs\endgroup}
-
+%%%%%%%% \ifybox, \iftbox, \ifdbox
+\def\ltj@@box@cond#1#2\fi{\fi\csname if#1\endcsname}
+\def\ifybox#1{\directlua{luatexja.direction.dir_conditional(\the\numexpr #1\relax, 4)}%
+ \ltj@@box@cond{true}\else\ltj@@box@cond{false}\fi}
+\def\iftbox#1{\directlua{luatexja.direction.dir_conditional(\the\numexpr #1\relax, 3)}%
+ \ltj@@box@cond{true}\else\ltj@@box@cond{false}\fi}
+\def\ifdbox#1{\directlua{luatexja.direction.dir_conditional(\the\numexpr #1\relax, 1)}%
+ \ltj@@box@cond{true}\else\ltj@@box@cond{false}\fi}
%%------------------ Load module for the format