summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-06-22 12:01:00 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-06-22 12:01:00 +0200
commit51360bd326da1e0fcb10b1b311b49284ec480ed5 (patch)
tree9ac97b91d8cf29d2c2f2a079f65f71f972732a6d
parent17bf1b40c0aeaeb7ae0eac92e69e0f97d0b1a178 (diff)
downloadluaotfload-51360bd326da1e0fcb10b1b311b49284ec480ed5.tar.gz
fix input of cached resolver
-rw-r--r--luaotfload-auxiliary.lua2
-rw-r--r--luaotfload-database.lua22
2 files changed, 21 insertions, 3 deletions
diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua
index f310f1c..0dfabe6 100644
--- a/luaotfload-auxiliary.lua
+++ b/luaotfload-auxiliary.lua
@@ -358,7 +358,7 @@ do
local index = function (t, k)
if chardata == nil then
log("Loading character metadata from %s.", chardef)
- chardata = dofile(kpse.find_file("luaotfload-characters.lua"))
+ chardata = dofile(kpse.find_file("luaotfload-characters.lua", "lua"))
if chardata == nil then
warning("Could not load %s; continuing with empty character table.",
chardef)
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index b9695ad..8106898 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -465,11 +465,29 @@ Also, the fields “resolved”, “sub”, “force” etc. influence the outco
--doc]]--
+local concat_char = "#"
+local hash_fields = {
+ --- order is important
+ "specification", "style", "sub", "optsize", "size",
+}
+local n_hash_fields = #hash_fields
+
+--- spec -> string
+local hash_request = function (specification)
+ local key = { } --- segments of the hash
+ for i=1, n_hash_fields do
+ local field = specification[hash_fields[i]]
+ if field then
+ key[#key+1] = field
+ end
+ end
+ return tableconcat(key, concat_char)
+end
+
--- 'a -> 'a -> table -> (string * int|boolean * boolean)
resolve_cached = function (_, _, specification)
- --if not names.data then names.data = load_names() end
if not names.lookups then names.lookups = load_lookups() end
- local request = specification.specification
+ local request = hash_request(specification)
report("both", 4, "cache", "looking for “%s” in cache ...",
request)