From 61a24f830504da4252dbc3c8de4b273749174580 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 11 Aug 2013 11:04:51 +0200 Subject: [lib] integrate AFM libraries --- luaotfload-auxiliary.lua | 2 +- luaotfload-loaders.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 0a3ace8..da3f5f2 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -234,7 +234,7 @@ local set_capheight = function (fontdata) local shared = fontdata.shared local parameters = fontdata.parameters local capheight - if shared then + if shared and shared.rawdata.metadata.pfminfo then local units_per_em = parameters.units local size = parameters.size local os2_capheight = shared.rawdata.metadata.pfminfo.os2_capheight 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 + +--[[ ]] + +--[[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" + +--[[ ]] + -- vim:tw=71:sw=2:ts=2:expandtab -- cgit v1.2.3