summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua68
1 files changed, 65 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua
index ffabda8e114..3946b6f399e 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-dum.lua
@@ -23,6 +23,11 @@ trackers = {
enable = dummyfunction,
disable = dummyfunction,
}
+experiments = {
+ register = dummyfunction,
+ enable = dummyfunction,
+ disable = dummyfunction,
+}
storage = {
register = dummyfunction,
shared = { },
@@ -37,6 +42,9 @@ tasks = {
appendaction = dummyfunction,
prependaction = dummyfunction,
}
+callbacks = {
+ register = function(n,f) return callback.register(n,f) end,
+}
-- we need to cheat a bit here
@@ -49,13 +57,14 @@ local remapper = {
ttf = "truetype fonts",
ttc = "truetype fonts",
dfont = "truetype dictionary",
- cid = "other text files", -- will become "cid files"
+ cid = "cid maps",
+ fea = "font feature files",
}
function resolvers.find_file(name,kind)
name = string.gsub(name,"\\","\/")
- kind = kind and string.lower(kind)
- return kpse.find_file(name,(kind and kind ~= "" and (remapper[kind] or kind)) or "tex")
+ kind = string.lower(kind)
+ return kpse.find_file(name,(kind and kind ~= "" and (remapper[kind] or kind)) or file.extname(name,"tex"))
end
function resolvers.findbinfile(name,kind)
@@ -64,3 +73,56 @@ function resolvers.findbinfile(name,kind)
end
return resolvers.find_file(name,(kind and remapper[kind]) or kind)
end
+
+-- Caches ... I will make a real stupid version some day when I'm in the
+-- mood. After all, the generic code does not need the more advanced
+-- ConTeXt features. Cached data is not shared between ConTeXt and other
+-- usage as I don't want any dependency at all. Also, ConTeXt might have
+-- different needs and tricks added.
+
+caches = { }
+
+--~ containers.usecache = true
+
+function caches.setpath(category,subcategory)
+-- local root = kpse.var_value("TEXMFCACHE") or ""
+-- if root == "" then
+-- root = kpse.var_value("VARTEXMF") or ""
+-- end
+ local var = kpse.var_value("TEXMFVAR")
+ local root = var and (var .. "/luatex/generic/luaotfload/") or ""
+ if root ~= "" then
+ root = file.join(root,category)
+ lfs.mkdir(root)
+ root = file.join(root,subcategory)
+ lfs.mkdir(root)
+ return lfs.isdir(root) and root
+ end
+end
+
+local function makefullname(path,name)
+ if path and path ~= "" then
+ name = "temp-" and name -- clash prevention
+ return file.addsuffix(file.join(path,name),"lua")
+ end
+end
+
+function caches.iswritable(path,name)
+ local fullname = makefullname(path,name)
+ return fullname and file.iswritable(fullname)
+end
+
+function caches.loaddata(path,name)
+ local fullname = makefullname(path,name)
+ if fullname then
+ local data = loadfile(fullname)
+ return data and data()
+ end
+end
+
+function caches.savedata(path,name,data)
+ local fullname = makefullname(path,name)
+ if fullname then
+ table.tofile(fullname,data,'return',false,true,false)
+ end
+end