diff options
-rw-r--r-- | src/luaotfload-init.lua | 21 | ||||
-rw-r--r-- | src/luaotfload-main.lua | 58 |
2 files changed, 28 insertions, 51 deletions
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua index 034ec57..4968877 100644 --- a/src/luaotfload-init.lua +++ b/src/luaotfload-init.lua @@ -14,6 +14,7 @@ Initialization phases: - Load Lualibs from package + - Set up the logger routines - Load Fontloader - as package specified in configuration - from Context install @@ -29,10 +30,30 @@ --doc]]-- +config = config or { } +local config = config +config.luaotfload = config.luaotfload or { } + +config.lualibs = config.lualibs or { } +config.lualibs.verbose = false +config.lualibs.prefer_merged = true +config.lualibs.load_extended = true + +require "lualibs" + +if not lualibs then error("this module requires Luaotfload") end if not luaotfload then error("this module requires Luaotfload") end local load_luaotfload_module = luaotfload.loaders.luaotfload local load_fontloader_module = luaotfload.loaders.fontloader +--[[doc-- + + The logger needs to be in place prior to loading the fontloader due + to order of initialization being crucial for the logger functions + that are swapped. + +--doc]]-- +load_luaotfload_module "log" diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index b12e3b7..a676685 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -4,7 +4,7 @@ -- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase -- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang -- VERSION: same as Luaotfload --- MODIFIED: 2015-05-26 07:51:29+0200 +-- MODIFIED: 2015-06-09 23:08:18+0200 ----------------------------------------------------------------------- -- --- Note: @@ -13,8 +13,7 @@ --- version 2.4 to 2.5. Thus, the comments are still in TeX (Latex) --- markup. -local initial_log_level = 0 - +local initial_log_level = 0 luaotfload = luaotfload or { } local luaotfload = luaotfload luaotfload.log = luaotfload.log or { } @@ -65,6 +64,7 @@ luaotfload.module = { local luatexbase = luatexbase +local require = require local setmetatable = setmetatable local type, next = type, next local stringlower = string.lower @@ -78,7 +78,7 @@ local create_callback = luatexbase.create_callback local reset_callback = luatexbase.reset_callback local call_callback = luatexbase.call_callback -local dummy_function = function () end --- XXX this will be moved to the luaotfload namespace when we have the init module +local dummy_function = function () end --- XXX this will be moved to the luaotfload namespace when we have the init module local error, warning, info, log = luatexbase.provides_module(luaotfload.module) @@ -92,8 +92,6 @@ luaotfload.log.tex = { --[[doc-- - XXX remove - We set the minimum version requirement for \LUATEX to v0.76, because the font loader requires recent features like direct attribute indexing and \luafunction{node.end_of_math()} that aren’t @@ -107,7 +105,8 @@ luaotfload.log.tex = { --doc]]-- local min_luatex_version = 79 --- i. e. 0.79 -local fontloader_package = "fontloader" --- default: from current Context +--local fontloader_package = "fontloader" --- default: from current Context +local fontloader_package = "slim" if tex.luatexversion < min_luatex_version then warning ("LuaTeX v%.2f is old, v%.2f or later is recommended.", @@ -116,15 +115,6 @@ if tex.luatexversion < min_luatex_version then warning ("using fallback fontloader -- newer functionality not available") fontloader_package = "tl2014" --- TODO fallback should be configurable too --- we install a fallback for older versions as a safety - if not node.end_of_math then - local math_t = node.id "math" - local traverse_nodes = node.traverse_id - node.end_of_math = function (n) - for n in traverse_nodes (math_t, n.next) do - return n - end - end - end end --[[doc-- @@ -148,7 +138,7 @@ local load_fontloader_module = make_loader "fontloader" luaotfload.loaders.luaotfload = load_luaotfload_module luaotfload.loaders.fontloader = load_fontloader_module -load_luaotfload_module "log" --- log messages +load_luaotfload_module "init" --- fontloader initialization local log = luaotfload.log local logreport = log.report @@ -157,38 +147,6 @@ log.set_loglevel (default_log_level) --[[doc-- - XXX remove - - Before \TeX Live 2013 version, \LUATEX had a bug that made ofm fonts - fail when called with their extension. There was a side-effect making - ofm totally unloadable when luaotfload was present. The following - lines are a patch for this bug. The utility of these lines is - questionable as they are not necessary since \TeX Live 2013. They - should be removed in the next version. - ---doc]]-- - -local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match - -local p_dot, p_slash = P".", P"/" -local p_suffix = (p_dot * (1 - p_dot - p_slash)^1 * P(-1)) / "" -local p_removesuffix = Cs((p_suffix + 1)^1) - -local find_vf_file = function (name) - local fullname = kpsefind_file(name, "ovf") - if not fullname then - --fullname = kpsefind_file(file.removesuffix(name), "ovf") - fullname = kpsefind_file(lpegmatch(p_removesuffix, name), "ovf") - end - if fullname then - logreport ("log", 0, "main", - "loading virtual font file %s.", fullname) - end - return fullname -end - ---[[doc-- - \subsection{Preparing the Font Loader} We treat the fontloader as a black box so behavior is consistent between formats. @@ -428,8 +386,6 @@ add_to_callback("hpack_filter", nodes.simple_font_handler, "luaotfload.node_processor", 1) -add_to_callback("find_vf_file", - find_vf_file, "luaotfload.find_vf_file") load_luaotfload_module "override" --- load glyphlist on demand |