summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-05-09 08:04:13 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-05-09 08:12:21 +0200
commit73b4fc1146ada179e7783fd118aa7f1377a09e52 (patch)
tree30100f08fe17261ccaa7c8fc5c49739127adcdba
parentad8c9fb7abbcd547dcc63e33abee2f2172c750eb (diff)
downloadluaotfload-73b4fc1146ada179e7783fd118aa7f1377a09e52.tar.gz
[db] fix inclusion of AFM fonts
The assumption that the AFM/PFB pair will reside in the same directory together is wrong for TeX Live. Hence the new lookup against kpse.
-rw-r--r--src/luaotfload-database.lua33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 437091f..7434b72 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -207,8 +207,7 @@ local make_luanames = function (path)
end
local format_precedence = {
- "otf", "ttc", "ttf", "afm",
- -- "pfb" --- may come back before Luatex 1.0
+ "otf", "ttc", "ttf", "afm", "pfb"
}
local location_precedence = {
@@ -1664,7 +1663,8 @@ local loaders = {
otf = ot_fullinfo,
ttc = ot_fullinfo,
ttf = ot_fullinfo,
---- pfb = t1_fullinfo,
+ afm = t1_fullinfo,
+ pfb = t1_fullinfo,
}
--- not side-effect free!
@@ -2057,6 +2057,16 @@ do
end
end
+local locate_matching_pfb = function (afmfile, dir)
+ local pfbname = filereplacesuffix (afmfile, "pfb")
+ local pfbpath = dir .. "/" .. pfbname
+ if lfsisfile (pfbpath) then
+ return pfbpath
+ end
+ --- Check for match in texmf too
+ return kpsefind_file (pfbname, "type1 fonts")
+end
+
local process_dir_tree
process_dir_tree = function (acc, dirs)
if not next (dirs) then --- done
@@ -2084,12 +2094,10 @@ process_dir_tree = function (acc, dirs)
ent = stringlower (ent)
if lpegmatch (p_font_filter, ent) then
+ newfiles[#newfiles+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
+ local pfbpath = locate_matching_pfb (ent, dir)
+ if pfbpath then
newfiles[#newfiles+1] = pfbpath
end
else
@@ -2121,12 +2129,8 @@ local process_dir = function (dir)
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
+ local pfbpath = locate_matching_pfb (ent, dir)
+ if pfbpath then
files[#files+1] = pfbpath
end
else
@@ -2261,6 +2265,7 @@ local collect_font_filenames_texmf = function ()
fontdirs = kpseexpand_path "$OPENTYPEFONTS"
fontdirs = fontdirs .. path_separator .. kpseexpand_path "$TTFONTS"
fontdirs = fontdirs .. path_separator .. kpseexpand_path "$T1FONTS"
+ fontdirs = fontdirs .. path_separator .. kpseexpand_path "$AFMFONTS"
if stringis_empty (fontdirs) then
return { }