\luadef\ltj@@start@time@measure\ltj@@start@time@measure@inner
\luadef\ltj@@stop@time@measure\ltj@@stop@time@measure@inner
+\let\ltj@@convert@input@path@to@lua\relax % defined in LaTeX only (ltj-latex.sty)
+
%%%%%%%% \jfont\CS={...:...;jfm=metric;...}, \globaljfont
\protected\def\jfont#1{%
- \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'yoko')}}
+ \ltj@@convert@input@path@to@lua\def\ltj@temp{#1}%
+ \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'yoko')}}
\protected\def\globaljfont#1{%
- \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'yoko')}}
+ \ltj@@convert@input@path@to@lua\def\ltj@temp{#1}%
+ \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'yoko')}}
\newluafunction\ltj@@jfont@inner
\directlua{
(lua.get_functions_table())[\the\ltj@@jfont@inner] = luatexja.jfont.jfontdefY
%%%%%%%% \tfont\CS={...:...;jfm=metric;...}, \globaltfont
\protected\def\tfont#1{%
- \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'tate')}}
+ \ltj@@convert@input@path@to@lua\def\ltj@temp{#1}%
+ \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'tate')}}
\protected\def\globaltfont#1{%
- \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'tate')}}
+ \ltj@@convert@input@path@to@lua\def\ltj@temp{#1}%
+ \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'tate')}}
%%%%%%%% \zw, \zh
\newluafunction\ltj@zw@inner
require 'lualibs'
------------------------------------------------------------------------
-local function load_lua(fn)
- local found = kpse.find_file(fn, 'tex')
- if not found then
- tex.error("LuaTeX-ja error: File `" .. fn .. "' not found")
- else
- texio.write_nl('(' .. found .. ')'); dofile(found)
- end
+do
+ local ipath = {}
+ function luatexja.input_path_clear() for i in ipairs(ipath) do ipath[i]=nil end end
+ function luatexja.input_path_add(s) ipath[#ipath+1]=s end
+ function luatexja.load_lua(fn)
+ local found = kpse.find_file(fn, 'tex')
+ if not found then
+ for _,v in ipairs(ipath) do
+ found = kpse.find_file(v .. fn, 'tex'); if found then break end
+ end
+ end
+ if not found then
+ tex.error("LuaTeX-ja error: File `" .. fn .. "' not found")
+ else
+ texio.write_nl('(' .. found .. ')'); dofile(found)
+ end
+ end
end
-luatexja.load_lua = load_lua
function luatexja.load_module(name) require('ltj-' .. name.. '.lua') end
do
\ltj@@getjfontnumber#1%
\directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
}
+
+%%%% send \input@path data to lua
+\def\ltj@@convert@input@path@to@lua{%
+ \ltj@@cipath@clear
+ \ifdefined\input@path
+ \@tfor\ltj@temp:=\input@path\do{\ltj@@cipath@add{\ltj@temp}}%
+ \fi
+}
+\newluafunction\ltj@@cipath@clear@inner
+\directlua{
+ (lua.get_functions_table())[\the\ltj@@cipath@clear@inner] = luatexja.input_path_clear
+}
+\protected\luadef\ltj@@cipath@clear\ltj@@cipath@clear@inner
+\def\ltj@@cipath@add#1{\directlua{luatexja.input_path_add('\luatexluaescapestring#1')}}
\endinput