-This is LuaTeX, Version beta-0.66.0-2011043022 (rev 4141) (format=luatex 2011.4.27) 1 MAY 2011 11:44
+This is LuaTeX, Version beta-0.71.0-2011050119 (rev 4235) (format=luatex 2011.5.1) 9 MAY 2011 22:29
restricted \write18 enabled.
**sample1
(./sample1.tex (./s1sty.tex
\ltj@tempcntb=\count282
\ltj@tempcntc=\count283
\ltj@tempdima=\dimen256
-\ltj@autospc=\count284
-\ltj@autoxspc=\count285
-\jcharwidowpenalty=\count286
+\jcharwidowpenalty=\count284
\kanjiskip=\skip256
\xkanjiskip=\skip257
\zw=\dimen257
\ltj@charclass=\luatexattribute10
\ltj@yablshift=\luatexattribute11
\ltj@ykblshift=\luatexattribute12
-\ltj@icflag=\luatexattribute13
+\ltj@autospc=\luatexattribute13
+\ltj@autoxspc=\luatexattribute14
+\ltj@icflag=\luatexattribute15
\ltj@japanese=\language87
(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-rmlgbm.lua)
(luatexbase-mcb) at position 2 in 'pre_linebreak_filter'
Module luatexbase-mcb info: inserting 'ltj.hpack_filter'
(luatexbase-mcb) at position 2 in 'hpack_filter'
+(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-jfmglue.lua)
(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-xkanji.lua)
-(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-core-aux.lua)
-\ltj@kcat0=\luatexattribute14
-\ltj@kcat1=\luatexattribute15
-\ltj@kcat2=\luatexattribute16
-\ltj@kcat3=\luatexattribute17
-\ltj@kcat4=\luatexattribute18
-\ltj@kcat5=\luatexattribute19
-\ltj@kcat6=\luatexattribute20
-\ltj@@stack=\count287
-\ltj@@group@level=\count288
+\ltj@kcat0=\luatexattribute16
+\ltj@kcat1=\luatexattribute17
+\ltj@kcat2=\luatexattribute18
+\ltj@kcat3=\luatexattribute19
+\ltj@kcat4=\luatexattribute20
+\ltj@kcat5=\luatexattribute21
+\ltj@kcat6=\luatexattribute22
+\ltj@@stack=\count285
+\ltj@@group@level=\count286
plain format: loading luatexja-plain.tex
(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-plain.tex
(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-kinsoku.tex)))
(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/jfm-mono.lua)
\vspbox=\box256
-\enumi=\count289
+\enumi=\count287
) 特徴
制限 ファイル構成 [1{/opt/texlive/p2010/texmf-var/fonts/map/pdftex/updm
ap/pdftex.map
x.map): fontmap entry for `bchro8r' already exists, duplicates ignored
}] 使用方法 和文フォントの定義 [2]
「和文文字の範囲」の設定 組版パラメタの調整 [3]
-Overfull \hbox (2.29878pt too wide) in paragraph at lines 215--220
+Overfull \hbox (2.29878pt too wide) in paragraph at lines 220--225
[] []\tentt yjabaselineshift=$\tensy h$\tenit di-men$\tensy i$\tenrm : \tenmin
和 文 文 字 の ベ ー ス ラ イ ン 補 正 量 を \tenrm di-men-sion
\tenmin で 指 定 す る [] \tenrm pT[]X
.\tentt y
.etc.
-組版パラメタの取得 [4] その他の命令 JFMについて [5]
-大まかな処理の流れ [6] [7] [8] 名称について 表記法 読み方
-機能 [9] 数式の表示例 生い立ち
-T\kern -.1667em\lower .5ex\hbox {E}\kern -.125emXの日本語化 [10]
+[4] 組版パラメタの取得 その他の命令 [5] JFMについて [6]
+大まかな処理の流れ [7] [8] [9] 名称について 表記法 読み方
+機能 [10] 数式の表示例 生い立ち
+T\kern -.1667em\lower .5ex\hbox {E}\kern -.125emXの日本語化 [11]
T\kern -.1667em\lower .5ex\hbox {E}\kern -.125emXによる組版の作業工
-程 [11] GUI環境とT\kern -.1667em\lower .5ex\hbox {E}\kern -.125emX [12] )</
+程 [12] GUI環境とT\kern -.1667em\lower .5ex\hbox {E}\kern -.125emX [13] )</
opt/texlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></opt/te
xlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></opt/texlive/
p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx7.pfb></opt/texlive/p2010/t
xlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb></opt/texlive/
p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt8.pfb></opt/texlive/p2010/t
exmf-dist/fonts/type1/hoekwater/manfnt/manfnt.pfb>
-Output written on sample1.pdf (12 pages, 222125 bytes).
-PDF statistics: 117 PDF objects out of 1000 (max. 8388607)
- 84 compressed objects within 1 object stream
+Output written on sample1.pdf (13 pages, 225588 bytes).
+PDF statistics: 120 PDF objects out of 1000 (max. 8388607)
+ 86 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 131072)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
\endtt
と指定している{\small(つまりLatin-1 Supplementの範囲は欧文扱い)\inhibitglue}.
-TODO: 「{\ltjsetparameter{jacharrange={1}}× (|U+00D7|)}」等,ISO 8859-1領域
-にマッピングされた文字の扱い.
-「{\ltjsetparameter{jacharrange={1}}¢ (|U+00A2|)}」はHalfwidth and
-Fullwidth Formsに全角形(\char"FFE0)があるから%"
-luaotfloadの置換処理に割り込めばよいが…….
+%TODO: 「{\ltjsetparameter{jacharrange={1}}× (|U+00D7|)}」等,ISO 8859-1領域
+%にマッピングされた文字の扱い.
+%「{\ltjsetparameter{jacharrange={1}}¢ (|U+00A2|)}」はHalfwidth and
+%Fullwidth Formsに全角形(\char"FFE0)があるから%"
+%luaotfloadの置換処理に割り込めばよいが…….
\enditem
\item |xkanjiskip=<skip>|★\inhibitglue: 後に述べる|\xkanjiskip=<skip>|と同じ意味.
\item |jcharwidowpenalty=<penalty>|★\inhibitglue:
後に述べる|\jcharwidowpenalty=<penalty>|と同じ意味.
-\item |autospacing[=<bool>]|★◎\par\noindent
-%\item |autospacing[=<bool>]|★\par\noindent
+\item |autospacing[=<bool>]|\par\noindent
和文文字間のglue(|\kanjiskip|)の自動挿入をするかしないかを制御.
-\item |autoxspacing[=<bool>]|★◎\par\noindent
-%\item |autoxspacing[=<bool>]|★\par\noindent
+p\TeX では段落/hbox 単位での設定となったが,Lua\TeX-ja では
+そうではなくなった.
+挿入可能な箇所の両端のノードにおいて,片方でも
+この値がfalseなら自動挿入は行われる.つまり,例えば
+\begintt
+あ\ltjsetparameter{autospacing=false}いう
+\endtt
+の場合,「あい」の間には|\kanjiskip|が挿入され,「いう」の間には入らない.
+\item |autoxspacing[=<bool>]|\par\noindent
和欧文間のglue(|\xkanjiskip|)の自動挿入をするかしないかを制御.
+その他は|autospacing|と同様.
\item |differentjfm=(large/small/average/both)|★◎\par\noindent
異なる$(\hbox{<jfm>}, \hbox{<varkey>})$である2つの和文文字の間の
\itemitem {\tt small}: 両者のうち小さい方.
\itemitem {\tt average}: 両者の相加平均.
\itemitem {\tt both}: 両者の合計値の幅をもつglue/kernを挿入する.
+この指定は,JFM由来の|\kanjiskip|の値が左右の和文文字で異なったときの
+挙動にも適用される.
\item |jacharrange={<range_num>,<range_num>,...}|:
$\lvert\hbox{<range_num>}\rvert$番の文字範囲の文字を和文扱いするか欧文扱いするかを設定する.
\item |jacharrange|: 文字範囲の番号$n$を第2引数にとり,$n$番の文字範囲が
和文文字扱いされていれば|0|,欧文文字扱いされていれば|1|を返す.
-$n\notin [1,216]$の場合は,「どの文字範囲にも属さない|U+0100|以降の文字」に対しての結果を返す.
+$n\notin [1,216]$の場合は,「どの文字範囲にも属さない|U+0080|以降の文字」に対しての結果を返す(しかし,前に述べたデフォルトでの設定のため,実際には|U+0100|以降となる).
\item |chartorange|: 文字コード<chr_code>を第2引数にとり,それが属している文字範囲の番号を返す.
\itemitem <chr_code>がUnicodeの範囲外または|0x80|未満ならば,|-1|を返す.
\beginparagraph その他の命令
-\item skip |\kanjiskip|: 和文文字同士の間に入る空白量を指定.p\TeX の同名の命令と同様.
-\item skip |\xkanjiskip|: 和文文字と欧文文字の間に入る空白量.p\TeX の同名の命令と同様.
+\item skip |\kanjiskip|: 和文文字同士の間に入る空白量を指定.
+p\TeX の同名の命令と同様に,基本的には段落/hbox終了時の値が,その段落/hbox全体に適用される.
+
+{\bf TODO}: 現在の実装では,hboxにおいては,hbox終了{\gt 後}の値が適用される.
+要検討.
+
+但し,|\kanjiskip|の自然長が$\hbox{|\maxdimen|}=16383.99998\,{\rm pt}$の場合は,
+\itemitem (和文文字の間それぞれについて)JFMに指定されている
+|\kanjiskip|の値を採用する.
+\itemitem 左側JFM,右側JFMのどちらかにおいて指定されていれば,そちらを使用する.
+\itemitem どちらにおいても指定されていない場合は,0とみなす.
+
+\item skip |\xkanjiskip|: 和文文字と欧文文字の間に入る空白量.p\TeX の同名の命令と同様.これも,自然長が|\maxdimen|の場合は,JFMで指定された値を使う.
+
+
\item count |\jcharwidowpenalty|: 段落において「最後の1文字のみが次の行に」くることを
抑制するためのpenalty値.このpenaltyは,段落内にある,最後の「|kcatcode|の最下位bitが
1で{\bf ない}ような和文文字」の直前に挿入される.
現時点では横組(|'yoko'|)のみの対応.
\item |zw|, |zh|: それぞれ|\zw|, |\zh|のフォントサイズに対する割合を記述する(必須).
通常は両方とも1.0となるだろう.
+\item |kanjiskip|, |xkanjiskip|: それぞれ和文文字間グルー量,和欧文間グルー量を
+\begintt
+{<width>, <stretch>, <shrink>}
+\endtt
+という形で,フォントサイズ単位で指定する.
\item 数字のindex $i$を持った値:$i$番の文字クラスについての情報を記述する.
\itemitem |glue|: 現在の文字クラスの文字の後に挿入するglueを指定する.
この項目の内容は
and round(s.width*met_tb.size)==p.width) then
-- must be encapsuled by a \hbox
head, q = node.remove(head,p)
- p.next=nil
+ p.next = nil
p.yoffset=round(p.yoffset-met_tb.size*s.down)
p.xoffset=round(p.xoffset-met_tb.size*s.left)
if s.align=='middle' or s.align=='right' then
g = node_hpack(h, round(met_tb.size*s.width), 'exactly')
g.height = round(met_tb.size*s.height)
g.depth = round(met_tb.size*s.depth)
- head, p = node_insert_before(head, q, g)
+ if q then
+ head = node_insert_before(head, q, g)
+ else
+ head = node_insert_after(head, node.tail(head), g)
+ end
p = q
else p=node_next(p)
end
local function main_process(head, mode)
local p = head
p = ltj.int_insert_jfm_glue(p,mode)
- p = ltj.int_insert_kanji_skip(p)
- -- off because we write the code of step 2
+ p = ltj.int_insert_kanji_skip(p)
p = main4_set_ja_width(p)
return p
end
function ltj.ext_show_node_list(head,depth,print_fn)
debug_depth = depth
if head then
- debug_show_node_list_X(head, print_fn)
+ while head do
+ debug_show_node_X(head, print_fn); head = node_next(head)
+ end
else
print_fn(debug_depth .. ' (null list)')
end
end
-function debug_show_node_list_X(p,print_fn)
- debug_depth=debug_depth.. '.'
+function ltj.ext_show_node(head,depth,print_fn)
+ debug_depth = depth
+ if head then
+ debug_show_node_X(head, print_fn)
+ else
+ print_fn(debug_depth .. ' (null list)')
+ end
+end
+function debug_show_node_X(p,print_fn)
local k = debug_depth
local s
- while p do
- local pt=node_type(p.id)
- if pt == 'glyph' then
- print_fn(debug_depth.. ' GLYPH ', p.subtype, utf.char(p.char), p.font)
- elseif pt=='hlist' then
- print_fn(debug_depth.. ' hlist ', p.subtype, '(' .. print_scaled(p.height)
- .. '+' .. print_scaled(p.depth)
- .. ')x' .. print_scaled(p.width) )
- debug_show_node_list_X(p.head,print_fn)
- debug_depth=k
- elseif pt == 'whatsit' then
- print_fn(debug_depth.. ' whatsit', p.subtype)
- elseif pt == 'glue' then
- s = debug_depth.. ' glue ' .. p.subtype
- .. ' ' .. print_spec(p.spec)
- if has_attr(p, attr_icflag)==TEMPORARY then
- s = s .. ' (might be replaced)'
- elseif has_attr(p, attr_icflag)==FROM_JFM then
- s = s .. ' (from JFM)'
- elseif has_attr(p, attr_icflag)==KANJI_SKIP then
- s = s .. ' (kanjiskip)'
- elseif has_attr(p, attr_icflag)==XKANJI_SKIP then
- s = s .. ' (xkanjiskip)'
+ local pt=node_type(p.id)
+ if pt == 'glyph' then
+ print_fn(debug_depth.. ' GLYPH ', p.subtype, utf.char(p.char), p.font)
+ elseif pt=='hlist' then
+ s = debug_depth .. ' hlist ' .. p.subtype
+ .. '(' .. print_scaled(p.height) .. '+' .. print_scaled(p.depth) .. ')x'
+ .. print_scaled(p.width)
+ if p.glue_sign >= 1 then
+ s = s .. ' glue set '
+ if p.glue_sign == 2 then s = s .. '-' end
+ s = s .. tostring(math.floor(p.glue_set*10000)/10000)
+ if p.glue_order == 0 then
+ s = s .. 'pt'
+ else
+ s = s .. 'fi'
+ for i = 2, p.glue_order do s = s .. 'l' end
end
- print_fn(s)
- elseif pt == 'kern' then
- s = debug_depth.. ' kern ' .. p.subtype
- .. ' ' .. print_scaled(p.kern) .. 'pt'
- if has_attr(p, attr_icflag)==ITALIC then
- s = s .. ' (italic correction)'
- elseif has_attr(p, attr_icflag)==TEMPORARY then
- s = s .. ' (might be replaced)'
- elseif has_attr(p, attr_icflag)==FROM_JFM then
+ end
+ print_fn(s)
+ local q = p.head
+ debug_depth=debug_depth.. '.'
+ while q do
+ debug_show_node_X(q, print_fn); q = node_next(q)
+ end
+ debug_depth=k
+ elseif pt == 'whatsit' then
+ print_fn(debug_depth.. ' whatsit', p.subtype)
+ elseif pt == 'glue' then
+ s = debug_depth.. ' glue ' .. p.subtype
+ .. ' ' .. print_spec(p.spec)
+ if has_attr(p, attr_icflag)==TEMPORARY then
+ s = s .. ' (might be replaced)'
+ elseif has_attr(p, attr_icflag)==FROM_JFM then
s = s .. ' (from JFM)'
- elseif has_attr(p, attr_icflag)==LINE_END then
- s = s .. " (from 'lineend' in JFM)"
- end
- print_fn(s)
- elseif pt == 'penalty' then
- s = debug_depth.. ' penalty ' .. tostring(p.penalty)
- if has_attr(p, attr_icflag)==KINSOKU then
- s = s .. ' (for kinsoku)'
- end
- print_fn(s)
- else
- print_fn(debug_depth.. ' ' .. node.type(p.id), p.subtype)
+ elseif has_attr(p, attr_icflag)==KANJI_SKIP then
+ s = s .. ' (kanjiskip)'
+ elseif has_attr(p, attr_icflag)==XKANJI_SKIP then
+ s = s .. ' (xkanjiskip)'
+ end
+ print_fn(s)
+ elseif pt == 'kern' then
+ s = debug_depth.. ' kern ' .. p.subtype
+ .. ' ' .. print_scaled(p.kern) .. 'pt'
+ if has_attr(p, attr_icflag)==ITALIC then
+ s = s .. ' (italic correction)'
+ elseif has_attr(p, attr_icflag)==TEMPORARY then
+ s = s .. ' (might be replaced)'
+ elseif has_attr(p, attr_icflag)==FROM_JFM then
+ s = s .. ' (from JFM)'
+ elseif has_attr(p, attr_icflag)==LINE_END then
+ s = s .. " (from 'lineend' in JFM)"
end
- p=node_next(p)
+ print_fn(s)
+ elseif pt == 'penalty' then
+ s = debug_depth.. ' penalty ' .. tostring(p.penalty)
+ if has_attr(p, attr_icflag)==KINSOKU then
+ s = s .. ' (for kinsoku)'
+ end
+ print_fn(s)
+ else
+ print_fn(debug_depth.. ' ' .. node.type(p.id), p.subtype)
end
+ p=node_next(p)
end
if i>=10000 then i = 10000
elseif i<=-10000 then i = -10000 end
end
-return p
+ return i
end
-- return true if and only if p is a Japanese character node
end
end
--- Calc the glue between two Japanese characters
-local function calc_ja_ja_glue()
- if ihb_flag then return nil
- elseif table.are_equal(qs,ps) then
- return new_jfm_glue(ps[1],ps[2],
- has_attr(q,attr_jchar_class),
- has_attr(p,attr_jchar_class))
- else
- local g = new_jfm_glue(qs[1],qs[2],
- has_attr(q,attr_jchar_class),
- ljfm_find_char_class('diffmet',qs[2]))
- local h = new_jfm_glue(ps[1],ps[2],
- ljfm_find_char_class('diffmet',ps[2]),
- has_attr(p,attr_jchar_class))
- return calc_ja_ja_aux(g,h)
- end
-end
-
ltj.ja_diffmet_rule = math.two_average
local function calc_ja_ja_aux(gb,ga)
end
end
+-- Calc the glue between two Japanese characters
+local function calc_ja_ja_glue()
+ if ihb_flag then return nil
+ elseif table.are_equal(qs,ps) then
+ return new_jfm_glue(ps[1],ps[2],
+ has_attr(q,attr_jchar_class),
+ has_attr(p,attr_jchar_class))
+ else
+ local g = new_jfm_glue(qs[1],qs[2],
+ has_attr(q,attr_jchar_class),
+ ljfm_find_char_class('diffmet',qs[2]))
+ local h = new_jfm_glue(ps[1],ps[2],
+ ljfm_find_char_class('diffmet',ps[2]),
+ has_attr(p,attr_jchar_class))
+ return calc_ja_ja_aux(g,h)
+ end
+end
+
local function ins_gk_any_JA()
ps = find_size_metric(p)
if chain then -- (q,p): JA-JA
local h = ltj.metrics[qs[2]].char_type[has_attr(q,attr_jchar_class)]
if h.kern and h.kern[x] then w = round(qs[1]*h.kern[x]) end
end
- real_insert(g, w, q_post, false)
+ if p.id~=penalty then
+ real_insert(g, w, q_post, true)
+ else
+ real_insert(g, w, q_post, false)
+ end
end
chain = false; q, qs, q_post = p, nil, 0; p = node_next(p)
end
if w == 'lineend' then
if #v.chars ~= 1 then defjfm_res= nil; return end
elseif type(w) == 'number' then
- real_char = true
+ real_char = true;
elseif type(w) == 'string' and utf.len(w)==1 then
real_char = true; w = utf.byte(w)
end
local p = tex.nest[tex.nest.ptr].tail
if p and p.id==id_glyph then
local f = p.font
+ print('it:', utf.char(p.char), p.char)
local g = node_new(id_kern)
g.subtype = 1; node.set_attribute(g, attr_icflag, ITALIC)
if rgjc_is_ucs_in_japanese_char(p) then
return g
end
-local function get_kanji_skip_from_jfm(pf)
+-- lowest part of \xkanjiskip
+local function get_xkanji_skip_from_jfm(pf)
if pf then
local px = { ltj.font_metric_table[pf].size,
ltj.font_metric_table[pf].jfm }
- local i = ltj.metrics[px[2]].kanjiskip
+ local i = ltj.metrics[px[2]].xkanjiskip
if i then
return { round(i[1]*px[1]), round(i[2]*px[1]), round(i[3]*px[1]) }
else return nil
end
end
-local function get_xkanji_skip_from_jfm(pf)
- if pf then
- local px = { ltj.font_metric_table[pf].size,
- ltj.font_metric_table[pf].jfm }
- local i = ltj.metrics[px[2]].xkanjiskip
- if i then
- return { round(i[1]*px[1]), round(i[2]*px[1]), round(i[3]*px[1]) }
- else return nil
+local function insert_xkanjiskip_node(q, f, p)
+ local g = node_new(id_glue); g.subtype = 0
+ if nr_spc[2] or np_spc[2] then
+ if xkanji_skip.width==max_dimen then -- use xkanjiskip from JFM
+ local gx = node_new(id_glue_spec);
+ gx.stretch_order = 0; gx.shrink_order = 0
+ local ak = get_xkanji_skip_from_jfm(nrf)
+ if ak then
+ gx.width = ak[1]; gx.stretch = ak[2]; gx.shrink = ak[3]
+ else gx = get_zero_glue() -- fallback
+ end
+ g.spec = gx
+ else g.spec=node.copy(xkanji_skip)
end
- else return nil
+ else g.spec = get_zero_glue()
+ end
+ local h = node_prev(p)
+ if h and has_attr(h, attr_icflag)==TEMPORARY then
+ if h.id==id_kern then
+ g.spec.width = g.spec.width + h.kern
+ node.set_attribute(g,attr_icflag,XKANJI_SKIP)
+ node_insert_after(head, q, g)
+ head = node.remove(head, h)
+ else
+ h.spec.width = g.spec.width + h.spec.width
+ h.spec.stretch = g.spec.stretch + h.spec.stretch
+ h.spec.shrink = g.spec.shrink + h.spec.shrink
+ end
+ else
+ node.set_attribute(g,attr_icflag,XKANJI_SKIP)
+ node_insert_after(head, q, g)
end
end
--- the following 2 functions are the lowest part.
--- cx: the Kanji code of np
-local function insert_ascii_kanji_xkskip(q, cx)
- if cstb_get_inhibit_xsp_table(cx)<=1 then return end
- local g = node_new(id_glue)
- g.subtype = 0; g.spec = node.copy(xkanji_skip)
- node_insert_after(head, q, g)
+local function insert_ascii_kanji_xkskip(q, p)
+ if cstb_get_inhibit_xsp_table(p.char)<=1 then return end
+ insert_xkanjiskip_node(q, p.font, p)
end
local function insert_kanji_ascii_xkskip(q, p)
if cstb_get_inhibit_xsp_table(nrc)%2 == 0 then g = false end
else g = false
end
- if g then -- 挿入
- g = node_new(id_glue); g.subtype = 0
- if nr_spc[1] or np_spc[1] then
- if xkanji_skip.width==max_dimen then -- use kanjiskip from JFM
- local gx = node_new(id_glue_spec);
- gx.stretch_order = 0; gx.shrink_order = 0
- local ak = get_xkanji_skip_from_jfm(p.font)
- if ak then
- gx.width = ak[1]; gx.stretch = ak[2]; gx.shrink = ak[3]
- else gx = get_zero_glue() -- fallback
- end
- g.spec = gx
- else g.spec=node.copy(xkanji_skip)
- end
- else g.spec = get_zero_glue()
- end
- local h = node_prev(p)
- if h and has_attr(h, attr_icflag)==TEMPORARY then
- if h.id==id_kern then
- g.spec.width = g.spec.width + h.kern
- node.set_attribute(g,attr_icflag,XKANJI_SKIP)
- node_insert_after(head, q, g)
- head = node.remove(head, h)
- else
- h.spec.width = g.spec.width + h.spec.width
- h.spec.stretch = g.spec.stretch + h.spec.stretch
- h.spec.shrink = g.spec.shrink + h.spec.shrink
- end
- else
- node.set_attribute(g,attr_icflag,XKANJI_SKIP)
- node_insert_after(head, q, g)
- end
- end
+ if g then insert_xkanjiskip_node(q, nrf, p) end
end
-
local function set_insert_skip_after_achar(p)
local c = p.char
while p.components and p.subtype
end
end
-local function insert_kanji_skip()
+-- lowest part of \kanjiskip
+local function get_kanji_skip_from_jfm(pf)
+ if pf then
+ local px = { ltj.font_metric_table[pf].size,
+ ltj.font_metric_table[pf].jfm }
+ local i = ltj.metrics[px[2]].kanjiskip
+ if i then
+ return { round(i[1]*px[1]), round(i[2]*px[1]), round(i[3]*px[1]) }
+ else return nil
+ end
+ else return nil
+ end
+end
+
+local function insert_kanji_skip(ope, p)
local g = node_new(id_glue); g.subtype=0
if nr_spc[1] or np_spc[1] then
if kanji_skip.width==max_dimen then -- use kanjiskip from JFM
local gx = node_new(id_glue_spec);
gx.stretch_order = 0; gx.shrink_order = 0
local bk = get_kanji_skip_from_jfm(nrf)
- local ak = get_kanji_skip_from_jfm(np.font)
+ local ak = get_kanji_skip_from_jfm(p.font)
if bk then
if ak then
gx.width = round(ltj.ja_diffmet_rule(bk[1], ak[1]))
end
else g.spec = get_zero_glue()
end
- local h = node_prev(np)
+ local h = node_prev(p)
if h and has_attr(h, attr_icflag)==TEMPORARY then
if h.id==id_kern then
g.spec.width = g.spec.width + h.kern
head = node.remove(head, h)
node.set_attribute(g,attr_icflag,KANJI_SKIP)
- node_insert_before(head, np, g)
+ ope(head, p, g)
else
h.spec.width = g.spec.width + h.spec.width
h.spec.stretch = g.spec.stretch + h.spec.stretch
end
else
node.set_attribute(g,attr_icflag,KANJI_SKIP)
- node_insert_before(head, np, g)
+ ope(head, p, g)
end
end
local function insks_around_char()
if is_japanese_glyph_node(np) then
if insert_skip==after_wchar then
- insert_kanji_skip()
+ insert_kanji_skip(node_insert_before, np)
elseif insert_skip==after_schar then
- insert_ascii_kanji_xkskip(nq, np.char)
+ insert_ascii_kanji_xkskip(nq, np)
end
insert_skip=after_wchar
nrc = np.char; nrf = np.font; nr_spc = np_spc
if is_japanese_glyph_node(first_char) then
nrc = first_char.char; nrf = first_char.font
if insert_skip==after_schar then
- insert_ascii_kanji_xkskip(nq, first_char.char)
+ insert_ascii_kanji_xkskip(nq, first_char)
elseif insert_skip==after_wchar then
np_spc = { has_attr(first_char, attr_autospc)==1,
has_attr(first_char, attr_autoxspc)==1 }
- insert_kanji_skip()
+ insert_kanji_skip(node_insert_before, np)
end
insert_skip = after_wchar
elseif first_char then
-- last char
if is_japanese_glyph_node(last_char) then
if is_japanese_glyph_node(node_next(np)) then
- local g = node_new(id_glue)
- g.subtype = 0; g.spec = node.copy(kanji_skip)
- node_insert_after(head, np, g)
+ insert_kanji_skip(node_insert_after, np)
end
insert_skip = after_wchar
nrc = last_char.char; nrf = last_char.font
ltj.define_jfm {
dir = 'yoko',
zw = 1.0, zh = 1.0,
- kanjiskip = { 0.0, 0.04, 0.05 },
- xkanjiskip = { 0.25, 0.083, 0.083 },
+ kanjiskip = { 0.1, 0.04, 0.05 },
+ xkanjiskip = { 0.31, 0.045, 0.057 },
[0] = {
align = 'left', left = 0.0, down = 0.0,
\bigskip
{\noindent\bf\tengt ■{\tt differentjfm}による挙動の違い}
-\jfont\tenMa={psft:Ryumin-Lightfile:jfm=ujis}
-\jfont\tenMb={psft:Ryumin-Lightfile:jfm=ujis;jfmvar=a}
+\jfont\tenMa={psft:Ryumin-Light:jfm=ujis}
+\jfont\tenMb={psft:Ryumin-Light:jfm=ujis;jfmvar=a}
\jfont\tenGa={psft:GothicBBB-Medium:jfm=ujis} at 15pt
\jfont\tenGb={psft:GothicBBB-Medium:jfm=ujis;jfmvar=a} at 15pt\relax
-This is LuaTeX, Version beta-0.71.0-2011050715 (format=luatex 2011.5.7) 8 MAY 2011 21:45
+This is LuaTeX, Version beta-0.71.0-2011050119 (rev 4235) (format=luatex 2011.5.1) 9 MAY 2011 21:56
restricted \write18 enabled.
**test04-jfm.tex
(./test04-jfm.tex
\ltj@tempcntb=\count282
\ltj@tempcntc=\count283
\ltj@tempdima=\dimen256
-\ltj@autospc=\count284
-\ltj@autoxspc=\count285
-\jcharwidowpenalty=\count286
+\jcharwidowpenalty=\count284
\kanjiskip=\skip256
\xkanjiskip=\skip257
\zw=\dimen257
\ltj@kcat4=\luatexattribute20
\ltj@kcat5=\luatexattribute21
\ltj@kcat6=\luatexattribute22
-\ltj@@stack=\count287
-\ltj@@group@level=\count288
+\ltj@@stack=\count285
+\ltj@@group@level=\count286
plain format: loading luatexja-plain.tex
(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-plain.tex
LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte
x.map): fontmap entry for `bchro8r' already exists, duplicates ignored
}]
-(./jfm-test.lua) [2] [3] [4] [5] )</opt/texlive/p2010/texmf/fonts/truetype/test
-/ipaexg.ttf></opt/texlive/p2010/texmf/fonts/truetype/test/ipamp.ttf></opt/texli
-ve/p2010/texmf/fonts/opentype/test/kozuka/KozMinPr6N-Regular.otf></opt/texlive/
-p2010/texmf/fonts/truetype/test/ipam.ttf></opt/texlive/p2010/texmf-dist/fonts/t
-ype1/public/amsfonts/cm/cmbx10.pfb></opt/texlive/p2010/texmf-dist/fonts/type1/p
-ublic/amsfonts/cm/cmr10.pfb></opt/texlive/p2010/texmf-dist/fonts/type1/public/a
-msfonts/cm/cmti10.pfb></opt/texlive/p2010/texmf-dist/fonts/type1/public/amsfont
-s/cm/cmtt10.pfb>
-Output written on test04-jfm.pdf (5 pages, 463601 bytes).
-PDF statistics: 74 PDF objects out of 1000 (max. 8388607)
- 48 compressed objects within 1 object stream
+(./jfm-test.lua) [2] [3] [4]
+Underfull \vbox (badness 1990) has occurred while \output is active
+\vbox(643.20255+0.0)x469.75499, glue set 2.71211, direction TLT
+.\glue(\topskip) 2.5
+.\hbox(7.5+2.5)x469.75499, glue set 381.78162fil, direction TLT
+..\whatsit
+...\localinterlinepenalty=0
+...\localbrokenpenalty=0
+...\localleftbox=null
+...\localrightbox=null
+..\tenbf [
+..\tenbf x
+..\tenbf ]
+..\tenbf k
+..etc.
+.\glue 6.0 plus 2.0 minus 2.0
+.\penalty -100
+.\glue(\parskip) 0.0 plus 1.0
+.etc.
+
+ [5]
+[6] )</opt/texlive/p2010/texmf/fonts/truetype/test/ipaexg.ttf></opt/texlive/p20
+10/texmf/fonts/truetype/test/ipamp.ttf></opt/texlive/p2010/texmf/fonts/opentype
+/test/kozuka/KozMinPr6N-Regular.otf></opt/texlive/p2010/texmf/fonts/truetype/te
+st/ipam.ttf></opt/texlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx1
+0.pfb></opt/texlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb><
+/opt/texlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/t
+exlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
+Output written on test04-jfm.pdf (6 pages, 483176 bytes).
+PDF statistics: 77 PDF objects out of 1000 (max. 8388607)
+ 50 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 131072)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
\setbox0=\hbox{\rmlh \kern3ptう}\dumplist0
-\head{italic correction}
+\head{JA--hbox (penなし)}
-\setbox0=\hbox{\it f\/(\/あ}\dumplist0
+\setbox0=\hbox{\rmlh あ\hbox{}}\dumplist0
+
+\setbox0=\hbox{\rmlh い\hbox{}}\dumplist0
+
+\setbox0=\hbox{\rmlh う\hbox{}}\dumplist0
+
+\setbox0=\hbox{\rmlh え\hbox{}}\dumplist0
+
+\head{hbox--JA (penなし)}
+
+\setbox0=\hbox{\rmlh \hbox{}あ}\dumplist0
+
+\setbox0=\hbox{\rmlh \hbox{}い}\dumplist0
+
+\setbox0=\hbox{\rmlh \hbox{}う}\dumplist0
+
+\head{JA--penalty (penなし)} TODO: この場合の挙動はこれで良いか?
+
+\setbox0=\hbox{\rmlh あ\penalty567}\dumplist0
+
+\setbox0=\hbox{\rmlh い\penalty567}\dumplist0
+
+\setbox0=\hbox{\rmlh う\penalty567}\dumplist0
+
+\setbox0=\hbox{\rmlh え\penalty567}\dumplist0
+
+\head{penalty--JA (penなし)} TODO: この場合の挙動はこれで良いか?
+
+\setbox0=\hbox{\rmlh \penalty567あ}\dumplist0
+\setbox0=\hbox{\rmlh \penalty567い}\dumplist0
+
+\setbox0=\hbox{\rmlh \penalty567う}\dumplist0
{\vfill\eject%
}
\vfill\eject
-\kanjiskip=\maxdimen
-\message{SSS}
-\setbox0=\hbox{\rmlh \ltjsetparameter{autospacing=true}ンン\ltjsetparameter{autospacing=false}ンン}\message{SSS}
-\dumplist0
+\noindent{\gt\bf [x]kanjiskipの挿入}
+
+\head{kanjiskip from JFM, autospacing (JA--JA)}
+\setbox0=\hbox{あ\rmlh あ}\dumplist0
+
+{\kanjiskip=\maxdimen
+\setbox0=\hbox{あ\rmlh あ}\dumplist0
+\jfont\rmlk={psft:Ryumin-Light:jfm=test} at 12pt
+\setbox0=\hbox{\rmlk は\rmlh あ}\dumplist0}
+
+\def\naspc{\ltjsetparameter{autospacing=false}\relax}
+\def\naxspc{\ltjsetparameter{autoxspacing=false}\relax}
+\setbox0=\hbox{あ\naspc ああ}\dumplist0
+
+\head{kanjiskip from JFM/autoxspacing (JA--EN)}
+\setbox0=\hbox{\rmlh まx}\dumplist0
+
+\setbox0=\hbox{\rmlh ま\naxspc x}\dumplist0
+
+\setbox0=\hbox{\naxspc\rmlh まx}\dumplist0
+
+{\xkanjiskip=\maxdimen\setbox0=\hbox{\rmlh まx}\dumplist0}
+
+{\ltjsetparameter{jaxspmode={`ま,preonly}}
+\setbox0=\hbox{\rmlh まx}\dumplist0}
+{\ltjsetparameter{alxspmode={`x,postonly}}
+\setbox0=\hbox{\rmlh まx}\dumplist0}
+
+
+\head{kanjiskip from JFM/autoxspacing (EN--JA)}
+\setbox0=\hbox{\rmlh xま}\dumplist0
+
+\setbox0=\hbox{\rmlh x\naxspc ま}\dumplist0
+
+\setbox0=\hbox{\naxspc\rmlh xま}\dumplist0
+
+{\xkanjiskip=\maxdimen\setbox0=\hbox{\rmlh xま}\dumplist0}
+
+{\ltjsetparameter{jaxspmode={`ま,postonly}}
+\setbox0=\hbox{\rmlh xま}\dumplist0}
+{\ltjsetparameter{alxspmode={`x,inhibit}}
+\setbox0=\hbox{\rmlh xまおx}\dumplist0}
\end