From: Hironori Kitagawa Date: Wed, 11 May 2011 01:40:17 +0000 (+0900) Subject: Fixed bug #25121 (I hope) and check_box. X-Git-Tag: master-20110808~9 X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=d8c894d779cacc0a30982ff081b9547bc9f06237;p=luatex-ja%2Fluatexja.git Fixed bug #25121 (I hope) and check_box. --- diff --git a/doc/s1sty.tex b/doc/s1sty.tex index 2591395..e93642f 100644 --- a/doc/s1sty.tex +++ b/doc/s1sty.tex @@ -40,22 +40,24 @@ \let\it=\twelveit \let\sl=\twelvesl \let\mus=\twelvemus \let\sc=\twelvesc \let\tt=\twelvett \let\mc=\twelvemc \let\gt=\twelvegt - \baselineskip=18pt\rm\mc\xkanjiskip=0.25\zw plus 0.10\zw minus 0.10\zw} + \baselineskip=18pt\rm\mc + \ltjsetparameter{xkanjiskip={0.25\zw plus 0.10\zw minus 0.10\zw}}} -\def\big{\bigbf\biggt\xkanjiskip=0.25\zw plus 0.10\zw minus 0.10\zw} +\def\big{\bigbf\biggt\ltjsetparameter{xkanjiskip={0.25\zw plus 0.10\zw minus 0.10\zw}}} \def\normalsize{\def\rm{\textfont0=\tenrm\tenrm\fam0\let\sx=\sevenrm}% \def\bf{\tenbf\gt\let\sx=\sevenbf}% \let\it=\tenit \let\sl=\tensl \let\mus=\tenmus \let\sc=\tensc \def\tt{\tentt\tenjtt}% \let\mc=\tenmc \let\gt=\tengt - \baselineskip=15pt\rm\mc\xkanjiskip=0.25\zw plus 1pt minus 1pt} + \baselineskip=15pt\rm\mc + \ltjsetparameter{xkanjiskip=0.25\zw plus 1pt minus 1pt}} \def\small{\def\rm{\textfont0=\eightrm\eightrm\fam0}\def\bf{\eightbf\gt}% \let\it=\eightit \let\sl=\eightsl \let\mus=\eightmus \let\sc=\eightsc \def\tt{\eighttt\eightjtt}% \let\mc=\eightmc \let\gt=\eightgt% - \rm\mc\xkanjiskip=0.25\zw plus 1pt minus 1pt% - \ltjsetparameter{yjabaselineshift=-0.76pt, yalbaselineshift=-0.76pt} + \rm\mc\ltjsetparameter{xkanjiskip={0.25\zw plus 1pt minus 1pt}, + yjabaselineshift=-0.76pt, yalbaselineshift=-0.76pt} } @@ -80,7 +82,7 @@ \newbox\vspbox \setbox\vspbox=\hbox{\tt\char32} {\catcode`\ =\active\catcode`\_=\active%\catcode`\%=\active -\gdef\ttverbatim{\begingroup\xkanjiskip=0pt +\gdef\ttverbatim{\begingroup\ltjsetparameter{xkanjiskip=0pt} \catcode`\ =\active\let =~\catcode`\%=\other \catcode`\\=\other\catcode`\{=\other\catcode`\}=\other \catcode`\$=\other\catcode`\&=\other\catcode`\#=\other\catcode`\~=\other diff --git a/doc/sample1.log b/doc/sample1.log index c107621..873eedc 100644 --- a/doc/sample1.log +++ b/doc/sample1.log @@ -1,4 +1,4 @@ -This is LuaTeX, Version beta-0.71.0-2011050119 (rev 4235) (format=luatex 2011.5.1) 9 MAY 2011 22:29 +This is LuaTeX, Version beta-0.71.0-2011050119 (rev 4235) (format=luatex 2011.5.1) 11 MAY 2011 10:33 restricted \write18 enabled. **sample1 (./sample1.tex (./s1sty.tex @@ -175,9 +175,7 @@ Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO) \ltj@tempcntb=\count282 \ltj@tempcntc=\count283 \ltj@tempdima=\dimen256 -\jcharwidowpenalty=\count284 -\kanjiskip=\skip256 -\xkanjiskip=\skip257 +\ltj@tempskipa=\skip256 \zw=\dimen257 \zh=\dimen258 \jQ=\dimen259 @@ -200,6 +198,8 @@ Module luatexbase-mcb info: inserting 'ltj.process_input_buffer' (luatexbase-mcb) at position 1 in 'process_input_buffer' Module luatexbase-mcb info: inserting 'ltj.hpack_filter_pre' (luatexbase-mcb) at position 1 in 'hpack_filter' +Module luatexbase-mcb info: inserting 'ltj.pre_linebreak_filter_pre' +(luatexbase-mcb) at position 1 in 'pre_linebreak_filter' Module luatexbase-mcb info: inserting 'ltj.hyphenate' (luatexbase-mcb) at position 1 in 'hyphenate' Module luatexbase-mcb info: inserting 'ltj.pre_linebreak_filter' @@ -215,8 +215,8 @@ Module luatexbase-mcb info: inserting 'ltj.hpack_filter' \ltj@kcat4=\luatexattribute20 \ltj@kcat5=\luatexattribute21 \ltj@kcat6=\luatexattribute22 -\ltj@@stack=\count285 -\ltj@@group@level=\count286 +\ltj@@stack=\count284 +\ltj@@group@level=\count285 plain format: loading luatexja-plain.tex (/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-plain.tex @@ -224,7 +224,7 @@ plain format: loading 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=\count287 +\enumi=\count286 ) 特徴 制限 ファイル構成 [1{/opt/texlive/p2010/texmf-var/fonts/map/pdftex/updm ap/pdftex.map @@ -245,9 +245,9 @@ x.map): fontmap entry for `bchri8r' already exists, duplicates ignored LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte x.map): fontmap entry for `bchro8r' already exists, duplicates ignored -}] 使用方法 和文フォントの定義 [2] -「和文文字の範囲」の設定 組版パラメタの調整 [3] -Overfull \hbox (2.29878pt too wide) in paragraph at lines 220--225 +}] 使用方法 和文フォントの定義 +「和文文字の範囲」の設定 [2] 組版パラメタの調整 [3] +Overfull \hbox (2.29878pt too wide) in paragraph at lines 218--223 [] []\tentt yjabaselineshift=$\tensy h$\tenit di-men$\tensy i$\tenrm : \tenmin 和 文 文 字 の ベ ー ス ラ イ ン 補 正 量 を \tenrm di-men-sion \tenmin で 指 定 す る [] \tenrm pT[]X @@ -269,6 +269,24 @@ Overfull \hbox (2.29878pt too wide) in paragraph at lines 220--225 .\tentt y .etc. + +Overfull \hbox (7.2025pt too wide) in paragraph at lines 246--249 + []\tenmin 和 文 文 字 と 欧 文 文 字 の 間 に 入 る 空 白 量 +[] \tenrm pT[]X \tenmin の 同 名 の 命 令 と 同 様 [] こ れ も [] +自 然 長 が\tentt \maxdimen + +\hbox(8.45029+2.15277)x412.9118, glue set - 1.0, direction TLT +.\glue(\leftskip) 19.2052 +.\whatsit +..\localinterlinepenalty=0 +..\localbrokenpenalty=0 +..\localleftbox=null +..\localrightbox=null +.\tenmin 和 +.\glue 0.0 plus 0.4 minus 0.4 +.\tenmin 文 +.etc. + [4] 組版パラメタの取得 その他の命令 [5] JFMについて [6] 大まかな処理の流れ [7] [8] [9] 名称について 表記法 読み方 機能 [10] 数式の表示例 生い立ち @@ -290,7 +308,7 @@ opt/texlive/p2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb> -Output written on sample1.pdf (13 pages, 225588 bytes). +Output written on sample1.pdf (13 pages, 224676 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) diff --git a/doc/sample1.pdf b/doc/sample1.pdf index 4bac814..915f098 100644 Binary files a/doc/sample1.pdf and b/doc/sample1.pdf differ diff --git a/doc/sample1.tex b/doc/sample1.tex index 2447e81..0aa9592 100644 --- a/doc/sample1.tex +++ b/doc/sample1.tex @@ -49,8 +49,6 @@ \itemitem |\showmode|, |\jfam|. \itemitem 縦組み関連一式.|\tate|, |\tfont|, |\tbaselineshift|, |\dtou|,$\,\ldots$ -\item 和文間・和欧文間空白の自動挿入がglobalでしかできていません. -←解決はさほど難しくないので,仕様を決定した後に書き上げます. \enditem @@ -199,17 +197,17 @@ p\TeX では,同一文字に対して|\prebreakpenalty|, |\postbreakpenalty| \item |jaxspmode={, }|★\par\noindent p\TeX の|\inhibitxspcode|に対応した設定項目である.で許される値は, -\itemitem |0|, |inhibit|: 前後の欧文文字との間の|\xkanjiskip|自動挿入を禁止. -\itemitem |2|, |preonly|: 前の欧文文字との間の|\xkanjiskip|自動挿入のみを許可. -\itemitem |1|, |postonly|: 後の欧文文字との間の|\xkanjiskip|自動挿入のみを許可. -\itemitem |3|, |allow|: 前後の欧文文字との間の|\xkanjiskip|自動挿入を許可. +\itemitem |0|, |inhibit|: 前後の欧文文字との間の|xkanjiskip|自動挿入を禁止. +\itemitem |2|, |preonly|: 前の欧文文字との間の|xkanjiskip|自動挿入のみを許可. +\itemitem |1|, |postonly|: 後の欧文文字との間の|xkanjiskip|自動挿入のみを許可. +\itemitem |3|, |allow|: 前後の欧文文字との間の|xkanjiskip|自動挿入を許可. \item |alxspmode={, }|★\par\noindent 同様に,p\TeX の|\xspcode|に対応した設定項目である. で許される値は, -\itemitem |0|, |inhibit|: 前後の和文文字との間の|\xkanjiskip|自動挿入を禁止. -\itemitem |1|, |preonly|: 前の和文文字との間の|\xkanjiskip|自動挿入のみを許可. -\itemitem |2|, |postonly|: 後の和文文字との間の|\xkanjiskip|自動挿入のみを許可. -\itemitem |3|, |allow|: 前後の和文文字との間の|\xkanjiskip|自動挿入を許可. +\itemitem |0|, |inhibit|: 前後の和文文字との間の|xkanjiskip|自動挿入を禁止. +\itemitem |1|, |preonly|: 前の和文文字との間の|xkanjiskip|自動挿入のみを許可. +\itemitem |2|, |postonly|: 後の和文文字との間の|xkanjiskip|自動挿入のみを許可. +\itemitem |3|, |allow|: 前後の和文文字との間の|xkanjiskip|自動挿入を許可. \item |yalbaselineshift=|: p\TeX の|\ybaselineshift|に対応したものであり, @@ -226,12 +224,38 @@ p\TeX では「和文が主」という考えからか,常に和文文字の また,この値を適切に調整することで,% {\small 異なる文字サイズの文字を「上下中央揃え」で組む}ことも可能である. -\item |kanjiskip=|★\inhibitglue: 後に述べる|\kanjiskip=|と同じ意味. -\item |xkanjiskip=|★\inhibitglue: 後に述べる|\xkanjiskip=|と同じ意味. -\item |jcharwidowpenalty=|★\inhibitglue: -後に述べる|\jcharwidowpenalty=|と同じ意味. +\item |kanjiskip=|★\par\noindent +和文文字同士の間に入る空白量を指定.p\TeX の同名の命令と同様に, +基本的には段落/hbox終了時の値が,その段落/hbox全体に適用される. つまり, +\begintt +\ltjsetparameter{kanjiskip=3pt}あい% +{\ltjsetparameter{kanjiskip=10pt}うえ}} +\endtt +の組版結果は(段落終了時の値が$3\,{\rm pt}$のため), +$$ + \hbox{\ltjsetparameter{kanjiskip=3pt}あい{\ltjsetparameter{kanjiskip=10pt}うえ}} +$$ +となる. + +但し,|kanjiskip|の自然長が$\hbox{|\maxdimen|}=16383.99998\,{\rm pt}$の場合は, +\itemitem (和文文字の間それぞれについて)JFMに指定されている +|kanjiskip|の値を採用する. +\itemitem 左側JFM,右側JFMのどちらかにおいて指定されていれば,そちらを使用する. +\itemitem どちらにおいても指定されていない場合は,0とみなす. + +\item |xkanjiskip=|★\par\noindent +和文文字と欧文文字の間に入る空白量.p\TeX の同名の命令と同様. +これも,自然長が|\maxdimen|の場合は,JFMで指定された値を使う. + + +\item |jcharwidowpenalty=|★\par\noindent +段落において「最後の1文字のみが次の行に」くることを +抑制するためのpenalty値.このpenaltyは,段落内にある,最後の「|kcatcode|の最下位bitが +1で{\bf ない}ような和文文字」の直前に挿入される. + + \item |autospacing[=]|\par\noindent -和文文字間のglue(|\kanjiskip|)の自動挿入をするかしないかを制御. +和文文字間のglue(|kanjiskip|)の自動挿入をするかしないかを制御. p\TeX では段落/hbox 単位での設定となったが,Lua\TeX-ja では そうではなくなった. 挿入可能な箇所の両端のノードにおいて,片方でも @@ -239,9 +263,9 @@ p\TeX では段落/hbox 単位での設定となったが,Lua\TeX-ja では \begintt あ\ltjsetparameter{autospacing=false}いう \endtt -の場合,「あい」の間には|\kanjiskip|が挿入され,「いう」の間には入らない. +の場合,「あい」の間には|kanjiskip|が挿入され,「いう」の間には入らない. \item |autoxspacing[=]|\par\noindent -和欧文間のglue(|\xkanjiskip|)の自動挿入をするかしないかを制御. +和欧文間のglue(|xkanjiskip|)の自動挿入をするかしないかを制御. その他は|autospacing|と同様. \item |differentjfm=(large/small/average/both)|★◎\par\noindent @@ -252,7 +276,7 @@ glue/kernの計算方法を設定する. \itemitem {\tt small}: 両者のうち小さい方. \itemitem {\tt average}: 両者の相加平均. \itemitem {\tt both}: 両者の合計値の幅をもつglue/kernを挿入する. -この指定は,JFM由来の|\kanjiskip|の値が左右の和文文字で異なったときの +この指定は,JFM由来の|kanjiskip|の値が左右の和文文字で異なったときの 挙動にも適用される. \item |jacharrange={,,...}|: @@ -297,25 +321,6 @@ $n\notin [1,216]$の場合は,「どの文字範囲にも属さない|U+0080| \beginparagraph その他の命令 -\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 ない}ような和文文字」の直前に挿入される. - \item dimen |\zw|, |\zh|: 現在の和文フォントの「幅」/「高さ」(メトリックから指定) \item dimen |\jQ|, |\jH|${}= 0.25\,{\rm mm}$. \item |\inhibitglue|: @@ -492,12 +497,12 @@ $$ \itemT |\kern| $k$: 本来の$Q$と$P$の間に入る空き(glueであることも). $w$のために自然長を補正している. -\item {\bf |\kanjiskip|, |\xkanjiskip|の挿入: |pre_linebreak_filter|, |hpack_filter|} +\item {\bf |kanjiskip|, |xkanjiskip|の挿入: |pre_linebreak_filter|, |hpack_filter|} p\TeX の|adjust_hlist| procedureとほぼ同様の処理を用いて, -和文間glue |\kanjiskip|や和欧文間glue |\xkanjiskip|を +和文間glue |kanjiskip|や和欧文間glue |xkanjiskip|を 挿入する. -\itemitem 数式境界 (|math_node|) との間に|\xkanjiskip|を自動挿入するかの決定は, +\itemitem 数式境界 (|math_node|) との間に|xkanjiskip|を自動挿入するかの決定は, p\TeX では数字{\tt 0}との間に挿入するかどうかで判定していたが,Lua\TeX-jaでは 「文字コード$-1$の文字」で判定している. \itemitem 合字の周囲の空白挿入については,構成要素の文字列を通じて判断している.例えば, diff --git a/src/luatexja-core.lua b/src/luatexja-core.lua index cb09476..c22b32e 100644 --- a/src/luatexja-core.lua +++ b/src/luatexja-core.lua @@ -18,13 +18,13 @@ local id_vlist = node.id('vlist') local id_rule = node.id('rule') local id_math = node.id('math') local id_whatsit = node.id('whatsit') +local sid_user = node.subtype('user_defined') local attr_jchar_class = luatexbase.attributes['ltj@charclass'] local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] local attr_yablshift = luatexbase.attributes['ltj@yablshift'] local attr_ykblshift = luatexbase.attributes['ltj@ykblshift'] local attr_icflag = luatexbase.attributes['ltj@icflag'] --- attr_icflag: 1: kern from \/, 2: 'lineend' kern from JFM local lang_ja_token = token.create('ltj@japanese') local lang_ja = lang_ja_token[2] @@ -43,6 +43,7 @@ local KINSOKU = 4 local LINE_END = 5 local KANJI_SKIP = 6 local XKANJI_SKIP = 7 +local PACKED = 8 ------------------------------------------------------------------------ -- naming: @@ -115,56 +116,84 @@ function math.two_average(a,b) return (a+b)/2 end local charprop_stack_table={}; charprop_stack_table[0]={} local function cstb_get_stack_level() - local i = tex.getcount('ltj@@stack') - if tex.currentgrouplevel > tex.getcount('ltj@@group@level') then - i = i+1 -- new stack level - tex.setcount('ltj@@group@level', tex.currentgrouplevel) - for j,v in pairs(charprop_stack_table) do -- clear the stack above i - if j>=i then charprop_stack_table[j]=nil end - end - charprop_stack_table[i] = table.fastcopy(charprop_stack_table[i-1]) - tex.setcount('ltj@@stack', i) - end - return i + local i = tex.getcount('ltj@@stack') + local j = tex.currentgrouplevel + if j > tex.getcount('ltj@@group@level') then + i = i+1 -- new stack level + tex.setcount('ltj@@group@level', j) + for k,v in pairs(charprop_stack_table) do -- clear the stack above i + if k>=i then charprop_stack_table[k]=nil end + end + charprop_stack_table[i] = table.fastcopy(charprop_stack_table[i-1]) + tex.setcount('ltj@@stack', i) + local g = node_new(id_whatsit, sid_user) + g.user_id=30112; g.type=100; g.value=j; node.write(g) + end + return i end -- EXT function ltj.ext_set_stack_table(g,m,c,p,lb,ub) + local i = cstb_get_stack_level() + if pub then + ltj.error('Invalid code (' .. p .. '), should in the range ' + .. tostring(lb) .. '..' .. tostring(ub) .. '.', + {"I'm going to use 0 instead of that illegal code value."}) + p=0 + elseif c<-1 or c>0x10FFFF then + ltj.error('Invalid character code (' .. c + .. '), should in the range -1.."10FFFF.',{}) + return + elseif not charprop_stack_table[i][c] then + charprop_stack_table[i][c] = {} + end + charprop_stack_table[i][c][m] = p + if g=='global' then + for j,v in pairs(charprop_stack_table) do + if not charprop_stack_table[j][c] then charprop_stack_table[j][c] = {} end + charprop_stack_table[j][c][m] = p + end + end +end + +-- EXT: store \ltj@tempskipa +function ltj.ext_set_stack_skip(g,c) local i = cstb_get_stack_level() - if pub then - ltj.error('Invalid code (' .. p .. '), should in the range ' - .. tostring(lb) .. '..' .. tostring(ub) .. '.', - {"I'm going to use 0 instead of that illegal code value."}) - p=0 - elseif c<-1 or c>0x10FFFF then - ltj.error('Invalid character code (' .. c - .. '), should in the range -1.."10FFFF.',{}) - return - elseif not charprop_stack_table[i][c] then + local sp = tex.getskip('ltj@tempskipa') + if not charprop_stack_table[i][c] then charprop_stack_table[i][c] = {} end - charprop_stack_table[i][c][m] = p + charprop_stack_table[i][c].width = sp.width + charprop_stack_table[i][c].stretch = sp.stretch + charprop_stack_table[i][c].shrink = sp.shrink + charprop_stack_table[i][c].stretch_order = sp.stretch_order + charprop_stack_table[i][c].shrink_order = sp.shrink_order if g=='global' then - for j,v in pairs(charprop_stack_table) do - if not charprop_stack_table[j][c] then charprop_stack_table[j][c] = {} end - charprop_stack_table[j][c][m] = p - end + for j,v in pairs(charprop_stack_table) do + if not charprop_stack_table[j][c] then charprop_stack_table[j][c] = {} end + charprop_stack_table[j][c].width = sp.width + charprop_stack_table[j][c].stretch = sp.stretch + charprop_stack_table[j][c].shrink = sp.shrink + charprop_stack_table[j][c].stretch_order = sp.stretch_order + charprop_stack_table[j][c].shrink_order = sp.shrink_order + end end end -local function cstb_get_penalty_table(m,c) - local i = charprop_stack_table[tex.getcount('ltj@@stack')][c] - if i then i=i[m] end - return i or 0 +-- mode: nil iff it is called in callbacks +local function cstb_get_skip_table(m, idx) + local i = charprop_stack_table[idx][m] + return i or { width = 0, stretch = 0, shrink = 0, + stretch_order = 0, shrink_order = 0 } end -ltj.int_get_penalty_table = cstb_get_penalty_table +ltj.int_get_skip_table = cstb_get_skip_table -local function cstb_get_inhibit_xsp_table(c) - local i = charprop_stack_table[tex.getcount('ltj@@stack')][c] - if i then i=i.xsp end - return i or 3 +local function cstb_get_penalty_table(m,c,d, idx) + local i = charprop_stack_table[idx][c] + if i then i=i[m] end + return i or d end -ltj.int_get_inhibit_xsp_table = cstb_get_inhibit_xsp_table +ltj.int_get_penalty_table = cstb_get_penalty_table ------------------------------------------------------------------------ -- CODE FOR GETTING/SETTING PARAMETERS @@ -177,11 +206,11 @@ function ltj.ext_get_parameter_unary(k) elseif k == 'yjabaselineshift' then tex.write(print_scaled(tex.getattribute('ltj@ykblshift'))..'pt') elseif k == 'kanjiskip' then - tex.write(print_spec(tex.getskip('kanjiskip'))) + tex.write(print_spec(cstb_get_skip_table('kanjiskip', tex.getcount('ltj@@stack')))) elseif k == 'xkanjiskip' then - tex.write(print_spec(tex.getskip('xkanjiskip'))) + tex.write(print_spec(cstb_get_skip_table('xkanjiskip', tex.getcount('ltj@@stack')))) elseif k == 'jcharwidowpenalty' then - tex.write(tex.getcount('jcharwidowpenalty')) + tex.write(cstb_get_penalty_table('jwp', 0, 0, tex.getcount('ltj@@stack'))) elseif k == 'autospacing' then tex.write(tex.getattribute('ltj@autospc')) elseif k == 'autoxspacing' then @@ -214,11 +243,11 @@ function ltj.ext_get_parameter_binary(k,c) c=0 end if k == 'prebreakpenalty' then - tex.write(cstb_get_penalty_table('pre',c)) + tex.write(cstb_get_penalty_table('pre', c, 0, tex.getcount('ltj@@stack'))) elseif k == 'postbreakpenalty' then - tex.write(cstb_get_penalty_table('post',c)) + tex.write(cstb_get_penalty_table('post', c, 0, tex.getcount('ltj@@stack'))) elseif k == 'kcatcode' then - tex.write(cstb_get_penalty_table('kcat',c)) + tex.write(cstb_get_penalty_table('kcat', c, 0, tex.getcount('ltj@@stack'))) elseif k == 'chartorange' then tex.write(rgjc_char_to_range(c)) elseif k == 'jaxspmode' or k == 'alxspmode' then @@ -236,6 +265,8 @@ end ------------------------------------------------------------------------ -- MAIN PROCESS STEP 1: replace fonts (prefix: main1) ------------------------------------------------------------------------ +ltj.box_stack_level = 0 +-- This is used in Step 2 (JFM glue/kern) and Step 3 (\[x]kanjiskip). --- the following function is modified from jafontspec.lua (by K. Maeda). --- Instead of "%", we use U+FFFFF for suppressing spaces. @@ -250,40 +281,63 @@ local function main1_process_input_buffer(buffer) return buffer end + local function main1_suppress_hyphenate_ja(head) - local p - for p in node.traverse(head) do - if p.id == id_glyph then - if rgjc_is_ucs_in_japanese_char(p) then - local v = has_attr(p, attr_curjfnt) - if v then - p.font = v - node.set_attribute(p,attr_jchar_class, - ljfm_find_char_class(p.char, ltj.font_metric_table[v].jfm)) - end - v = has_attr(p, attr_ykblshift) - if v then - node.set_attribute(p, attr_yablshift, v) - else - node.unset_attribute(p, attr_yablshift) - end - p.lang=lang_ja + for p in node.traverse_id(id_glyph, head) do + if rgjc_is_ucs_in_japanese_char(p) then + local v = has_attr(p, attr_curjfnt) + if v then + p.font = v + node.set_attribute(p, attr_jchar_class, + ljfm_find_char_class(p.char, ltj.font_metric_table[v].jfm)) + end + v = has_attr(p, attr_ykblshift) + if v then + node.set_attribute(p, attr_yablshift, v) + else + node.unset_attribute(p, attr_yablshift) end + p.lang=lang_ja end end lang.hyphenate(head) return head end +-- mode: true iff this function is called from hpack_filter +local function main1_set_box_stack_level(head, mode) + local box_set = false + local p = head + local cl = tex.currentgrouplevel + 1 + while p do + if p.id==id_whatsit and p.subtype==sid_user and p.user_id==30112 then + local g = p; + if mode and g.value==cl then box_set = true end + head, p = node.remove(head, g) + else p = node_next(p) + end + end + if box_set then + ltj.box_stack_level = tex.getcount('ltj@@stack') + 1 + else + ltj.box_stack_level = tex.getcount('ltj@@stack') + end + return head +end + -- CALLBACKS luatexbase.add_to_callback('process_input_buffer', function (buffer) return main1_process_input_buffer(buffer) end,'ltj.process_input_buffer') luatexbase.add_to_callback('hpack_filter', - function (head,groupcode,size,packtype) - return main1_suppress_hyphenate_ja(head) - end,'ltj.hpack_filter_pre',0) + function (head) + return main1_set_box_stack_level(head, true) + end,'ltj.hpack_filter_pre',1) +luatexbase.add_to_callback('pre_linebreak_filter', + function (head) + return main1_set_box_stack_level(head, false) + end,'ltj.pre_linebreak_filter_pre',1) luatexbase.add_to_callback('hyphenate', function (head,tail) return main1_suppress_hyphenate_ja(head) @@ -336,6 +390,7 @@ local function main4_set_ja_width(head) 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) + node.set_attribute(g, attr_icflag, PACKED) if q then head = node_insert_before(head, q, g) else @@ -421,8 +476,6 @@ function debug_show_node_X(p,print_fn) 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) @@ -455,6 +508,14 @@ function debug_show_node_X(p,print_fn) s = s .. ' (for kinsoku)' end print_fn(s) + elseif pt == 'whatsit' then + s = debug_depth.. ' whatsit ' .. tostring(p.subtype) + if p.subtype==sid_user then + s = s .. ' user_id: ' .. p.user_id .. ' ' .. p.value + else + s = s .. node.subtype(p.subtype) + end + print_fn(s) else print_fn(debug_depth.. ' ' .. node.type(p.id), p.subtype) end diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index 6ad407c..c6b3084 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -14,11 +14,8 @@ \newcount\ltj@tempcntb \newcount\ltj@tempcntc \newdimen\ltj@tempdima +\newskip\ltj@tempskipa - -\newcount\jcharwidowpenalty -\newskip\kanjiskip -\newskip\xkanjiskip \newdimen\zw \newdimen\zh \newdimen\jQ \jQ=0.25mm @@ -175,11 +172,15 @@ \fi} \define@key[ltj]{japaram}{kanjiskip}{% % SKIP - \directlua{ltj.ext_print_global()}\kanjiskip=#1 } -\define@key[ltj]{japaram}{xkanjiskip}{% % SKIP - \directlua{ltj.ext_print_global()}\xkanjiskip=#1 } + \ltj@tempskipa=#1\relax + \directlua{ltj.ext_set_stack_skip(ltj.isglobal, 'kanjiskip')}} +\define@key[ltj]{japaram}{xkanjiskip}{% % SKIP + \ltj@tempskipa=#1\relax + \directlua{ltj.ext_set_stack_skip(ltj.isglobal, 'xkanjiskip')}} \define@key[ltj]{japaram}{jcharwidowpenalty}{% %COUNT - \directlua{ltj.ext_print_global()}\jcharwidowpenalty=#1 } + \ltj@tempcnta=#1 + \directlua{ltj.ext_set_stack_table(ltj.isglobal, 'jwp', 0, + \the\ltj@tempcnta, -10000, 10000)}} % differentjfm = { large | small | average | both } \define@choicekey*+[ltj]{japaram}{differentjfm}[\ltj@temp\ltj@tempr]% diff --git a/src/luatexja-jfmglue.lua b/src/luatexja-jfmglue.lua index c8c9d89..abc7583 100644 --- a/src/luatexja-jfmglue.lua +++ b/src/luatexja-jfmglue.lua @@ -60,7 +60,7 @@ end -- EXT: for \inhibitglue function ltj.ext_create_inhibitglue_node() local g=node_new(id_whatsit, sid_user) - g.user_id=30111; g.type=number; g.value=1; node.write(g) + g.user_id=30111; g.type=100; g.value=1; node.write(g) end -- In the beginning of a hlist created by line breaking, there are the followings: @@ -147,9 +147,9 @@ local function ins_gk_head() node.set_attribute(g, attr_icflag, FROM_JFM) head = node_insert_before(head, p, g) end - q_post = cstb_get_penalty_table('post',p.char); chain = true + q_post = cstb_get_penalty_table('post', p.char, 0, ltj.box_stack_level); chain = true elseif p.id==id_glyph then - q_post = cstb_get_penalty_table('post',p.char) + q_post = cstb_get_penalty_table('post', p.char, 0, ltj.box_stack_level) end qs = ps; q = p; p = node_next(p) end @@ -267,7 +267,7 @@ local function ins_gk_any_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 - q_post = add_penalty(q_post, cstb_get_penalty_table('pre', p.char)) + q_post = add_penalty(q_post, cstb_get_penalty_table('pre', p.char, 0, ltj.box_stack_level)) real_insert(g, w, q_post, false) elseif q.id==id_glyph then -- (q,p): AL-JA local g = nil @@ -276,7 +276,7 @@ local function ins_gk_any_JA() ljfm_find_char_class('jcharbdd',ps[2]), has_attr(p,attr_jchar_class)) end - q_post = add_penalty(q_post, cstb_get_penalty_table('pre', p.char)) + q_post = add_penalty(q_post, cstb_get_penalty_table('pre', p.char, 0, ltj.box_stack_level)) real_insert(g, 0, q_post, true) elseif q.id==id_kern then -- (q,p): kern-JA local g = nil @@ -295,8 +295,8 @@ local function ins_gk_any_JA() end real_insert(g, 0, q_post, true) end - q, qs, q_post = p, ps, cstb_get_penalty_table('post',p.char) - if cstb_get_penalty_table('kcat',p.char)%2~=1 then + q, qs, q_post = p, ps, cstb_get_penalty_table('post', p.char, 0, ltj.box_stack_level) + if cstb_get_penalty_table('kcat', p.char, 0, ltj.box_stack_level)%2~=1 then widow_node = p end p = node_next(p); chain = true @@ -316,7 +316,7 @@ local function ins_gk_JA_any() 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 - q_post = add_penalty(q_post, cstb_get_penalty_table('pre',p.char)) + q_post = add_penalty(q_post, cstb_get_penalty_table('pre', p.char, 0, ltj.box_stack_level)) real_insert(g, w, q_post, true) elseif p.id==id_kern then -- (q,p): JA-kern real_insert_kern(g) @@ -359,7 +359,7 @@ local function add_widow_penalty() if not widow_node then return end local a = node_prev(widow_node) local i = has_attr(a, attr_icflag) or 0 - local wp = tex.getcount('jcharwidowpenalty') + local wp = cstb_get_penalty_table('jwp', 0, 0, ltj.box_stack_level) if i==4 then a.penalty=add_penalty(a.penalty, wp) elseif i>=2 then @@ -394,7 +394,6 @@ function ltj.int_insert_jfm_glue(ahead, amode) local g = p; p = node_next(p); ihb_flag = true; head, p = node.remove(head, g) end if p~=last then ins_gk_head() else finishing() return head end - while p~=last do if p.id==id_whatsit and p.subtype==sid_user and p.user_id==30111 then local g = p; p = node_next(p) diff --git a/src/luatexja-jfont.lua b/src/luatexja-jfont.lua index 2949745..0960740 100644 --- a/src/luatexja-jfont.lua +++ b/src/luatexja-jfont.lua @@ -247,7 +247,6 @@ function ltj.ext_append_italic() 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 @@ -260,4 +259,4 @@ function ltj.ext_append_italic() end node.write(g) end -end \ No newline at end of file +end diff --git a/src/luatexja-xkanji.lua b/src/luatexja-xkanji.lua index e3be6bb..6966f48 100644 --- a/src/luatexja-xkanji.lua +++ b/src/luatexja-xkanji.lua @@ -38,6 +38,7 @@ local KINSOKU = 4 local LINE_END = 5 local KANJI_SKIP = 6 local XKANJI_SKIP = 7 +local PACKED = 8 local kanji_skip local xkanji_skip @@ -51,13 +52,15 @@ local after_wchar = 2 -- nr is a Japanese glyph_node local insert_skip = no_skip local head -local cstb_get_inhibit_xsp_table = ltj.int_get_inhibit_xsp_table +local cstb_get_penalty_table = ltj.int_get_penalty_table +local cstb_get_skip_table = ltj.int_get_skip_table local function is_japanese_glyph_node(p) return p and (p.id==id_glyph) and (p.font==has_attr(p,attr_curjfnt)) end + local function get_zero_glue() local g = node_new(id_glue_spec) g.width = 0; g.stretch_order = 0; g.stretch = 0 @@ -65,6 +68,14 @@ local function get_zero_glue() return g end +local function skip_table_to_spec(n) + local g = node_new(id_glue_spec) + local st = cstb_get_skip_table(n, ltj.box_stack_level) + g.width = st.width; g.stretch = st.stretch; g.shrink = st.shrink + g.stretch_order = st.stretch_order; g.shrink_order = st.shrink_order + return g +end + -- lowest part of \xkanjiskip local function get_xkanji_skip_from_jfm(pf) if pf then @@ -83,7 +94,7 @@ 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); + 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 @@ -91,7 +102,7 @@ local function insert_xkanjiskip_node(q, f, p) else gx = get_zero_glue() -- fallback end g.spec = gx - else g.spec=node.copy(xkanji_skip) + else g.spec=node_copy(xkanji_skip) end else g.spec = get_zero_glue() end @@ -114,7 +125,7 @@ local function insert_xkanjiskip_node(q, f, p) end local function insert_ascii_kanji_xkskip(q, p) - if cstb_get_inhibit_xsp_table(p.char)<=1 then return end + if cstb_get_penalty_table('xsp', p.char, 3, ltj.box_stack_level)<=1 then return end insert_xkanjiskip_node(q, p.font, p) end @@ -125,8 +136,8 @@ local function insert_kanji_ascii_xkskip(q, p) and math.floor(p.subtype/2)%2==1 do p = p.components; c = p.char end - if cstb_get_inhibit_xsp_table(c)%2 == 1 then - if cstb_get_inhibit_xsp_table(nrc)%2 == 0 then g = false end + if cstb_get_penalty_table('xsp', c, 3, ltj.box_stack_level)%2 == 1 then + if cstb_get_penalty_table('xsp', nrc, 3, ltj.box_stack_level)%2 == 0 then g = false end else g = false end if g then insert_xkanjiskip_node(q, nrf, p) end @@ -138,7 +149,7 @@ local function set_insert_skip_after_achar(p) and math.floor(p.subtype/2)%2 == 1 do p=node.tail(p.components); c = p.char end - if cstb_get_inhibit_xsp_table(c)>=2 then + if cstb_get_penalty_table('xsp', c, 3, ltj.box_stack_level)>=2 then insert_skip = after_schar else insert_skip = no_skip @@ -180,7 +191,7 @@ local function insert_kanji_skip(ope, p) else gx = get_zero_glue() -- fallback end g.spec = gx - else g.spec=node.copy(kanji_skip) + else g.spec=node_copy(kanji_skip) end else g.spec = get_zero_glue() end @@ -238,13 +249,21 @@ local function check_box(box_ptr) until p.id~=id_glyph end if p.id==id_hlist then - found_visible_node = true - if p.shift==0 then - if check_box(p.head) then found_visible_node = true end - else if find_first_char then - find_first_char = false - else - last_char = nil + if has_attr(p, attr_icflag)==PACKED then + for q in node.traverse_id(id_glyph, p.head) do + if find_first_char then + first_char = q; find_first_char = false + end + last_char = q; found_visible_node = true + end + else + if p.shift==0 then + if check_box(p.head) then found_visible_node = true end + else if find_first_char then + find_first_char = false + else + last_char = nil + end end end elseif p.id==id_ins or p.id==id_mark @@ -288,13 +307,13 @@ local function insks_around_hbox() end -- last char if is_japanese_glyph_node(last_char) then - if is_japanese_glyph_node(node_next(np)) then - insert_kanji_skip(node_insert_after, np) - end insert_skip = after_wchar nrc = last_char.char; nrf = last_char.font nr_spc = { has_attr(last_char, attr_autospc)==1, has_attr(last_char, attr_autoxspc)==1 } + if is_japanese_glyph_node(node_next(np)) then + insert_kanji_skip(node_insert_after, np) + end elseif last_char then set_insert_skip_after_achar(last_char) nr_spc = { has_attr(last_char, attr_autospc)==1, @@ -341,8 +360,8 @@ local function insks_around_math() end function ltj.int_insert_kanji_skip(ahead) - kanji_skip=tex.skip['kanjiskip'] - xkanji_skip=tex.skip['xkanjiskip'] + kanji_skip=skip_table_to_spec('kanjiskip') + xkanji_skip=skip_table_to_spec('xkanjiskip') head = ahead np = head; nq = nil; insert_skip = no_skip while np do diff --git a/test/test01-noembed.pdf b/test/test01-noembed.pdf index ab3a9e3..327b77a 100644 Binary files a/test/test01-noembed.pdf and b/test/test01-noembed.pdf differ diff --git a/test/test01.pdf b/test/test01.pdf index a118a1a..983dc03 100644 Binary files a/test/test01.pdf and b/test/test01.pdf differ diff --git a/test/test02-latex.pdf b/test/test02-latex.pdf index 676678b..5b6990c 100644 Binary files a/test/test02-latex.pdf and b/test/test02-latex.pdf differ diff --git a/test/test02-latex.tex b/test/test02-latex.tex index 6cc9982..87b4195 100644 --- a/test/test02-latex.tex +++ b/test/test02-latex.tex @@ -40,8 +40,8 @@ \font@name \fi \ifnum\pdf@strcmp{\f@encoding}{EU2}=0% - \global\kanjiskip=0pt plus 0.4pt minus 0.4pt% - \global\xkanjiskip=0.25\zw plus 0.083333\zw minus 0.083333\zw% + \ltjglobalsetparameter{kanjiskip={0pt plus 0.4pt minus 0.4pt}, + xkanjiskip={0.25\zw plus 0.083333\zw minus 0.083333\zw}}% \fi \csname \f@encoding+\f@family\endcsname \csname\curr@fontshape\endcsname diff --git a/test/test04-jfm.log b/test/test04-jfm.log deleted file mode 100644 index 279c538..0000000 --- a/test/test04-jfm.log +++ /dev/null @@ -1,302 +0,0 @@ -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 -(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-core.sty -(/opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/luaotfload.sty -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase.sty -Package: luatexbase 2010/10/06 v0.3 Module utilities for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) -Package ifluatex Info: LuaTeX detected. -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty -Package: luatexbase-compat 2010/10/10 v0.3 Compatibility tools for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -)) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty -Package: luatexbase-loader 2010/10/10 v0.3 Lua module loader for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase.loader.lua)) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-regs.sty -Package: luatexbase-regs 2010/10/10 v0.3 Registers allocation for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -)) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-attr.sty -Package: luatexbase-attr 2010/10/10 v0.3 Attributes allocation for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/attr.lua)) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty -Package: luatexbase-cctb 2010/10/10 v0.3 Catcodetable allocation for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/cctb.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-compat.sty) -\lltxb@catcodetable@alloc=\count277 -\@tempcnta=\count278 -\@tempcntb=\count279 -\CatcodeTableIniTeX=\luatexcatcodetable1 -\CatcodeTableString=\luatexcatcodetable2 -\CatcodeTableOther=\luatexcatcodetable3 -\CatcodeTableLaTeX=\luatexcatcodetable4 -\CatcodeTableLaTeXAtLetter=\luatexcatcodetable5 -\CatcodeTableExpl=\luatexcatcodetable6 -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-mcb.sty -Package: luatexbase-mcb 2010/10/10 v0.3 Callback management for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty -Package: luatexbase-modutils 2010/10/10 v0.3 Module utilities for LuaTeX -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package ifluatex Info: The package is already loaded. -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-loader.sty) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/modutils.lua)) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/mcb.lua) -Lua module: luatexbase-mcb 2010/05/12 0.2 register several functions in a callb -ack -) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luatexbase/luatexbase-modutils.sty)) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs.lua) -Lua module: lualibs 2011/01/20 0.96 Lua additional functions. - -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-string.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-lpeg.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-boolean.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-number.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-math.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-table.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-aux.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-io.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-os.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-file.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-md5.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-dir.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-unicode.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-utils.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-dimen.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-url.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/lualibs/lualibs-set.lua) -(/opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/luaotfload.lua) -Lua module: luaotfload 2011/02/16 1.24 OpenType layout system. - -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-luat-dum.lua.(using cache: /home/h7k/.texlive2010/texmf-var/luatex-cache/gen -eric) -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-luat-ovr.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-data-con.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-ini.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-node-dum.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-node-inj.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-tfm.lua. -luatexbase.attributes["otfl@state"] = 1 -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-cid.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-ott.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-map.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-otf.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-otd.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-oti.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-otb.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-otn.lua. -luatexbase.attributes["otfl@markbase"] = 2 -luatexbase.attributes["otfl@markmark"] = 3 -luatexbase.attributes["otfl@markdone"] = 4 -luatexbase.attributes["otfl@cursbase"] = 5 -luatexbase.attributes["otfl@curscurs"] = 6 -luatexbase.attributes["otfl@cursdone"] = 7 -luatexbase.attributes["otfl@kernpair"] = 8 -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-ota.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-otc.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-def.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-xtx.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-dum.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-nms.lua. -luaotfload: loading file /opt/texlive/p2010/texmf-dist/tex/luatex/luaotfload/ot -fl-font-clr.lua. -Module luatexbase-mcb info: creating 'luaotfload.patch_font' type 4 -Module luatexbase-mcb info: inserting 'luaotfload.pre_linebreak_filter' -(luatexbase-mcb) at position 1 in 'pre_linebreak_filter' -Module luatexbase-mcb info: inserting 'luaotfload.hpack_filter' -(luatexbase-mcb) at position 1 in 'hpack_filter' -Module luatexbase-mcb info: resetting callback 'define_font' -Module luatexbase-mcb info: inserting 'luaotfload.define_font' -(luatexbase-mcb) at position 1 in 'define_font' -Module luatexbase-mcb info: inserting 'luaotfload.find_vf_file' -(luatexbase-mcb) at position 1 in 'find_vf_file' -) (/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/ltxcmds.sty -Package: ltxcmds 2010/04/26 v1.7 LaTeX kernel commands for general use (HO) -) -(/opt/texlive/p2010/texmf-dist/tex/generic/xkeyval/xkeyval.tex -\XKV@toks=\toks13 -\XKV@tempa@toks=\toks14 -\XKV@depth=\count280 - -2008/08/13 v2.6a key=value parser (HA) -(/opt/texlive/p2010/texmf-dist/tex/generic/xkeyval/xkvtxhdr.tex -2005/02/22 v1.1 xkeyval TeX header (HA)) -(/opt/texlive/p2010/texmf-dist/tex/generic/xkeyval/keyval.tex)) -(/opt/texlive/p2010/texmf-dist/tex/generic/oberdiek/infwarerr.sty -Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO) -) -\ltj@tempcnta=\count281 -\ltj@tempcntb=\count282 -\ltj@tempcntc=\count283 -\ltj@tempdima=\dimen256 -\jcharwidowpenalty=\count284 -\kanjiskip=\skip256 -\xkanjiskip=\skip257 -\zw=\dimen257 -\zh=\dimen258 -\jQ=\dimen259 -\jH=\dimen260 -\ltj@curjfnt=\luatexattribute9 -\ltj@charclass=\luatexattribute10 -\ltj@yablshift=\luatexattribute11 -\ltj@ykblshift=\luatexattribute12 -\ltj@autospc=\luatexattribute13 -\ltj@autoxspc=\luatexattribute14 -\ltj@icflag=\luatexattribute15 -\ltj@japanese=\language87 - -(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-rmlgbm.lua) -(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-rmlgbm-data.lu -a) -(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-jfont.lua) -(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-core.lua) -Module luatexbase-mcb info: inserting 'ltj.process_input_buffer' -(luatexbase-mcb) at position 1 in 'process_input_buffer' -Module luatexbase-mcb info: inserting 'ltj.hpack_filter_pre' -(luatexbase-mcb) at position 1 in 'hpack_filter' -Module luatexbase-mcb info: inserting 'ltj.hyphenate' -(luatexbase-mcb) at position 1 in 'hyphenate' -Module luatexbase-mcb info: inserting 'ltj.pre_linebreak_filter' -(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) -\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/jfm-ujis.lua) -(/opt/texlive/p2010/../texmf-local/tex/generic/luatexja/luatexja-kinsoku.tex))) -(load: /home/h7k/.texlive2010/texmf-var/luatex-cache/generic/fonts/otf/temp-ipa -m.lua)(load: /home/h7k/.texlive2010/texmf-var/luatex-cache/generic/fonts/otf/te -mp-kozminpr6n-regular.lua)(load: /home/h7k/.texlive2010/texmf-var/luatex-cache/ -generic/fonts/otf/temp-ipamp.lua) -(./jfm-bad.lua) -! LuaTeX-ja error: bad JFM 'bad'. -\ltj@@jfont ->\directlua {ltj.ext_jfontdefY()} - - - } -l.19 } - -The JFM file you specified is not valid JFM file. -Defining Japanese font is cancelled. - -(load: /home/h7k/.texlive2010/texmf-var/luatex-cache/generic/fonts/otf/temp-ipa -exg.lua) -! LuaTeX-ja error: Invalid character code (-1), should in the range 0.."10FFFF. -. -\ltj@@getparam@two ...('#1', \the \ltj@tempcnta )} - -l.52 \ltjgetparameter{chartorange}{-1} - % must be error " -I'm going to use 0 instead of that illegal character code. - -[1{/opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdftex.map -LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte -x.map): fontmap entry for `bchb8r' already exists, duplicates ignored - -LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte -x.map): fontmap entry for `bchbi8r' already exists, duplicates ignored - -LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte -x.map): fontmap entry for `bchbo8r' already exists, duplicates ignored - -LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte -x.map): fontmap entry for `bchr8r' already exists, duplicates ignored - -LuaTeX warning (file /opt/texlive/p2010/texmf-var/fonts/map/pdftex/updmap/pdfte -x.map): fontmap entry for `bchri8r' already exists, duplicates ignored - -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] -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-dist/fonts/type1/public/amsfonts/cm/cmti10.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) - diff --git a/test/test04-jfm.pdf b/test/test04-jfm.pdf index 2d5070b..6c1aa50 100644 Binary files a/test/test04-jfm.pdf and b/test/test04-jfm.pdf differ diff --git a/test/test04-jfm.tex b/test/test04-jfm.tex index c14c873..103cc28 100644 --- a/test/test04-jfm.tex +++ b/test/test04-jfm.tex @@ -57,6 +57,18 @@ \ltjsetparameter{jacharrange={218}} 和文扱いにもどる +\head{Ticket \#25121} +\setbox0=\hbox{\ltjsetparameter{kanjiskip=-5pt} +あいうえお\hbox{\ltjsetparameter{kanjiskip=12pt}かきくけこ}さしすせそ\par a}\copy0 +\tracingonline=0\showboxdepth=10000\showboxbreadth=10000\tracingonline=1\showbox0 + +{\ltjsetparameter{kanjiskip=3pt} +あいうえお{\ltjsetparameter{kanjiskip=-5pt}% this setting is ignored +かきくけこ}さしすせそ\par} + +{\ltjsetparameter{kanjiskip=3pt} +あいうえおさしすせそ}\par + \vfill\eject \noindent{\bf\gt 以下はJFMグルー挿入検証} @@ -210,7 +222,7 @@ \head{kanjiskip from JFM, autospacing (JA--JA)} \setbox0=\hbox{あ\rmlh あ}\dumplist0 -{\kanjiskip=\maxdimen +{\ltjsetparameter{kanjiskip=\maxdimen} \setbox0=\hbox{あ\rmlh あ}\dumplist0 \jfont\rmlk={psft:Ryumin-Light:jfm=test} at 12pt \setbox0=\hbox{\rmlk は\rmlh あ}\dumplist0} @@ -226,7 +238,7 @@ \setbox0=\hbox{\naxspc\rmlh まx}\dumplist0 -{\xkanjiskip=\maxdimen\setbox0=\hbox{\rmlh まx}\dumplist0} +{\ltjsetparameter{xkanjiskip=\maxdimen}\setbox0=\hbox{\rmlh まx}\dumplist0} {\ltjsetparameter{jaxspmode={`ま,preonly}} \setbox0=\hbox{\rmlh まx}\dumplist0} @@ -241,7 +253,7 @@ \setbox0=\hbox{\naxspc\rmlh xま}\dumplist0 -{\xkanjiskip=\maxdimen\setbox0=\hbox{\rmlh xま}\dumplist0} +{\ltjsetparameter{xkanjiskip=\maxdimen}\setbox0=\hbox{\rmlh xま}\dumplist0} {\ltjsetparameter{jaxspmode={`ま,postonly}} \setbox0=\hbox{\rmlh xま}\dumplist0} diff --git a/test/test05-speed.pdf b/test/test05-speed.pdf index 774b80c..1754fea 100644 Binary files a/test/test05-speed.pdf and b/test/test05-speed.pdf differ diff --git a/test/test05-speed.tex b/test/test05-speed.tex index 7ae5c96..62f9331 100644 --- a/test/test05-speed.tex +++ b/test/test05-speed.tex @@ -4,7 +4,7 @@ \newcount\cnt\newcount\cnta \cnt=0 \long\def\loop#1\repeat{\def\body{#1}\iterate} -\loop\ifnum\cnt<20 % <= this value +\loop\ifnum\cnt<10 % <= this value \cnta=0 \message{\the\cnt:}\par {\loop\ifnum\cnta<500 あ.「い,うえお・か(き)く)(けこ\advance\cnta1\repeat} \advance\cnt1 @@ -13,6 +13,6 @@ \end % real time: -% 20: 7.867s -% 10: 4.563s -% env: C2D E7300, Mem 4GB, LuaTeX 0.66.0pre, Gentoo amd64 unstable \ No newline at end of file +% 20: 9.950s +% 10: 5.209s +% env: C2D E7300, Mem 4GB, LuaTeX 0.71.0pre, Gentoo amd64 unstable \ No newline at end of file