summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-11 13:10:41 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-11 13:10:41 +0200
commitf2934972c3a6e908624baf77833076cf2fa2f837 (patch)
treeca028b946aec6b841a41d072569dbd99450cc19e
parent030c5eb4e199acdc322c2df3c35c709cb80c1631 (diff)
downloadluaotfload-f2934972c3a6e908624baf77833076cf2fa2f837.tar.gz
[type1] resolve conflict between TFM and AFM loaders
-rw-r--r--luaotfload-loaders.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/luaotfload-loaders.lua b/luaotfload-loaders.lua
index 56bdf96..6d6f409 100644
--- a/luaotfload-loaders.lua
+++ b/luaotfload-loaders.lua
@@ -17,6 +17,7 @@ local filebasename = file.basename
local stringsub = string.sub
local stringlower = string.lower
local stringupper = string.upper
+local findbinfile = resolvers.findbinfile
local lpeg = require "lpeg"
local lpegmatch = lpeg.match
@@ -52,6 +53,31 @@ resolvers.loadbinfile = function (filename, filetype)
end
+--- this function is required because AFM precedes TFM in the reader
+--- chain (see definers.loadfont() in font-def.lua
+
+local check_tfm = function (specification, fullname)
+
+ local foundname = findbinfile (fullname, "tfm") or ""
+
+ if foundname == "" then
+ foundname = findbinfile (fullname, "ofm") or ""
+ end
+
+ if foundname == "" then
+ foundname = fonts.names.getfilename (fullname,"tfm") or ""
+ end
+
+ if foundname ~= "" then
+ specification.filename = foundname
+ specification.format = "ofm"
+ return font.read_tfm (specification.filename,
+ specification.size)
+ end
+end
+
+readers.check_tfm = check_tfm
+
--[[ <EXPERIMENTAL> ]]
--[[doc--