OSDN Git Service
(root)
/
luatex-ja
/
luatexja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a4df224
)
Add the description of 'luatexja.set_width' callback.
author
Hironori Kitagawa
<h_kitagawa2001@yahoo.co.jp>
Sat, 22 Oct 2011 00:54:55 +0000
(09:54 +0900)
committer
Hironori Kitagawa
<h_kitagawa2001@yahoo.co.jp>
Sat, 22 Oct 2011 00:54:55 +0000
(09:54 +0900)
doc/man-en.pdf
patch
|
blob
|
history
doc/man-ja.pdf
patch
|
blob
|
history
doc/manual.dtx
patch
|
blob
|
history
src/luatexja-core.lua
patch
|
blob
|
history
test/test12-ltjarticle.pdf
patch
|
blob
|
history
test/valign.lua
patch
|
blob
|
history
diff --git
a/doc/man-en.pdf
b/doc/man-en.pdf
index
dc41176
..
de256b9
100644
(file)
Binary files a/doc/man-en.pdf and b/doc/man-en.pdf differ
diff --git
a/doc/man-ja.pdf
b/doc/man-ja.pdf
index
3840bbd
..
4338e16
100644
(file)
Binary files a/doc/man-ja.pdf and b/doc/man-ja.pdf differ
diff --git
a/doc/manual.dtx
b/doc/manual.dtx
index
4ae38f1
..
f6abf99
100644
(file)
--- a/
doc/manual.dtx
+++ b/
doc/manual.dtx
@@
-1168,7
+1168,8
@@
be accessed via \verb+luatexbase.add_to_callback+ function and so on, as other c
\begin{list}{}%
{\def\makelabel#1{\bfseries#1}}
\item[\texttt{luatexja.load\_jfm} callback]
\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)
\begin{verbatim}
function (<table> jfm_info, <string> jfm_name)
@@
-1234,8
+1235,36
@@
The argument \verb+char_class+ is the result of \LuaTeX-ja's default
This callback doesn't replace any code of \LuaTeX-ja.
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}
\end{list}
@@
-1567,8
+1596,8
@@
As explained in Subsection~\ref{ssec-plain}, \verb+\jQ+ is equal to
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
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. Th
e dimension
- \verb+\jH+
stores this length, similar to \verb+\jQ+.
+ used in Japanese phototypesetting. Th
is
+ \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.
\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.
diff --git
a/src/luatexja-core.lua
b/src/luatexja-core.lua
index
8190708
..
673f581
100644
(file)
--- a/
src/luatexja-core.lua
+++ b/
src/luatexja-core.lua
@@
-61,7
+61,7
@@
end
-- Three aux. functions, bollowed from tex.web
local unity=65536
-- Three aux. functions, bollowed from tex.web
local unity=65536
-
local
function print_scaled(s)
+function print_scaled(s)
local out=''
local delta=10
if s<0 then
local out=''
local delta=10
if s<0 then
diff --git
a/test/test12-ltjarticle.pdf
b/test/test12-ltjarticle.pdf
index
697cd2b
..
a242da5
100644
(file)
Binary files a/test/test12-ltjarticle.pdf and b/test/test12-ltjarticle.pdf differ
diff --git
a/test/valign.lua
b/test/valign.lua
index
819504e
..
c044e6f
100644
(file)
--- a/
test/valign.lua
+++ b/
test/valign.lua
@@
-13,11
+13,11
@@
local ltjf_find_char_class = ltjf.find_char_class
local function set_valign(fmtable, fn)
local fi = fonts.ids[fn]
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 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",
return fmtable
end
luatexbase.add_to_callback("luatexja.define_jfont",