\begin{list}{}%
{\def\makelabel#1{\bfseries#1}}
\item[\texttt{luatexja.load\_jfm} callback]
-With this callback you can overwrite JFMs.
+With this callback you can overwrite JFMs.
+This callback is called when a new JFM is loaded.
\begin{verbatim}
function (<table> jfm_info, <string> jfm_name)
This callback doesn't replace any code of \LuaTeX-ja.
+\item[\texttt{luatexja.set\_width} callback]
+This callback is called when \LuaTeX-ja is trying to encapsule a
+ \textbf{JAchar} \textit{glyph\_node}, to adjust its
+ dimension and position.
+\begin{lstlisting}[numbers=left]
+function (<table> shift_info, <table> jfont_info, <number> char_class)
+ return <table> new_shift_info
+end
+\end{lstlisting}
+The argument \verb+shift_info+ and the returned \verb+new_shift_info+ have
+\texttt{down} and \texttt{left} fields, which are the amount of shifting
+ down/left the character in a scaled-point.
+%<*ja>
+良い例が\Pkg{test/valign.lua}である.このファイルが読み込まれた状態では,
+ JFM内で規定された文字クラス0の文字における$(\hbox{高
+ さ}):(\hbox{深さ})$の比になるように,実際のフォントの出力上
+ 下位置が自動調整される.例えば,
+\begin{itemize}
+\item JFM側の設定:$(\hbox{高さ})=88x$, $(\hbox{深さ})=12x$%
+(和文OpenTypeフォントの標準値)
+\item 実フォント側の数値:$(\hbox{高さ})=28y$, $(\hbox{深さ})=5y$(和文TrueTypeフォントの標準値)
+\end{itemize}
+となっていたとする.すると,実際の文字の出力位置は,
+\[
+ \frac{88x}{88x+12x} (28y+5y) - 28y = \frac{26}{825}y= 0.03\dot1\dot5y
+\]
+だけ上にずらされることになる,
+%</ja>
\end{list}
a unit used in Japanese phototypesetting. So one should not change the value of this dimension.
\dim{jH}
There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
- used in Japanese phototypesetting. The dimension
- \verb+\jH+ stores this length, similar to \verb+\jQ+.
+ used in Japanese phototypesetting. This
+ \verb+\jH+ is a synonym of \verb+\jQ+.
\dim{ltj@zw} A temporal register for the `full-width' of current Japanese font.
\dim{ltj@zh} A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
\attr{jfam} Current number of Japanese font family for math formulas.
local function set_valign(fmtable, fn)
local fi = fonts.ids[fn]
- local fa = fi.ascender / (fi.ascender + fi.descender)
local mt = ltjf.metrics[fmtable.jfm].char_type[0]
- local ma = mt.height / (mt.height + mt.depth)
- fmtable.down_offset = round((fa - ma)*fi.size)
- print('loading :', fn, fmtable.down_offset)
+ local ma = mt.height / (mt.height + mt.depth) * (fi.ascender + fi.descender)
+ fmtable.down_offset = round(fi.ascender - ma)
+ print('loading :', fn, print_scaled(fmtable.down_offset)
+ .. ' / ' .. print_scaled(fi.size))
return fmtable
end
luatexbase.add_to_callback("luatexja.define_jfont",