diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2010-05-17 07:57:34 +0300 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2010-05-17 08:15:12 +0300 |
commit | 77e16fb8cde7fb30b4654311a8d7933524acd665 (patch) | |
tree | 503ba3a0b50f1f20114c2c9415cf27f727bd7c14 /otfl-font-nms.lua | |
parent | 76a32b5d836c6dd63e5fe1f9cd8e778294deddea (diff) | |
download | luaotfload-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.
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r-- | otfl-font-nms.lua | 38 |
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 |