summaryrefslogtreecommitdiff
path: root/otfl-font-nms.lua
diff options
context:
space:
mode:
authorElie Roux <elie.roux@telecom-bretagne.eu>2010-05-18 16:09:41 +0300
committerElie Roux <elie.roux@telecom-bretagne.eu>2010-05-18 16:09:41 +0300
commitd5a6caa4e9ecff79f41333d7c13843543566efac (patch)
tree435a18774e320e50188e244d3fbd735d279eec38 /otfl-font-nms.lua
parentbaa8e11f556a659aa9769afe4b28d0c2b52e73a5 (diff)
downloadluaotfload-d5a6caa4e9ecff79f41333d7c13843543566efac.tar.gz
If the specification is just a filename, not looking for it in the database
Now if specification.name ends by a font file extention, we look for the font file first with kpse and then in the database.
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r--otfl-font-nms.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 5dfa998..73dd577 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -110,6 +110,7 @@ function names.resolve(specification)
local name = sanitize(specification.name)
local style = sanitize(specification.style) or "regular"
+ local ext = lower(file.extname(specification.name))
local size
if specification.optsize then
@@ -127,6 +128,21 @@ function names.resolve(specification)
local data = names.data
if type(data) == "table" and data.version == names.version then
if data.mappings then
+ if ext == 'otf' or ext == 'ttf' or ext == 'ttc' or ext == 'dfont' then
+ local fname = specification.name
+ local path = resolvers.find_file(fname, "opentype fonts")
+ if not path then
+ path = resolvers.find_file(fname, "truetype fonts")
+ end
+ if not path then
+ for _,face in ipairs(data.mappings) do
+ if basename(face.filename[1]) == fname then
+ return face.filename[1], face.filename[2]
+ end
+ end
+ end
+ return specification.name
+ end
local found = { }
for _,face in ipairs(data.mappings) do
local family = sanitize(face.names.family)