diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-syn.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/font-syn.lua | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-syn.lua b/Master/texmf-dist/tex/context/base/font-syn.lua index 1d444cdc705..c4f0e948b87 100644 --- a/Master/texmf-dist/tex/context/base/font-syn.lua +++ b/Master/texmf-dist/tex/context/base/font-syn.lua @@ -13,6 +13,7 @@ local next, tonumber = next, tonumber local gsub, lower, match, find, lower, upper = string.gsub, string.lower, string.match, string.find, string.lower, string.upper local find, gmatch = string.find, string.gmatch local concat, sort, format = table.concat, table.sort, string.format +local serialize = table.serialize local lpegmatch = lpeg.match local utfgsub, utflower = utf.gsub, utf.lower local unpack = unpack or table.unpack @@ -31,8 +32,6 @@ local report_names = logs.reporter("fonts","names") using a table that has keys filtered from the font related files.</p> --ldx]]-- -local texsprint = (tex and tex.sprint) or print - fonts = fonts or { } -- also used elsewhere local names = { } @@ -316,7 +315,7 @@ local function cleanname(name) end local function cleanfilename(fullname,defaultsuffix) - local _, _, name, suffix = file.splitname(fullname) + local path, name, suffix = file.splitname(fullname) name = gsub(lower(name),"[^%a%d]","") if suffix and suffix ~= "" then return name .. ".".. suffix @@ -916,10 +915,12 @@ local function is_reloaded() if not reloaded then local data = names.data if autoreload then - local c_status = table.serialize(resolvers.datastate()) - local f_status = table.serialize(data.datastate) + local c_status = serialize(resolvers.datastate()) + local f_status = serialize(data.datastate) if c_status == f_status then - report_names("font database has matching configuration and file hashes") + if trace_names then + report_names("font database has matching configuration and file hashes") + end return else report_names("font database has mismatching configuration and file hashes") @@ -1024,14 +1025,28 @@ function names.resolve(askedname,sub) end end +-- function names.getfilename(askedname,suffix) -- last resort, strip funny chars +-- names.load() +-- local files = names.data.files +-- askedname = files and files[cleanfilename(askedname,suffix)] or "" +-- if askedname == "" then +-- return "" +-- else -- never entered +-- return resolvers.findbinfile(askedname,suffix) or "" +-- end +-- end + function names.getfilename(askedname,suffix) -- last resort, strip funny chars names.load() local files = names.data.files - askedname = files and files[cleanfilename(askedname,suffix)] or "" - if askedname == "" then - return "" - else - return resolvers.findbinfile(askedname,suffix) or "" + local cleanname = cleanfilename(askedname,suffix) + local found = files and files[cleanname] or "" + if found == "" and is_reloaded() then + files = names.data.files + found = files and files[cleanname] or "" + end + if found and found ~= "" then + return resolvers.findbinfile(found,suffix) or "" -- we still need to locate it end end @@ -1240,7 +1255,7 @@ local function collect(stage,found,done,name,weight,style,width,variant,all) report_names("resolving name '%s', weight '%s', style '%s', width '%s', variant '%s'", name or "?",tostring(weight),tostring(style),tostring(width),tostring(variant)) end - --~ print(name,table.serialize(family)) + --~ print(name,serialize(family)) if weight and weight ~= "" then if style and style ~= "" then if width and width ~= "" then |