summaryrefslogtreecommitdiff
path: root/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-11 02:08:49 -0700
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-11 02:08:49 -0700
commit0aed99a49103b61e93d68ee7b3132fbc9f5adc42 (patch)
treebccf64885a749d827c68716add305f9a16ba4300 /luaotfload-database.lua
parent339587c3f627b206ef15e7207f63d88df73217ef (diff)
parent61a24f830504da4252dbc3c8de4b273749174580 (diff)
downloadluaotfload-0aed99a49103b61e93d68ee7b3132fbc9f5adc42.tar.gz
Merge pull request #122 from phi-gamma/master
integrate Context AFM libraries
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r--luaotfload-database.lua48
1 files changed, 31 insertions, 17 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 49e9bcb..d8c934d 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -1320,18 +1320,8 @@ local loaders = {
ttc = ot_fullinfo,
ttf = ot_fullinfo,
- afm = function (filename, _, texmf, basename)
- --- TODO
- local pfbname = filereplacesuffix (filename, "pfb")
- if lfsisfile (pfbname) then
- return t1_fullinfo (pfbname, nil, texmf, basename)
- end
- report ("both", 1, "db",
- "Cannot find matching pfb for %s; skipping.", basename)
- return false
- end,
- pfb = t1_fullinfo,
- pfa = t1_fullinfo,
+ pfb = t1_fullinfo,
+ pfa = t1_fullinfo,
}
--- we return true if the fond is new or re-indexed
@@ -1670,10 +1660,22 @@ process_dir_tree = function (acc, dirs)
then
dirs[#dirs+1] = fullpath
elseif lfsisfile (fullpath) then
- if lpegmatch (p_font_filter, stringlower (ent))
- then
- newfiles[#newfiles+1] = fullpath
+ ent = stringlower (ent)
+
+ if lpegmatch (p_font_filter, ent) then
+ if filesuffix (ent) == "afm" then
+ --- fontloader.open() will load the afm
+ --- iff both files are in the same directory
+ local pfbpath = filereplacesuffix
+ (fullpath, "pfb")
+ if lfsisfile (pfbpath) then
+ newfiles[#newfiles+1] = pfbpath
+ end
+ else
+ newfiles[#newfiles+1] = fullpath
+ end
end
+
end
end
end
@@ -1694,9 +1696,21 @@ local process_dir = function (dir)
if ent ~= "." and ent ~= ".." and not blacklist[ent] then
local fullpath = dir .. "/" .. ent
if lfsisfile (fullpath) then
- if lpegmatch (p_font_filter, stringlower (ent))
+ ent = stringlower (ent)
+ if lpegmatch (p_font_filter, ent)
then
- files[#files+1] = fullpath
+ if filesuffix (ent) == "afm" then
+ --- fontloader.open() will load the afm
+ --- iff both files are in the same
+ --- directory
+ local pfbpath = filereplacesuffix
+ (fullpath, "pfb")
+ if lfsisfile (pfbpath) then
+ files[#files+1] = pfbpath
+ end
+ else
+ files[#files+1] = fullpath
+ end
end
end
end