From d5a6caa4e9ecff79f41333d7c13843543566efac Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Tue, 18 May 2010 16:09:41 +0300 Subject: 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. --- otfl-font-nms.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) -- cgit v1.2.3