• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: Commit

ソースコードの管理場所


Commit MetaInfo

Revisãof9c1262aab2fb3fc9ef89d452085cd3ea4d990fe (tree)
Hora2020-04-02 07:44:40
AutorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Mensagem de Log

more luadef

Mudança Sumário

Diff

--- a/src/ltj-inputbuf.lua
+++ b/src/ltj-inputbuf.lua
@@ -31,16 +31,19 @@ local function add_comment(buffer)
3131 if i>0 then
3232 local c = utfbyte(buffer, i)
3333 if c>=0x80 then
34- local ct = getcatcode(c)
3534 local te = tex.endlinechar
3635 local ctl = (te ~= -1) and (getcatcode(te)==5) and (getcatcode(getcount('ltjlineendcomment'))==14)
37- -- Is the catcode of endline character is 5 (end-of-line)?
3836 -- Is the catcode of \ltjlineendcomment (new comment char) is 14 (comment)?
39- if ((ct==11) or (ct==12)) and ctl then
40- if ltjc_is_japanese_char_curlist(c) then
41- buffer = buffer .. utfchar(getcount('ltjlineendcomment'))
37+ -- Is the catcode of endline character is 5 (end-of-line)?
38+ if ctl then
39+ local ct = getcatcode(c)
40+ if (ct==11) or (ct==12) then
41+ if ltjc_is_japanese_char_curlist(c) then
42+ stop_time_measure('inputbuf')
43+ return buffer .. utfchar(getcount('ltjlineendcomment'))
44+ end
4245 end
43- end
46+ end
4447 end
4548 end
4649 stop_time_measure('inputbuf')
--- a/src/luatexja-core.sty
+++ b/src/luatexja-core.sty
@@ -200,11 +200,24 @@
200200
201201 %%%%%%%% Redefine \/
202202 \newluafunction\ltj@@italic@inner
203+\newluafunction\ltj@@start@time@measure@inner
204+\newluafunction\ltj@@stop@time@measure@inner
203205 \directlua{
204206 local t = lua.get_functions_table()
207+ local start_time_measure = luatexja.base.start_time_measure
208+ local stop_time_measure = luatexja.base.stop_time_measure
209+ local scan_arg = token.scan_argument
205210 t[\the\ltj@@italic@inner] = luatexja.jfont.append_italic
211+ t[\the\ltj@@start@time@measure@inner] = function()
212+ start_time_measure(scan_arg())
213+ end
214+ t[\the\ltj@@stop@time@measure@inner] = function()
215+ stop_time_measure(scan_arg())
216+ end
206217 }
207218 \protected\def\/{\relax\luafunction\ltj@@italic@inner}
219+\luadef\ltj@@start@time@measure\ltj@@start@time@measure@inner
220+\luadef\ltj@@stop@time@measure\ltj@@stop@time@measure@inner
208221
209222 %%%%%%%% \jfont\CS={...:...;jfm=metric;...}, \globaljfont
210223 \protected\def\jfont#1{%
@@ -253,8 +266,8 @@
253266 t[\the\ltj@@fakeparbegin@inner] = luatexja.jfmglue.create_beginpar_node
254267 t[\the\ltj@@fakeboxbdd@inner] = luatexja.jfmglue.create_boxbdd_node
255268 }
256-\protected\def\ltj@reset@globaldefs{\luafunction\ltj@reset@globaldefs@inner}
257-\protected\def\ltj@restore@globaldefs{\luafunction\ltj@restore@globaldefs@inner}
269+\protected\luadef\ltj@reset@globaldefs \ltj@reset@globaldefs@inner
270+\protected\luadef\ltj@restore@globaldefs\ltj@restore@globaldefs@inner
258271 \protected\def\inhibitglue{\ifhmode\relax\luafunction\ltj@@ihb@inner\fi}
259272 \protected\def\ltjfakeparbegin{\ifhmode\relax\luafunction\ltj@@fakeparbegin@inner\fi}
260273 \protected\def\ltjfakeboxbdd{\ifhmode\relax\luafunction\ltj@@fakeboxbdd@inner\fi}
@@ -394,8 +407,8 @@
394407 local d = scan_glue(); sss(sti.XSK, d); node.free(d)
395408 end
396409 }
397-\protected\def\ltjsetkanjiskip{\luafunction\ltjsetkanjiskip@inner}
398-\protected\def\ltjsetxkanjiskip{\luafunction\ltjsetxkanjiskip@inner}
410+\protected\luadef\ltjsetkanjiskip \ltjsetkanjiskip@inner
411+\protected\luadef\ltjsetxkanjiskip\ltjsetxkanjiskip@inner
399412
400413 % jcharwidowpenalty = <count>
401414 \define@key[ltj]{japaram}{jcharwidowpenalty}{% %COUNT
@@ -434,16 +447,16 @@
434447 \else\directlua{luatexja.isglobal=''}\fi
435448 }
436449 \protected\def\ltjsetparameter#1{%
437- \directlua{luatexja.base.start_time_measure('set_par')}%
450+ \ltj@@start@time@measure{set_par}%
438451 \ltj@setpar@global\setkeys[ltj]{japaram}{#1}%
439- \directlua{luatexja.base.stop_time_measure('set_par')}%
452+ \ltj@@stop@time@measure{set_par}%
440453 \ignorespaces}
441454 \protected\def\ltjglobalsetparameter#1{%
442455 \relax\ifnum\globaldefs<0\directlua{luatexja.isglobal=''}%
443456 \else\directlua{luatexja.isglobal='global'}\fi%
444- \directlua{luatexja.base.start_time_measure('set_par')}%
457+ \ltj@@start@time@measure{set_par}%
445458 \setkeys[ltj]{japaram}{#1}%
446- \directlua{luatexja.base.stop_time_measure('set_par')}%
459+ \ltj@@stop@time@measure{set_par}%
447460 \ignorespaces}
448461
449462 %%%%%%%% \ltjgetparameter
@@ -459,7 +472,7 @@
459472 \ltj@@decl@array@param{chartorange}
460473 \ltj@@decl@array@param{boxdir}
461474 \def\ltjgetparameter#1{%
462- \directlua{luatexja.base.start_time_measure('get_par')}%
475+ \ltj@@start@time@measure{get_par}%
463476 % stop call is moved in luatexja.lua
464477 \ifcsname ltj@@array@param/#1\endcsname
465478 \expandafter\ltx@firstoftwo
@@ -612,41 +625,34 @@
612625 }$%
613626 }
614627 \setbox\z@\box\voidb@x
628+\newluafunction\ltj@@box@dirhook@inner
629+\newluafunction\ltj@@reset@badness@inner
630+\directlua{
631+ local t, ltjd = lua.get_functions_table(), luatexja.direction
632+ t[\the\ltj@@box@dirhook@inner]
633+ = function() ltjd.set_list_direction_hook() end
634+ t[\the\ltj@@reset@badness@inner] = function()
635+ if luatexja.global_temp then
636+ tex.hbadness= tex.hbadness or luatexja.hbadness_temp
637+ tex.vbadness= tex.vbadness or luatexja.vbadness_temp
638+ tex.globaldefs= luatexja.global_temp or tex.globaldefs
639+ end
640+ end
641+}
642+\luadef\ltj@@box@dirhook\ltj@@box@dirhook@inner
615643 \ifltj@everyhook@avail% using everyhook package
616- \newluafunction\ltj@@box@dirhook
617- \directlua{
618- local t, ltjd = lua.get_functions_table(), luatexja.direction
619- t[\the\ltj@@box@dirhook]
620- = function() ltjd.set_list_direction_hook() end
621- }
622- \PushPreHook{hbox}{\luafunction\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
623- \PushPreHook{vbox}{\luafunction\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
644+ \PushPreHook{hbox}{\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
645+ \PushPreHook{vbox}{\ltj@@box@dirhook\aftergroup\ltj@@reset@badness}
624646 \else
625647 \let\ltj@@everyhbox=\everyhbox\let\ltj@@everyvbox=\everyvbox
626648 \newtoks\ltj@@i@everyhbox\newtoks\ltj@@i@everyvbox
627649 \let\everyhbox=\ltj@@i@everyhbox\let\everyvbox=\ltj@@i@everyvbox
628- \newluafunction\ltj@@box@dirhook
629- \directlua{
630- local t, ltjd = lua.get_functions_table(), luatexja.direction
631- t[\the\ltj@@box@dirhook]
632- = function() ltjd.set_list_direction_hook() end
633- }
634- \ltj@@everyhbox{\luafunction\ltj@@box@dirhook
650+ \ltj@@everyhbox{\ltj@@box@dirhook
635651 \aftergroup\ltj@@reset@badness\the\ltj@@i@everyhbox}
636- \ltj@@everyvbox{\luafunction\ltj@@box@dirhook
652+ \ltj@@everyvbox{\ltj@@box@dirhook
637653 \aftergroup\ltj@@reset@badness\the\ltj@@i@everyvbox}
638654 \fi
639655
640-\newluafunction\ltj@@reset@badness@inner
641-\directlua{
642- local t = lua.get_functions_table()
643- t[\the\ltj@@reset@badness@inner] = function()
644- if luatexja.global_temp then
645- tex.hbadness= tex.hbadness or luatexja.hbadness_temp
646- tex.vbadness= tex.vbadness or luatexja.vbadness_temp
647- tex.globaldefs= luatexja.global_temp or tex.globaldefs
648- end
649- end}
650656 \protected\def\ltj@@reset@badness{\luafunction\ltj@@reset@badness@inner}
651657
652658 \AtBeginShipout{\directlua{luatexja.direction.finalize()}}
--- a/src/patches/lltjfont.sty
+++ b/src/patches/lltjfont.sty
@@ -378,7 +378,7 @@
378378 }%
379379 \fi}
380380 \def\ltj@selectfont@patch{%
381- \directlua{luatexja.base.start_time_measure('selectfont')}%
381+ \ltj@@start@time@measure{selectfont}%
382382 \let\tmp@error@fontshape\error@fontshape
383383 \let\error@fontshape\error@kfontshape
384384 \ltj@@is@kyenc{\k@encoding}\ifin@%
@@ -416,7 +416,7 @@
416416 \fi
417417 \fi
418418 \global\let\font@name=\ltj@afont@name
419- \directlua{luatexja.base.stop_time_measure('selectfont')}%
419+ \ltj@@stop@time@measure{selectfont}%
420420 }
421421 \EverySelectfont{\ltj@selectfont@patch}
422422
Show on old repository browser