• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: Commit

ソースコードの管理場所


Commit MetaInfo

Revisão3595d4d3e27447080f9f6012f157388cfce244dd (tree)
Hora2020-04-01 10:29:40
AutorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Mensagem de Log

more use of \luadef

Mudança Sumário

Diff

--- a/src/luatexja-core.sty
+++ b/src/luatexja-core.sty
@@ -469,9 +469,12 @@
469469 {\ltj@@getparam@two{#1}}%
470470 {\ltj@@getparam@one{#1}}%
471471 }
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
475478 \def\ltj@@getparam@two#1#2{%
476479 \directlua{luatexja.ext_get_parameter_binary('#1', \ltj@safe@num@or{nil}{#2})}%
477480 }
@@ -491,7 +494,7 @@
491494 end
492495 end
493496 }
494-\protected\def\ltj@alljachar{\luafunction\ltj@alljachar@inner}
497+\protected\luadef\ltj@alljachar\ltj@alljachar@inner
495498 \protected\def\ltj@allalchar{\relax
496499 \csname ltj@kcat0\endcsname="7FFFFFFF %"
497500 \csname ltj@kcat1\endcsname="7FFFFFFF %"
@@ -579,10 +582,17 @@
579582
580583 %%%% insert
581584 \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
582592 \protected\def\insert{\begingroup\afterassignment\ltj@@insert@A\ltj@tempcnta}
583593 \protected\def\ltj@@insert@A{\orig@insert\ltj@tempcnta\bgroup
584594 \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}
586596
587597 %%%% vadjust
588598 \let\ltj@@orig@vadjust=\vadjust
@@ -606,7 +616,7 @@
606616 \newluafunction\ltj@@box@dirhook
607617 \directlua{
608618 local t, ltjd = lua.get_functions_table(), luatexja.direction
609- t[\the\ltj@@box@dirhook]
619+ t[\the\ltj@@box@dirhook]
610620 = function() ltjd.set_list_direction_hook() end
611621 }
612622 \PushPreHook{hbox}{\luafunction\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
@@ -642,6 +652,12 @@
642652 \AtBeginShipout{\directlua{luatexja.direction.finalize()}}
643653
644654 %%%% \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
645661 \let\ltj@@orig@raise=\raise
646662 \let\ltj@@orig@lower=\lower
647663 \protected\def\raise{\ltj@reset@globaldefs\afterassignment\ltj@@raise\ltj@tempdima}
@@ -649,8 +665,7 @@
649665 \protected\def\ltj@@raise{%
650666 \ltj@restore@globaldefs
651667 \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
654669 }\ltj@afterbox\ltj@@raise@a}
655670 \let\ltj@@orig@moveleft=\moveleft
656671 \let\ltj@@orig@moveright=\moveright
@@ -659,8 +674,7 @@
659674 \protected\def\ltj@@moveleft{%
660675 \ltj@restore@globaldefs
661676 \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
664678 }\ltj@afterbox\ltj@@moveleft@a}
665679
666680 %%%%\vsplit
@@ -670,22 +684,25 @@
670684 \let\ltj@@orig@vcenter=\vcenter
671685 \protected\def\vcenter{\ltj@afterbox\ltj@@vcenter\vbox}
672686 \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}%
675688 }
676689
677690 %%%% \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
678697 \long\def \@gobbletwo #1#2{}
679698 \let\ltj@@orig@unhbox=\unhbox
680699 \let\ltj@@orig@unvbox=\unvbox
681700 \protected\def\unhbox{\ltj@reset@globaldefs\afterassignment\ltj@@unhbox\ltj@tempcnta}
682701 \protected\def\unvbox{\ltj@reset@globaldefs\afterassignment\ltj@@unvbox\ltj@tempcnta}
683702 \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}
686704 \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}
689706 \let\ltj@@orig@unhcopy=\unhcopy
690707 \let\ltj@@orig@unvcopy=\unvcopy
691708 \protected\def\unhcopy{\ltj@reset@globaldefs\afterassignment\ltj@@unhcopy\ltj@tempcnta}
--- a/src/luatexja.lua
+++ b/src/luatexja.lua
@@ -232,7 +232,9 @@ do
232232 }
233233
234234 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()
236238 if unary_pars[k] then
237239 tex.write(tostring(unary_pars[k](tex.getcount('ltj@@stack'))))
238240 end
@@ -289,9 +291,9 @@ do
289291 end,
290292 }
291293 local binary_pars = luatexja.binary_pars
292-
294+ local scan_arg, scan_int = token.scan_argument, token.scan_int
293295 binary_pars.alxspmode = binary_pars.jaxspmode
294- function luatexja.ext_get_parameter_binary(k,c)
296+ function luatexja.ext_get_parameter_binary(k, c)
295297 if binary_pars[k] then
296298 tex.write(tostring(binary_pars[k](c,tex.getcount('ltj@@stack'))))
297299 end
--- a/src/patches/lltjfont.sty
+++ b/src/patches/lltjfont.sty
@@ -1039,7 +1039,8 @@
10391039 \def\use@mathgroup#1#2{\relax\ifmmode
10401040 \math@bgroup
10411041 \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%
10431044 \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi
10441045 \expandafter\math@egroup\fi}%
10451046
--- a/src/patches/lltjp-unicode-math.sty
+++ b/src/patches/lltjp-unicode-math.sty
@@ -26,13 +26,12 @@
2626 \unless\ifltj@disablejfam
2727 \cs_set:Npn \use@mathgroup #1 #2
2828 {
29- %\typeout{UM <#1><#2>}
3029 \mode_if_math:T % <- not sure
3130 {
3231 \math@bgroup
3332 \cs_if_eq:cNF {M@\f@encoding} #1 {#1}
3433 \__um_switchto_literal:
35- \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
34+ \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1/\relax%
3635 \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi
3736 \math@egroup
3837 }
Show on old repository browser