diff options
| author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2010-05-18 16:09:41 +0300 | 
|---|---|---|
| committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2010-05-18 16:09:41 +0300 | 
| commit | d5a6caa4e9ecff79f41333d7c13843543566efac (patch) | |
| tree | 435a18774e320e50188e244d3fbd735d279eec38 | |
| parent | baa8e11f556a659aa9769afe4b28d0c2b52e73a5 (diff) | |
| download | luaotfload-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.
| -rw-r--r-- | otfl-font-nms.lua | 16 | 
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)  | 
