summaryrefslogtreecommitdiff
path: root/luaotfload-loaders.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-11 11:04:51 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-11 11:04:51 +0200
commit61a24f830504da4252dbc3c8de4b273749174580 (patch)
treebccf64885a749d827c68716add305f9a16ba4300 /luaotfload-loaders.lua
parentc0897794aaa6591684357318253009fc00f91ec9 (diff)
downloadluaotfload-61a24f830504da4252dbc3c8de4b273749174580.tar.gz
[lib] integrate AFM libraries
Diffstat (limited to 'luaotfload-loaders.lua')
-rw-r--r--luaotfload-loaders.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/luaotfload-loaders.lua b/luaotfload-loaders.lua
index 63e1d08..fd7c8c6 100644
--- a/luaotfload-loaders.lua
+++ b/luaotfload-loaders.lua
@@ -30,4 +30,61 @@ fonts.formats.pfa = "type1"
fonts.readers.pfa = pfa_reader
fonts.handlers.pfa = { }
+
+resolvers.openbinfile = function (filename)
+ if filename and filename ~= "" then
+ local f = io.open(filename,"rb")
+ if f then
+ --logs.show_load(filename)
+ local s = f:read("*a") -- io.readall(f) is faster but we never have large files here
+ if checkgarbage then
+ checkgarbage(#s)
+ end
+ f:close()
+ if s then
+ return true, s, #s
+ end
+ end
+ end
+ return loaders.notfound()
+end
+
+resolvers.loadbinfile = function (filename, filetype)
+
+ local fname = kpse.find_file (filename, filetype)
+
+ if fname and fname ~= "" then
+ return resolvers.openbinfile(fname)
+ else
+ return resolvers.loaders.notfound()
+ end
+
+end
+
+--[[ <EXPERIMENTAL> ]]
+
+--[[doc--
+
+ Here we load extra AFM libraries from Context.
+ In fact, part of the AFM support is contained in font-ext.lua, for
+ which the font loader has a replacement: luatex-fonts-ext.lua.
+ However, this is only a stripped down version with everything AFM
+ removed. For example, it lacks definitions of several AFM features
+ like italic correction, protrusion, expansion and so on. In order to
+ achieve full-fledged AFM support we will either have to implement our
+ own version of these or consult with Hans whether he would consider
+ including the AFM code with the font loader.
+
+ For the time being we stick with two AFM-specific libraries:
+ font-afm.lua and font-afk.lua. When combined, these already supply us
+ with basic features like kerning and ligatures. The rest can be added
+ in due time.
+
+--doc]]--
+
+require "luaotfload-font-afm.lua"
+require "luaotfload-font-afk.lua"
+
+--[[ </EXPERIMENTAL> ]]
+
-- vim:tw=71:sw=2:ts=2:expandtab