ソースコードの管理場所
Revision | 07cb93b123d2f8f16faabef4bcec41ea0cd1bc77 (tree) |
---|---|
Zeit | 2020-12-23 09:35:03 |
Autor | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
Merge branch 'kitagawa_ruby' into kitagawa_test
@@ -52,6 +52,7 @@ | ||
52 | 52 | \def\mybox#1{\unskip\ {\Large \fboxrule=0.1mm\fboxsep=0mm\fcolorbox{cyan}{white}{\hbox{\<\ltjjachar#1\<}}}\ } |
53 | 53 | |
54 | 54 | \begin{document} |
55 | + | |
55 | 56 | \catcode`\<=13 |
56 | 57 | \def<#1>{{\rmfamily\mdseries\itshape$\langle$#1\/$\rangle$}} |
57 | 58 | %\fontsize{13.19873}{15}\selectfont% |
@@ -251,14 +252,20 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
251 | 252 | intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip |
252 | 253 | \end{verbatim} |
253 | 254 | |
254 | -\paragraph{\texttt{\textbackslash ltjsetparamater} に追加されるキー} | |
255 | +\paragraph{\cs{ltjsetparamater} に追加されるキー} | |
255 | 256 | \begin{description} |
256 | 257 | \item[\Param{rubypreintrusion}\ttfamily =\{<chr\_code>, <pre\_int>\}] |
257 | 258 | 文字<chr\_code> に,その\textbf{直後}のルビによって掛けられるルビ文字列の最大長 |
258 | 259 | (つまり,\underline{前文字進入許容量})をルビ全角単位で指定. |
260 | + | |
261 | + もし$-a$~($a>0$)を指定した場合は,実際の\underline{前文字進入許容量}は$a$となるが, | |
262 | + 文字<chr\_code>の前のJFMグルーに進入が発生した場合には,\underline{前文字進入許容量}が0でなかった場合は,の後のJFMグルーにはルビの進入は発生しない. | |
259 | 263 | \item[\Param{rubypostintrusion}\ttfamily =\{<chr\_code>, <post\_int>\}] |
260 | 264 | 文字<chr\_code> に,その\textbf{直前}のルビによって掛けられるルビ文字列の最大長 |
261 | 265 | (つまり,\underline{後文字進入許容量})をルビ全角単位で指定. |
266 | + | |
267 | + もし$-a$~($a>0$)を指定した場合は,実際の\underline{後文字進入許容量}は$a$となるが, | |
268 | + 実際の\underline{後文字進入量}が0でなかった場合は,文字<chr\_code>の後のJFMグルーにはルビの進入は発生しない. | |
262 | 269 | \end{description} |
263 | 270 | 以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は1である: |
264 | 271 | \begin{quote} |
@@ -271,15 +278,15 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
271 | 278 | \begin{quote} |
272 | 279 | 中点類\@for\@tmp:=`\・,`\:,`\; \do{\mybox{\@tmp}} |
273 | 280 | \end{quote} |
274 | -また,以下の文字は\Param{rubypreintrusion}のみ初期値は1である: | |
281 | +また,以下の文字は\Param{rubypreintrusion}のみ初期値は$-1$である: | |
275 | 282 | \begin{quote} |
276 | 283 | 始め括弧類 |
277 | 284 | \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox{\@tmp}}\unskip, |
278 | 285 | 「文字コード$-1$の文字 |
279 | - \footnote{段落開始の\ \texttt{\textbackslash parindent}分インデントを表す. | |
286 | + \footnote{段落開始の\ \cs{parindent}分インデントを表す. | |
280 | 287 | 通常の\LuaTeX-jaにおける指定では「文字コード$-1$」は文中数式境界を表していることに注意.}」 |
281 | 288 | \end{quote} |
282 | -さらに,以下の文字は\Param{rubypostintrusion}のみ初期値は1である: | |
289 | +さらに,以下の文字は\Param{rubypostintrusion}のみ初期値は$-1$である: | |
283 | 290 | \begin{quote} |
284 | 291 | 閉じ括弧類 |
285 | 292 | \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox{\@tmp}}\unskip, |
@@ -289,7 +296,8 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
289 | 296 | |
290 | 297 | 以上で記述されていない\Param{rubypreintrusion},~\Param{rubypostintrusion}の初期値はすべて0である. |
291 | 298 | |
292 | -\paragraph{\texttt{\textbackslash ltjkenten}} | |
299 | + | |
300 | +\paragraph{\cs{ltjkenten}} | |
293 | 301 | 圏点を出力する命令で,\verb+\kenten+ という別名を定義している. |
294 | 302 | \begin{quote} |
295 | 303 | \ttfamily\cs{ltjkenten}[<option>]\{親文字\} |
@@ -366,8 +374,8 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
366 | 374 | |
367 | 375 | |
368 | 376 | \section{\ruby{注|意|点}{ちゆう|い|てん}} |
369 | -\paragraph{前後からのルビ文字のはみ出し} | |
370 | -「日本語組版処理の要件」の図3.82のように, | |
377 | +\paragraph{前後からのルビ文字のはみ出し1} | |
378 | +「日本語組版処理の要件」の図117\footnote{2020-08-11版での番号.2012-04-03版では図3.82.}のように, | |
371 | 379 | 前後からのルビ文字のはみ出しが繋がらないようにする処理が組み込まれている. |
372 | 380 | |
373 | 381 | 例えば, |
@@ -378,8 +386,8 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
378 | 386 | において,1行目右側の「\ltjruby{陵}{みささぎ}」のルビが前の「と」にかかる量は次のように決まる: |
379 | 387 | \begin{enumerate} |
380 | 388 | \item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の\underline{後文字進入量}は前もって知ることはでき |
381 | - ない.なので,「\ltjruby{陵}{りよう}」は行中形で組まれるものとして | |
382 | -「\ltjruby{陵}{みささぎ}」前文字進入許容量は | |
389 | + ない.そのため,「\ltjruby{陵}{りよう}」は行中形で組まれるものと想定し, | |
390 | +「\ltjruby{陵}{みささぎ}」の前文字進入許容量は | |
383 | 391 | \[ |
384 | 392 | \underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}} |
385 | 393 | -\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(行中形)}}=0.25\,\mathrm{zw} |
@@ -393,6 +401,7 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
393 | 401 | -\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}. |
394 | 402 | \] |
395 | 403 | \end{enumerate} |
404 | + | |
396 | 405 | <jobname>\texttt{.ltjruby}ファイルに保存する際,各 \verb+\ltjruby+ 命令の呼び出しを識別するキーが必要になるが, |
397 | 406 | そのキーとしては単純に「何個目の \verb+\ltjruby+ 命令か」である. |
398 | 407 |
@@ -400,6 +409,18 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} | ||
400 | 409 | 「\ltjruby{陵}{みささぎ}」の\emph{\underline{前文字進入許容量}指定(\texttt{pre})が自動}になっている場合のみ |
401 | 410 | 実施される. |
402 | 411 | |
412 | + | |
413 | +\paragraph{前後からのルビ文字のはみ出し2} | |
414 | +また,本パッケージのv0.**以降では,「日本語組版処理の要件」にある | |
415 | +\begin{quote} | |
416 | + 後ろにくる終わり括弧類,句点類若しくは読点類,又は前にくる始め括弧類には, | |
417 | + 最大でルビ文字サイズの全角までルビ文字を掛けてもよい. | |
418 | + この場合,後ろにくる終わり括弧類,句点類若しくは読点類の後ろの空き量, | |
419 | + 又は前にくる始め括弧類の前の空き量に掛けてはならない. | |
420 | +\end{quote} | |
421 | +という処理も組み込まれており,<jobname>\texttt{.ltjruby}に「前後の和文処理グルーに正の量だけ進入したか」という情報を | |
422 | +保存することによって実装されている. | |
423 | + | |
403 | 424 | \paragraph{段落末尾のルビ} |
404 | 425 | 段落がルビで終わった場合,そのルビが行末形で組まれることはない. |
405 | 426 | これは,段落の「本当の」末尾には \verb+\penalty10000\parfillskip+ があるためで, |
@@ -18,9 +18,9 @@ | ||
18 | 18 | %% 引数:ルビ全角を単位とした実数 |
19 | 19 | %% この文字への pre-, post-intrusion の許容量 |
20 | 20 | \define@key[ltj]{japaram}{rubypreintrusion}{% |
21 | - \ltj@@set@stack@real{RIPRE}{0}{0x7FFFFFFF}#1 } | |
21 | + \ltj@@set@stack@real{RIPRE}{-0x7FFFFFFF}{0x7FFFFFFF}#1 } | |
22 | 22 | \define@key[ltj]{japaram}{rubypostintrusion}{% |
23 | - \ltj@@set@stack@real{RIPOST}{0}{0x7FFFFFFF}#1 } | |
23 | + \ltj@@set@stack@real{RIPOST}{-0x7FFFFFFF}{0x7FFFFFFF}#1 } | |
24 | 24 | \def\ltj@@set@stack@real#1#2#3{% |
25 | 25 | \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1, |
26 | 26 | #2, #3, token.scan_word)}} |
@@ -226,15 +226,15 @@ | ||
226 | 226 | \advance\count@1\repeat |
227 | 227 | %% 開き括弧・閉じ括弧 |
228 | 228 | \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do |
229 | - {\ltjsetparameter{rubypreintrusion={\@tmp,1}}} | |
229 | + {\ltjsetparameter{rubypreintrusion={\@tmp,-1}}} | |
230 | 230 | \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do |
231 | - {\ltjsetparameter{rubypostintrusion={\@tmp,1}}} | |
231 | + {\ltjsetparameter{rubypostintrusion={\@tmp,-1}}} | |
232 | 232 | %% 中点類 |
233 | 233 | \@for\@tmp:=`\・,`\:,`\;,`\―,`\‥,`\…,`〳,`\〴,`\〵,"2014 \do |
234 | 234 | {\ltjsetparameter{rubypreintrusion={\@tmp,0.5},rubypostintrusion={\@tmp,0.5}}} |
235 | 235 | %% 読点・句点 |
236 | 236 | \@for\@tmp:=`\、,`\,,`\。,`\. \do |
237 | - {\ltjsetparameter{rubypostintrusion={\@tmp,1}}} | |
237 | + {\ltjsetparameter{rubypostintrusion={\@tmp,-1}}} | |
238 | 238 | %% 段落インデント部分 |
239 | 239 | \ltjsetparameter{rubypreintrusion={-1,1}} |
240 | 240 |
@@ -356,6 +356,15 @@ for i,v in pairs(t) do | ||
356 | 356 | if v.kern and v.kern[0] then v.kern[100] = v.kern[0] end |
357 | 357 | end |
358 | 358 | end |
359 | +t[200]=table.fastcopy(t[0]) | |
360 | +t[200].chars={ 0x3031,0x3032 } | |
361 | +t[200].height=1.38; t[200].depth=0.62 | |
362 | +for i,v in pairs(t) do | |
363 | + if type(i)=='number' and type(v)=='table' then | |
364 | + if v.glue and v.glue[0] then v.glue[200] = v.glue[0] end | |
365 | + if v.kern and v.kern[0] then v.kern[200] = v.kern[0] end | |
366 | + end | |
367 | +end | |
359 | 368 | |
360 | 369 | local jf = luatexja.jfont.jfm_feature |
361 | 370 | if jf and jf.beginpar_middledot_zw==true then |
@@ -52,6 +52,9 @@ local attr_ruby = luatexbase.attributes['ltj@rubyattr'] | ||
52 | 52 | -- * (whatsit).value node ではルビ全角の値(sp単位) |
53 | 53 | -- * 行分割で whatsit の前後に並ぶノードでは,「何番目のルビ関連ノード」か |
54 | 54 | -- * (whatsit).value に続く整形済み vbox たちでは post_intrusion の値 |
55 | +local attr_ruby_post_jfmgk = luatexbase.attributes['ltj@kcat3'] | |
56 | +-- JAglue 処理時に,2つ前のクラスタもルビであれば,そのルビが直後の和文処理グルーへ | |
57 | +-- 正の進入をしたか否か(した:1,しなかった:0) | |
55 | 58 | local cat_lp = luatexbase.catcodetables['latex-package'] |
56 | 59 | |
57 | 60 | local round, floor = tex.round, math.floor |
@@ -341,16 +344,24 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) | ||
341 | 344 | setfield(p, 'width', rwidth) |
342 | 345 | local ps = getlist(p) |
343 | 346 | setfield(ps, 'width', getfield(ps, 'width') - pre_intrusion) |
344 | - local orig_post_intrusion = post_intrusion | |
345 | - if no_end then orig_post_intrusion = max(orig_post_intrusion - tmp_tbl.after_jfmgk, 0) end | |
346 | - return r, p, orig_post_intrusion | |
347 | + local orig_post_intrusion, post_jfmgk = post_intrusion, false | |
348 | + if no_end then | |
349 | + if orig_post_intrusion > tmp_tbl.after_jfmgk then | |
350 | + orig_post_intrusion = orig_post_intrusion - tmp_tbl.after_jfmgk | |
351 | + post_jfmgk = (tmp_tbl.after_jfmgk > 0) | |
352 | + else | |
353 | + orig_post_intrusion = 0 | |
354 | + post_jfmgk = (post_intrusion > 0) | |
355 | + end | |
356 | + end | |
357 | + return r, p, orig_post_intrusion, post_jfmgk | |
347 | 358 | end |
348 | 359 | |
349 | 360 | -- ルビボックスの生成(単一グループ) |
350 | 361 | -- returned value: <new box>, <ruby width>, <post_intrusion> |
351 | 362 | local max_margin |
352 | 363 | local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) |
353 | - local post_intrusion = 0 | |
364 | + local post_intrusion, post_jfmgk = 0, false | |
354 | 365 | local imode |
355 | 366 | local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost |
356 | 367 | local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost |
@@ -360,7 +371,7 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) | ||
360 | 371 | imode = (imode-rpost)/8; rmid = imode%8; |
361 | 372 | imode = (imode-rmid)/8; rpre = imode%8 |
362 | 373 | if getfield(r, 'width') > getfield(p, 'width') then -- change the width of p |
363 | - r, p, post_intrusion = enlarge_parent(r, p, tmp_tbl, no_begin, no_end) | |
374 | + r, p, post_intrusion, post_jfmgk = enlarge_parent(r, p, tmp_tbl, no_begin, no_end) | |
364 | 375 | elseif getfield(r, 'width') < getfield(p, 'width') then -- change the width of r |
365 | 376 | r = enlarge(r, getfield(p, 'width'), rpre, rmid, rpost, 0, 0) |
366 | 377 | post_intrusion = 0 |
@@ -390,6 +401,7 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) | ||
390 | 401 | if tmp_tbl.baseheight >= 0 then setfield(p, 'height', tmp_tbl.baseheight) end |
391 | 402 | a = node.direct.vpack(r); setfield(a, 'shift', 0) |
392 | 403 | set_attr(a, attr_ruby, post_intrusion) |
404 | + set_attr(a, attr_ruby_post_jfmgk, post_jfmgk and 1 or 0) | |
393 | 405 | if rsmash or getfield(a, 'height')<getfield(p, 'height') then |
394 | 406 | local k = node_new(id_kern, 1) |
395 | 407 | setfield(k, 'kern', -getfield(a, 'height')+getfield(p, 'height')) |
@@ -397,12 +409,12 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) | ||
397 | 409 | setfield(a, 'height', getfield(p, 'height')) |
398 | 410 | end |
399 | 411 | |
400 | - return a, getfield(r, 'width'), post_intrusion | |
412 | + return a, getfield(r, 'width'), post_intrusion, post_jfmgk | |
401 | 413 | end |
402 | 414 | |
403 | 415 | |
404 | 416 | -- High-level routine in pre_linebreak_filter |
405 | -local post_intrusion_backup | |
417 | +local post_intrusion_backup, post_jfmgk_backup | |
406 | 418 | local max_allow_pre, max_allow_post |
407 | 419 | |
408 | 420 |
@@ -425,7 +437,7 @@ local function pre_low_cal_box(w, cmp) | ||
425 | 437 | local nt, nta, ntb = wv, nil, nil -- nt*: node temp |
426 | 438 | rst.ppre, rst.pmid, rst.ppost = rtb[6], rtb[5], rtb[4] |
427 | 439 | rst.mapre, rst.mapost = max_allow_pre, 0 |
428 | - for i = 1, cmp do | |
440 | + for i = 1, cmp do | |
429 | 441 | nt = node_next(nt); rb[i] = nt; nta = concat(nta, node_copy(nt)) |
430 | 442 | nt = node_next(nt); pb[i] = nt; ntb = concat(ntb, node_copy(nt)) |
431 | 443 | coef[i] = {} |
@@ -455,7 +467,7 @@ local function pre_low_cal_box(w, cmp) | ||
455 | 467 | for j = 1, 2*cmp+1 do coef[2*cmp+1][j] = 1 end |
456 | 468 | rst.ppre, rst.pmid, rst.ppost = rtb[3], rtb[2], rtb[1] |
457 | 469 | rst.mapre, rst.mapost = max_allow_pre, max_allow_post |
458 | - kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup | |
470 | + kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup, post_jfmgk_backup | |
459 | 471 | = new_ruby_box(nta, ntb, rst, true, true) |
460 | 472 | |
461 | 473 | -- w.value の node list 更新. |
@@ -517,7 +529,7 @@ end | ||
517 | 529 | local function pre_high(ahead) |
518 | 530 | if not ahead then return ahead end |
519 | 531 | local head = to_direct(ahead) |
520 | - post_intrusion_backup = 0 | |
532 | + post_intrusion_backup, post_jfmgk_backup = 0, false | |
521 | 533 | local n = first_whatsit(head) |
522 | 534 | while n do |
523 | 535 | if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then |
@@ -526,17 +538,22 @@ local function pre_high(ahead) | ||
526 | 538 | max_allow_pre = rst.pre or 0 |
527 | 539 | local atr = has_attr(n, attr_ruby) or 0 |
528 | 540 | if max_allow_pre < 0 then |
529 | - if atr>0 then | |
530 | - -- 直前のルビで intrusion がおこる可能性あり. | |
531 | - -- 前 run のデータが残っていればそれを使用, | |
532 | - -- そうでなければ行中形のデータを利用する | |
533 | - local op = old_break_info[atr] or post_intrusion_backup | |
534 | - max_allow_pre = max(0, -max_allow_pre - op) | |
535 | - else | |
536 | - max_allow_pre = -max_allow_pre | |
537 | - end | |
541 | + -- 直前のルビで intrusion がおこる可能性あり. | |
542 | + -- 前 run のデータが残っていればそれを使用, | |
543 | + -- そうでなければ行中形のデータを利用する | |
544 | + local op = (atr>0) and (old_break_info[atr] or post_intrusion_backup) or 0 | |
545 | + max_allow_pre = max(0, -max_allow_pre - op) | |
546 | + end | |
547 | + if rst.exclude_pre_from_prev_ruby and ((atr>0) and (old_break_info[-atr]>0) or post_jfmgk_backup) then | |
548 | + -- 「直前のルビが JFM グルーに進入→現在のルビの前文字進入はなし」という状況 | |
549 | + max_allow_pre = 0; rst.exclude_pre_from_prev_ruby=false | |
538 | 550 | end |
539 | - post_intrusion_backup = 0 | |
551 | + if rst.exclude_pre_jfmgk_from_prev_ruby | |
552 | + and (atr>0) and ((old_break_info[atr] or post_intrusion_backup) > 0) then | |
553 | + -- 「直前のルビが文字に進入→現在のルビの和文処理グルーへの進入はなし」という状況 | |
554 | + rst.before_jfmgk = 0 | |
555 | + end | |
556 | + post_intrusion_backup, post_jfmgk_backup = 0, false | |
540 | 557 | max_allow_post = rst.post or 0 |
541 | 558 | max_margin = rst.maxmargin or 0 |
542 | 559 | local coef = pre_low_cal_box(n, rst.count) |
@@ -558,11 +575,11 @@ luatexbase.add_to_callback('hpack_filter', pre_high, 'ltj.ruby.pre', 100) | ||
558 | 575 | ---------------------------------------------------------------- |
559 | 576 | local post_lown |
560 | 577 | do |
561 | - local function write_aux(wv, num) | |
578 | + local function write_aux(wv, num, bool) | |
562 | 579 | local id = has_attr(wv, attr_ruby_id) |
563 | 580 | if id>0 and cache_handle then |
564 | 581 | cache_handle:write( |
565 | - 'lrob[' .. tostring(id) .. ']=' .. num .. '\n') | |
582 | + 'lrob[' .. tostring(id) .. ']=' .. num .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n') | |
566 | 583 | end |
567 | 584 | end |
568 | 585 |
@@ -578,7 +595,7 @@ do | ||
578 | 595 | node_remove(wv, hn) |
579 | 596 | insert_after(ch, rs[1], hn) |
580 | 597 | set_attr(hn, attr_icflag, PROCESSED) |
581 | - write_aux(wv, has_attr(hn, attr_ruby))-- 行中形 | |
598 | + write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))-- 行中形 | |
582 | 599 | else |
583 | 600 | local deg, hn = (fn-1)/2, wv |
584 | 601 | for i = 1, deg do hn = node_next(hn) end; |
@@ -586,7 +603,7 @@ do | ||
586 | 603 | setfield(hn, 'next', nil) |
587 | 604 | insert_after(ch, rs[1], hn) |
588 | 605 | set_attr(hn, attr_icflag, PROCESSED) |
589 | - write_aux(wv, has_attr(hn, attr_ruby)) | |
606 | + write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk)) | |
590 | 607 | end |
591 | 608 | else |
592 | 609 | local deg, hn = max((hn-1)/2,2), wv |
@@ -597,7 +614,7 @@ do | ||
597 | 614 | insert_after(ch, rs[1], hn) |
598 | 615 | set_attr(hn, attr_icflag, PROCESSED) |
599 | 616 | if fn == 2*cmp-1 then |
600 | - write_aux(wv, has_attr(hn, attr_ruby)) | |
617 | + write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk)) | |
601 | 618 | end |
602 | 619 | end |
603 | 620 | for i = 1,#rs do |
@@ -682,6 +699,8 @@ luatexbase.add_to_callback('hpack_filter', post_high_hbox, 'ltj.ruby.post_hbox', | ||
682 | 699 | ---------------------------------------------------------------- |
683 | 700 | do |
684 | 701 | local RIPRE = luatexja.stack_table_index.RIPRE |
702 | + local RIPOST = luatexja.stack_table_index.RIPOST | |
703 | + local abs = math.abs | |
685 | 704 | local function whatsit_callback(Np, lp, Nq) |
686 | 705 | if Np.nuc then return Np |
687 | 706 | elseif getfield(lp, 'user_id') == RUBY_PRE then |
@@ -694,25 +713,27 @@ do | ||
694 | 713 | if type(Nq.char)=='number' then |
695 | 714 | -- Nq is a JAchar |
696 | 715 | if rst.pre < 0 then -- auto |
697 | - local p = round((ltjs.table_current_stack[RIPRE + Nq.char] or 0) | |
698 | - *rst.rubyzw) | |
716 | + local s = ltjs.table_current_stack[RIPRE + Nq.char] or 0 | |
717 | + local p = round(abs(s)*rst.rubyzw) | |
699 | 718 | if rst.mode%2 == 0 then -- intrusion 無効 |
700 | 719 | p = 0 |
701 | 720 | end |
702 | - rst.pre = -p | |
721 | + rst.pre = -p; rst.exclude_pre_from_prev_ruby = (s<0); | |
722 | + rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST +Nq.char] or 0)<0; | |
703 | 723 | end |
704 | 724 | if Nq.prev_ruby then |
705 | 725 | set_attr(lp, attr_ruby, Nq.prev_ruby) |
706 | 726 | end |
707 | 727 | elseif rst.pre < 0 then -- auto |
708 | 728 | if Nq.char == 'parbdd' then |
709 | - local p = round((ltjs.table_current_stack[RIPRE-1] or 0) | |
710 | - *rst.rubyzw) | |
729 | + local s = ltjs.table_current_stack[RIPRE - 1] or 0 | |
730 | + local p = round(abs(s)*rst.rubyzw) | |
711 | 731 | p = min(p, Nq.width) |
712 | - if rst.mode%2 == 0 then -- intrusion 無効 | |
732 | + if rst.mode%2 == 0 then -- intrusion 無効 | |
713 | 733 | p = 0 |
714 | 734 | end |
715 | - rst.pre = p | |
735 | + rst.pre = p; rst.exclude_pre_from_prev_ruby = (s<0); | |
736 | + rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST -1] or 0)<0; | |
716 | 737 | else |
717 | 738 | rst.pre = 0 |
718 | 739 | end |
@@ -741,6 +762,7 @@ do | ||
741 | 762 | end |
742 | 763 | end |
743 | 764 | local RIPOST = luatexja.stack_table_index.RIPOST |
765 | + local abs = math.abs | |
744 | 766 | local function whatsit_after_callback(s, Nq, Np) |
745 | 767 | if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then |
746 | 768 | if Np then |
@@ -764,8 +786,7 @@ do | ||
764 | 786 | if Np and Np.id ~=id_pbox_w and type(Np.char)=='number' then |
765 | 787 | -- Np is a JAchar |
766 | 788 | if rst.post < 0 then -- auto |
767 | - local p = round((ltjs.table_current_stack[RIPOST + Np.char] or 0) | |
768 | - *rst.rubyzw) | |
789 | + local p = round(abs(ltjs.table_current_stack[RIPOST + Np.char] or 0)*rst.rubyzw) | |
769 | 790 | if rst.mode%2 == 0 then -- intrusion 無効 |
770 | 791 | p = 0 |
771 | 792 | end |
@@ -44,6 +44,8 @@ | ||
44 | 44 | |
45 | 45 | %% screen environment |
46 | 46 | \def\screen{% |
47 | + \typeout{AL: \the\ltj@yablshift:\the\ltj@tablshift.} | |
48 | + \typeout{JA: \the\ltj@ykblshift:\the\ltj@tkblshift.} | |
47 | 49 | \@saveybaselineshift\ltj@yablshift sp\ltj@yablshift\z@ |
48 | 50 | \@savetbaselineshift\ltj@tablshift sp\ltj@tablshift\z@ |
49 | 51 | \@ifnextchar[{\@screen}{\@screen[0]}} |