summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-14 12:22:47 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-14 12:22:47 +0200
commit6e0a3b1bf597516a1d90398071a04d804f893467 (patch)
treec5803eae65b20d73652fc23b4000bcc1a53ac4a3
parent27b8ab4bbb81df7ae0ec1dc8bc231f18d42131ff (diff)
downloadluaotfload-6e0a3b1bf597516a1d90398071a04d804f893467.tar.gz
load filesystem libs prior to handling the cache directories
-rw-r--r--luaotfload.dtx44
1 files changed, 30 insertions, 14 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 16f7bf6..1438e8e 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1499,6 +1499,34 @@ if tex.luatexversion < luatex_version then
end
% \end{macrocode}
+% \subsection{Module loading}
+% We load the files imported from \CONTEXT with this function.
+% It automatically prepends the prefix \fileent{luaotfload-} to its
+% argument, so we can refer to the files with their actual \CONTEXT name.
+%
+% \begin{macrocode}
+
+local fl_prefix = "luaotfload" -- “luatex” for luatex-plain
+local loadmodule = function (name)
+ require(fl_prefix .."-"..name)
+end
+
+% \end{macrocode}
+% The font loader expects the \TEX Live cache directories to be in
+% place and due to some quirk in \fileent{data-con.lua} they are
+% fixed during the run. It follows that we have to ensure their
+% presence before we can initialize the fontloader.
+% The most reliable way to do so is by using the
+% \luafunction{mkdirs()} function from \CONTEXT’s
+% \fileent{l-dir.lua}.
+% Unfortunately, for this to work we need to to preload substantial
+% parts of the \LUA libraries.
+%
+% \begin{macrocode}
+
+loadmodule"filesystem-merged.lua"
+
+% \end{macrocode}
% Prepare directories: the cache function in Luatex-Fonts checks for a
% writable directory only once during startup. If there is no
% \fileent{texmf-var} at this time it will create a subdirectory
@@ -1507,7 +1535,9 @@ end
%
% \begin{macrocode}
+
local cachepath = kpse.expand_var"$TEXMFVAR"
+
if not lfs.isdir(cachepath) then
dir.mkdirs(cachepath)
if not lfs.isdir(cachepath) then
@@ -1516,19 +1546,6 @@ if not lfs.isdir(cachepath) then
end
% \end{macrocode}
-% \subsection{Module loading}
-% We load the files imported from \CONTEXT with this function.
-% It automatically prepends the prefix \fileent{luaotfload-} to its
-% argument, so we can refer to the files with their actual \CONTEXT name.
-%
-% \begin{macrocode}
-
-local fl_prefix = "luaotfload" -- “luatex” for luatex-plain
-local loadmodule = function (name)
- require(fl_prefix .."-"..name)
-end
-
-% \end{macrocode}
% Before \TeX Live 2013 version, \LUATEX had a bug that made ofm fonts fail
% when called with their extension. There was a side-effect making ofm
% totally unloadable when luaotfload was present. The following lines are
@@ -1779,7 +1796,6 @@ add_to_callback("hpack_filter",
add_to_callback("find_vf_file",
find_vf_file, "luaotfload.find_vf_file")
-loadmodule"lib-dir.lua" --- required by luaofload-database.lua
loadmodule"override.lua" --- “luat-ovr”
logs.set_loglevel(config.luaotfload.loglevel)