summaryrefslogtreecommitdiff
path: root/tex/context/base/font-def.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-def.lua')
-rw-r--r--tex/context/base/font-def.lua35
1 files changed, 19 insertions, 16 deletions
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index 700921090..e5c5d990c 100644
--- a/tex/context/base/font-def.lua
+++ b/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
@@ -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)