summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-05-17 07:57:34 +0300
committerKhaled Hosny <khaledhosny@eglug.org>2010-05-17 08:15:12 +0300
commit77e16fb8cde7fb30b4654311a8d7933524acd665 (patch)
tree503ba3a0b50f1f20114c2c9415cf27f727bd7c14
parent76a32b5d836c6dd63e5fe1f9cd8e778294deddea (diff)
downloadluaotfload-77e16fb8cde7fb30b4654311a8d7933524acd665.tar.gz
Only index the last found instance of a font
We were keeping previously found versions of the font in the database and only overriding the status[filename].index which is useless since names.resolve will then found the first instance.
-rw-r--r--otfl-font-nms.lua38
1 files changed, 26 insertions, 12 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index a31c37a..a3bc7e1 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -340,19 +340,22 @@ local function load_font(filename, fontnames, newfontnames, texmf)
local status = fontnames.status
local basefile = texmf and basename(filename) or filename
if filename then
+ local timestamp, db_timestamp
+ db_timestamp = status[basefile] and status[basefile].timestamp
+ timestamp = lfs.attributes(filename, "modification")
+
if newstatus[basefile] then
-- already indexed in this run
- return
+ if newstatus[basefile].timestamp == timestamp then
+ return
+ end
end
- local timestamp, db_timestamp
- db_timestamp = status[basefile] and status[basefile].timestamp
- timestamp = lfs.attributes(filename, "modification")
- newstatus[basefile] = { }
+ newstatus[basefile] = newstatus[basefile] or { }
newstatus[basefile].timestamp = timestamp
- newstatus[basefile].index = {}
+ newstatus[basefile].index = newstatus[basefile].index or { }
- if db_timestamp == timestamp or nd_timestamp == timestamp then
+ if db_timestamp == timestamp then
for _,v in ipairs(status[basefile].index) do
local index = #newstatus[basefile].index
newmappings[#newmappings+1] = mappings[v]
@@ -371,14 +374,25 @@ local function load_font(filename, fontnames, newfontnames, texmf)
if type(info) == "table" and #info > 1 then
for i in ipairs(info) do
local fullinfo = font_fullinfo(filename, i-1, texmf)
- local index = #newstatus[basefile].index
- newmappings[#newmappings+1] = fullinfo
- newstatus[basefile].index[index+1] = #newmappings
+ local index = newstatus[basefile].index[i]
+ if newstatus[basefile].index[i] then
+ index = newstatus[basefile].index[i]
+ else
+ index = #newmappings+1
+ end
+ newmappings[index] = fullinfo
+ newstatus[basefile].index[i] = index
end
else
local fullinfo = font_fullinfo(filename, false, texmf)
- newmappings[#newmappings+1] = fullinfo
- newstatus[basefile].index[1] = #newmappings
+ local index
+ if newstatus[basefile].index[1] then
+ index = newstatus[basefile].index[1]
+ else
+ index = #newmappings+1
+ end
+ newmappings[index] = fullinfo
+ newstatus[basefile].index[1] = index
end
else
if trace_loading then