summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-def.lua
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2014-05-05 20:29:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2014-05-05 20:29:55 +0000
commitba9a57343987f1c2c72396e7c38f1fa30352c24c (patch)
tree66a8b12cdf67427ce96770fd0e9e581759aade1c /Master/texmf-dist/tex/context/base/font-def.lua
parent15242121b8ddf7d4a041fb3998d295dd8232e1eb (diff)
ConTeXt 2014.04.28 23:24
git-svn-id: svn://tug.org/texlive/trunk@33856 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-def.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/font-def.lua37
1 files changed, 20 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-def.lua b/Master/texmf-dist/tex/context/base/font-def.lua
index bee02e8dc49..e5c5d990ce2 100644
--- a/Master/texmf-dist/tex/context/base/font-def.lua
+++ b/Master/texmf-dist/tex/context/base/font-def.lua
@@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['font-def'] = {
local format, gmatch, match, find, lower, gsub = string.format, string.gmatch, string.match, string.find, string.lower, string.gsub
local tostring, next = tostring, next
local lpegmatch = lpeg.match
+local suffixonly, removesuffix = file.suffix, file.removesuffix
local allocate = utilities.storage.allocate
@@ -112,7 +113,7 @@ addlookup("name")
addlookup("spec")
local function getspecification(str)
- return lpegmatch(splitter,str)
+ return lpegmatch(splitter,str or "") -- weird catch
end
definers.getspecification = getspecification
@@ -169,12 +170,13 @@ local resolvers = definers.resolvers
function resolvers.file(specification)
local name = resolvefile(specification.name) -- catch for renames
- local suffix = file.suffix(name)
+ local suffix = lower(suffixonly(name))
if fonts.formats[suffix] then
- specification.forced = suffix
- specification.name = file.removesuffix(name)
+ specification.forced = suffix
+ specification.forcedname = name
+ specification.name = removesuffix(name)
else
- specification.name = name -- can be resolved
+ specification.name = name -- can be resolved
end
end
@@ -185,12 +187,13 @@ function resolvers.name(specification)
if resolved then
specification.resolved = resolved
specification.sub = sub
- local suffix = file.suffix(resolved)
+ local suffix = lower(suffixonly(resolved))
if fonts.formats[suffix] then
- specification.forced = suffix
- specification.name = file.removesuffix(resolved)
+ specification.forced = suffix
+ specification.forcedname = resolved
+ specification.name = removesuffix(resolved)
else
- specification.name = resolved
+ specification.name = resolved
end
end
else
@@ -203,10 +206,11 @@ function resolvers.spec(specification)
if resolvespec then
local resolved, sub = resolvespec(specification.name,specification.sub,specification) -- we pass specification for overloaded versions
if resolved then
- specification.resolved = resolved
- specification.sub = sub
- specification.forced = file.suffix(resolved)
- specification.name = file.removesuffix(resolved)
+ specification.resolved = resolved
+ specification.sub = sub
+ specification.forced = lower(suffixonly(resolved))
+ specification.forcedname = resolved
+ specification.name = removesuffix(resolved)
end
else
resolvers.name(specification)
@@ -221,9 +225,8 @@ function definers.resolve(specification)
end
end
if specification.forced == "" then
- specification.forced = nil
- else
- specification.forced = specification.forced
+ specification.forced = nil
+ specification.forcedname = nil
end
specification.hash = lower(specification.name .. ' @ ' .. constructors.hashfeatures(specification))
if specification.sub and specification.sub ~= "" then
@@ -294,7 +297,7 @@ function definers.loadfont(specification)
if not tfmdata then
local forced = specification.forced or ""
if forced ~= "" then
- local reader = readers[lower(forced)]
+ local reader = readers[lower(forced)] -- normally forced is already lowered
tfmdata = reader and reader(specification)
if not tfmdata then
report_defining("forced type %a of %a not found",forced,specification.name)