From f2934972c3a6e908624baf77833076cf2fa2f837 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 11 Aug 2013 13:10:41 +0200 Subject: [type1] resolve conflict between TFM and AFM loaders --- luaotfload-loaders.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'luaotfload-loaders.lua') 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 + --[[ ]] --[[doc-- -- cgit v1.2.3