This is related to the closed pull request #323 but perhaps with slightly different motivation.
If luaotfload is called from tex via \RequirePackage{luaotfload} or similar then the usual latex mechanisms mean it is safe to do twice, with the second being a no-op.
If you initialise directly from lua the sequence is
require('luaotfload-main')
local _void = luaotfload.main ()
But if you do that twice, the require mechanism only loads the package the first time but main() dies the second time with
Module luatexbase Error: Unable to create callback `luaotfload.patch_font':
(luatexbase) callback type disallowed as name on input line 49
Would it be possible for luaotfload.main () to check an internal flag and see that luaotfload is already initialised and if so silently do nothing?
The motivation here is that we are considering (finally:-) to make lualatex and xelatex default to Unicode encoding which means in lualatex case adding something to \everyjob to load luaotfload.
I'd hoped to just use lua rather than load a latex package at that point but this issue probably prevents that as having done so, any document using
\usepackage{luaotfload}
dies with the above error.
Can work around that, but it seemed worth putting in a feature request....
This is related to the closed pull request #323 but perhaps with slightly different motivation.
If luaotfload is called from tex via
\RequirePackage{luaotfload}or similar then the usual latex mechanisms mean it is safe to do twice, with the second being a no-op.If you initialise directly from lua the sequence is
But if you do that twice, the
requiremechanism only loads the package the first time butmain()dies the second time withWould it be possible for
luaotfload.main ()to check an internal flag and see thatluaotfloadis already initialised and if so silently do nothing?The motivation here is that we are considering (finally:-) to make lualatex and xelatex default to Unicode encoding which means in lualatex case adding something to \everyjob to load luaotfload.
I'd hoped to just use lua rather than load a latex package at that point but this issue probably prevents that as having done so, any document using
\usepackage{luaotfload}dies with the above error.
Can work around that, but it seemed worth putting in a feature request....