ソースコードの管理場所
Revision | 3595d4d3e27447080f9f6012f157388cfce244dd (tree) |
---|---|
Time | 2020-04-01 10:29:40 |
Author | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
more use of \luadef
@@ -469,9 +469,12 @@ | ||
469 | 469 | {\ltj@@getparam@two{#1}}% |
470 | 470 | {\ltj@@getparam@one{#1}}% |
471 | 471 | } |
472 | -\def\ltj@@getparam@one#1{% | |
473 | - \directlua{luatexja.ext_get_parameter_unary('#1')}% | |
474 | -}% | |
472 | +\newluafunction\ltj@@getparam@one@inner | |
473 | +\directlua{ | |
474 | + local t = lua.get_functions_table() | |
475 | + t[\the\ltj@@getparam@one@inner] = luatexja.ext_get_parameter_unary | |
476 | +} | |
477 | +\luadef\ltj@@getparam@one\ltj@@getparam@one@inner | |
475 | 478 | \def\ltj@@getparam@two#1#2{% |
476 | 479 | \directlua{luatexja.ext_get_parameter_binary('#1', \ltj@safe@num@or{nil}{#2})}% |
477 | 480 | } |
@@ -491,7 +494,7 @@ | ||
491 | 494 | end |
492 | 495 | end |
493 | 496 | } |
494 | -\protected\def\ltj@alljachar{\luafunction\ltj@alljachar@inner} | |
497 | +\protected\luadef\ltj@alljachar\ltj@alljachar@inner | |
495 | 498 | \protected\def\ltj@allalchar{\relax |
496 | 499 | \csname ltj@kcat0\endcsname="7FFFFFFF %" |
497 | 500 | \csname ltj@kcat1\endcsname="7FFFFFFF %" |
@@ -579,10 +582,17 @@ | ||
579 | 582 | |
580 | 583 | %%%% insert |
581 | 584 | \let\orig@insert=\insert |
585 | +\newluafunction\ltj@@lua@populate@insertwhatsit@inner | |
586 | +\directlua{ | |
587 | + local t = lua.get_functions_table() | |
588 | + t[\the\ltj@@lua@populate@insertwhatsit@inner] | |
589 | + = luatexja.direction.populate_insertion_dir_whatsit | |
590 | +} | |
591 | +\luadef\ltj@@lua@populate@insertwhatsit\ltj@@lua@populate@insertwhatsit@inner | |
582 | 592 | \protected\def\insert{\begingroup\afterassignment\ltj@@insert@A\ltj@tempcnta} |
583 | 593 | \protected\def\ltj@@insert@A{\orig@insert\ltj@tempcnta\bgroup |
584 | 594 | \aftergroup\ltj@@insert@B\let\ltj@@next} |
585 | -\protected\def\ltj@@insert@B{\directlua{luatexja.direction.populate_insertion_dir_whatsit()}\endgroup} | |
595 | +\protected\def\ltj@@insert@B{\ltj@@lua@populate@insertwhatsit\endgroup} | |
586 | 596 | |
587 | 597 | %%%% vadjust |
588 | 598 | \let\ltj@@orig@vadjust=\vadjust |
@@ -606,7 +616,7 @@ | ||
606 | 616 | \newluafunction\ltj@@box@dirhook |
607 | 617 | \directlua{ |
608 | 618 | local t, ltjd = lua.get_functions_table(), luatexja.direction |
609 | - t[\the\ltj@@box@dirhook] | |
619 | + t[\the\ltj@@box@dirhook] | |
610 | 620 | = function() ltjd.set_list_direction_hook() end |
611 | 621 | } |
612 | 622 | \PushPreHook{hbox}{\luafunction\ltj@@box@dirhook\aftergroup\ltj@@reset@badness} |
@@ -642,6 +652,12 @@ | ||
642 | 652 | \AtBeginShipout{\directlua{luatexja.direction.finalize()}} |
643 | 653 | |
644 | 654 | %%%% \raise, \lower, \moveleft, \moveright |
655 | +\newluafunction\ltj@@lua@raisebox@inner | |
656 | +\directlua{ | |
657 | + local t = lua.get_functions_table() | |
658 | + t[\the\ltj@@lua@raisebox@inner]=luatexja.direction.raise_box | |
659 | +} | |
660 | +\protected\luadef\ltj@@lua@raisebox\ltj@@lua@raisebox@inner | |
645 | 661 | \let\ltj@@orig@raise=\raise |
646 | 662 | \let\ltj@@orig@lower=\lower |
647 | 663 | \protected\def\raise{\ltj@reset@globaldefs\afterassignment\ltj@@raise\ltj@tempdima} |
@@ -649,8 +665,7 @@ | ||
649 | 665 | \protected\def\ltj@@raise{% |
650 | 666 | \ltj@restore@globaldefs |
651 | 667 | \edef\ltj@@raise@a{% |
652 | - \noexpand\directlua{luatexja.direction.raise_box()}% | |
653 | - \ltj@@orig@raise\the\ltj@tempdima\noexpand\box\ltj@afbox | |
668 | + \ltj@@lua@raisebox\ltj@@orig@raise\the\ltj@tempdima\noexpand\box\ltj@afbox | |
654 | 669 | }\ltj@afterbox\ltj@@raise@a} |
655 | 670 | \let\ltj@@orig@moveleft=\moveleft |
656 | 671 | \let\ltj@@orig@moveright=\moveright |
@@ -659,8 +674,7 @@ | ||
659 | 674 | \protected\def\ltj@@moveleft{% |
660 | 675 | \ltj@restore@globaldefs |
661 | 676 | \edef\ltj@@moveleft@a{% |
662 | - \noexpand\directlua{luatexja.direction.raise_box()}% | |
663 | - \ltj@@orig@moveleft\the\ltj@tempdima\noexpand\box\ltj@afbox | |
677 | + \ltj@@lua@raisebox\ltj@@orig@moveleft\the\ltj@tempdima\noexpand\box\ltj@afbox | |
664 | 678 | }\ltj@afterbox\ltj@@moveleft@a} |
665 | 679 | |
666 | 680 | %%%%\vsplit |
@@ -670,22 +684,25 @@ | ||
670 | 684 | \let\ltj@@orig@vcenter=\vcenter |
671 | 685 | \protected\def\vcenter{\ltj@afterbox\ltj@@vcenter\vbox} |
672 | 686 | \protected\def\ltj@@vcenter{% |
673 | - \directlua{luatexja.direction.raise_box()}% | |
674 | - \ltj@@orig@vcenter{\box\ltj@afbox}% | |
687 | + \ltj@@lua@raisebox\ltj@@orig@vcenter{\box\ltj@afbox}% | |
675 | 688 | } |
676 | 689 | |
677 | 690 | %%%% \unhbox and \unvbox |
691 | +\newluafunction\ltj@@lua@unboxcheckdir@inner | |
692 | +\directlua{ | |
693 | + local t = lua.get_functions_table() | |
694 | + t[\the\ltj@@lua@unboxcheckdir@inner]=luatexja.direction.unbox_check_dir | |
695 | +} | |
696 | +\luadef\ltj@@lua@unboxcheckdir\ltj@@lua@unboxcheckdir@inner | |
678 | 697 | \long\def \@gobbletwo #1#2{} |
679 | 698 | \let\ltj@@orig@unhbox=\unhbox |
680 | 699 | \let\ltj@@orig@unvbox=\unvbox |
681 | 700 | \protected\def\unhbox{\ltj@reset@globaldefs\afterassignment\ltj@@unhbox\ltj@tempcnta} |
682 | 701 | \protected\def\unvbox{\ltj@reset@globaldefs\afterassignment\ltj@@unvbox\ltj@tempcnta} |
683 | 702 | \protected\def\ltj@@unhbox{% |
684 | - \directlua{luatexja.direction.unbox_check_dir()}% | |
685 | - \ltj@@orig@unhbox\ltj@tempcnta} | |
703 | + \ltj@@lua@unboxcheckdir\ltj@@orig@unhbox\ltj@tempcnta} | |
686 | 704 | \protected\def\ltj@@unvbox{% |
687 | - \directlua{luatexja.direction.unbox_check_dir()}% | |
688 | - \ltj@@orig@unvbox\ltj@tempcnta} | |
705 | + \ltj@@lua@unboxcheckdir\ltj@@orig@unvbox\ltj@tempcnta} | |
689 | 706 | \let\ltj@@orig@unhcopy=\unhcopy |
690 | 707 | \let\ltj@@orig@unvcopy=\unvcopy |
691 | 708 | \protected\def\unhcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy\ltj@tempcnta} |
@@ -232,7 +232,9 @@ do | ||
232 | 232 | } |
233 | 233 | |
234 | 234 | local unary_pars = luatexja.unary_pars |
235 | - function luatexja.ext_get_parameter_unary(k) | |
235 | + local scan_arg = token.scan_argument | |
236 | + function luatexja.ext_get_parameter_unary() | |
237 | + local k= scan_arg() | |
236 | 238 | if unary_pars[k] then |
237 | 239 | tex.write(tostring(unary_pars[k](tex.getcount('ltj@@stack')))) |
238 | 240 | end |
@@ -289,9 +291,9 @@ do | ||
289 | 291 | end, |
290 | 292 | } |
291 | 293 | local binary_pars = luatexja.binary_pars |
292 | - | |
294 | + local scan_arg, scan_int = token.scan_argument, token.scan_int | |
293 | 295 | binary_pars.alxspmode = binary_pars.jaxspmode |
294 | - function luatexja.ext_get_parameter_binary(k,c) | |
296 | + function luatexja.ext_get_parameter_binary(k, c) | |
295 | 297 | if binary_pars[k] then |
296 | 298 | tex.write(tostring(binary_pars[k](c,tex.getcount('ltj@@stack')))) |
297 | 299 | end |
@@ -1039,7 +1039,8 @@ | ||
1039 | 1039 | \def\use@mathgroup#1#2{\relax\ifmmode |
1040 | 1040 | \math@bgroup |
1041 | 1041 | \expandafter\ifx\csname M@\f@encoding\endcsname#1\else |
1042 | - #1\fi\ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% | |
1042 | + #1\fi\ltj@tempcnta=#2 | |
1043 | + \expandafter\ltj@@mathJapaneseFonts\string#1/\relax% | |
1043 | 1044 | \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi |
1044 | 1045 | \expandafter\math@egroup\fi}% |
1045 | 1046 |
@@ -26,13 +26,12 @@ | ||
26 | 26 | \unless\ifltj@disablejfam |
27 | 27 | \cs_set:Npn \use@mathgroup #1 #2 |
28 | 28 | { |
29 | - %\typeout{UM <#1><#2>} | |
30 | 29 | \mode_if_math:T % <- not sure |
31 | 30 | { |
32 | 31 | \math@bgroup |
33 | 32 | \cs_if_eq:cNF {M@\f@encoding} #1 {#1} |
34 | 33 | \__um_switchto_literal: |
35 | - \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% | |
34 | + \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1/\relax% | |
36 | 35 | \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi |
37 | 36 | \math@egroup |
38 | 37 | } |