diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
commit | 15995e10bfc68edf79970c4ea4fbb6678566c46e (patch) | |
tree | 2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/font-syn.lua | |
parent | c9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff) |
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
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 |