Ticket #47755

luatexja.pltx_composite_last_node_char() が -1 を返す

Open Date: 2023-04-03 20:48 Last Update: 2023-04-11 12:29

Reporter:
(Anonymous)
Owner:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
None

Details

e-(u)pTeX の \lastnodechar を LuaTeX-ja でも使いたく、luatexja.lua で定義されている luatexja.pltx_composite_last_node_char() を使っています。 ところが、この関数は例えば以下のような場合に期待された値を返しません。

  1. %#!luatex or euptex
  2. \ifx\directlua\undefined\else
  3. \input luatexja.sty
  4. \def\lastnodechar{\numexpr\directlua{luatexja.pltx_composite_last_node_char()}}
  5. \fi
  6. \setbox0=\hbox{あ
  7. \count255=\lastnodechar
  8. \immediate\write16{\the\count255}}% -> 12354
  9. \setbox0=\hbox{\unhbox0
  10. \count255=\lastnodechar
  11. \immediate\write16{\the\count255}}% -> 12354
  12. \setbox0=\hbox{。
  13. \unskip
  14. \count255=\lastnodechar
  15. \immediate\write16{\the\count255}}% -> 12290
  16. \showboxdepth10000
  17. \showboxbreadth10000
  18. \tracingonline1
  19. \showbox0
  20. \setbox0=\hbox{\unhbox0
  21. \count255=\lastnodechar
  22. \immediate\write16{\the\count255}}% -> -1
  23. \bye

4 つ目の \write でも 12290 が返ってくることが期待されますが、実際には -1 になってしまいます。 \showbox で調べると

  1. > \box0=
  2. \hbox(8.4675+1.15466)x4.81108, direction TLT
  3. .\whatsit4=[]
  4. .\hbox(8.4675+1.15466)x4.81108, direction TLT
  5. ..\tenmin
となっており、TLT の \hbox に句点が入れられてしまっているからなようですが、このような場合でも期待された通りの値を返す \lastnodechar を実装できないでしょうか。

余談ですが、17 行目の \unskip(「。」の JFM グルーを消しています)がないと、euptex では segmentation fault で落ちるようです。

Ticket History (3/5 Histories)

2023-04-03 20:48 Updated by: None
  • New Ticket "luatexja.pltx_composite_last_node_char() が -1 を返す" created
2023-04-03 21:35 Updated by: h7k
Comment

4 つ目の \write でも 12290 が返ってくることが期待されますが、実際には -1 になってしまいます。

確認しました.commit 765550f ではどうでしょうか.
(luatexja.lua だけ更新しても動かないかもしれません.その場合は src/ 以下の全ファイルを更新すると良いでしょう.)

2023-04-03 22:06 Updated by: None
Comment

問題なく動きました。ありがとうございます。 (私の環境では、luatexja.lua の更新のみで大丈夫でした。)

2023-04-03 22:28 Updated by: h7k
  • Owner Update from (None) to h7k
Comment

余談ですが、17 行目の \unskip(「。」の JFM グルーを消しています)がないと、euptex では segmentation fault で落ちるようです。

こちらは tex-jp-build/#156 に回しました.

2023-04-11 12:29 Updated by: h7k
  • Status Update from Open to Closed
  • Resolution Update from None to Fixed
Comment

20230409.0 を出したので,完了とします.

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login