From 9909991f8c403ef1119c44902de213695ae46318 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 14 Apr 2013 20:26:01 +0200 Subject: add virtual font file lookup --- luaotfload.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'luaotfload.lua') 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 -- cgit v1.2.3