summaryrefslogtreecommitdiff
path: root/luaotfload.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-14 20:26:01 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-14 20:26:01 +0200
commit9909991f8c403ef1119c44902de213695ae46318 (patch)
tree013a868ebc2ec6dfd1d488680dd756d9b0ce621e /luaotfload.lua
parenta9107ee964f128f6575813dd8d1b574d0006c8b9 (diff)
downloadluaotfload-9909991f8c403ef1119c44902de213695ae46318.tar.gz
add virtual font file lookup
Diffstat (limited to 'luaotfload.lua')
-rw-r--r--luaotfload.lua22
1 files changed, 21 insertions, 1 deletions
diff --git a/luaotfload.lua b/luaotfload.lua
index cfe29a6..6e951dd 100644
--- a/luaotfload.lua
+++ b/luaotfload.lua
@@ -33,6 +33,7 @@ local luatexbase = luatexbase
local type, next, dofile = type, next, dofile
local stringfind = string.find
+local find_file = kpse.find_file
local add_to_callback, create_callback =
luatexbase.add_to_callback, luatexbase.create_callback
@@ -63,7 +64,7 @@ if tex.luatexversion < luatex_version then
end
local loadmodule = function (name)
local tofind = fl_prefix .."-"..name
- local found = kpse.find_file(tofind,"tex")
+ local found = find_file(tofind,"tex")
if found then
log("loading file %s.", found)
dofile(found)
@@ -73,6 +74,23 @@ local loadmodule = function (name)
end
end
+--[[doc--
+Virtual fonts are resolved via a callback.
+\verb|find_vf_file| derives the name of the virtual font file from the
+filename.
+(NB: \CONTEXT\ handles this likewise in \textsf{font-vf.lua}.)
+--doc]]--
+local find_vf_file = function (name)
+ local fullname = find_file(name, "ovf")
+ if not fullname then
+ fullname = find_file(file.removesuffix(file.basename(name)), "ovf")
+ end
+ if fullname then
+ log("loading virtual font file %s.", fullname)
+ end
+ return fullname
+end
+
--[[-- keep --]]
--- from Hans (all merged):
@@ -200,6 +218,8 @@ add_to_callback("hpack_filter",
generic_context.callback_hpack_filter,
"luaotfload.node_processor",
1)
+add_to_callback("find_vf_file",
+ find_vf_file, "luaotfload.find_vf_file")
loadmodule"font-otc.lua" -- TODO check what we can drop from otfl-features