summaryrefslogtreecommitdiff
path: root/luaotfload-loaders.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-loaders.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-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