From 7a6d92c7860fd0a606e3efed7b96a81e64f9ebfe Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 23 Apr 2013 19:59:15 +0200
Subject: set minimum luatex version to 0.76; reduce verbosity of fontdbutil

---
 fontdbutil.lua | 31 +++++++++++++++++++++++--------
 luaotfload.dtx | 22 ++++++++++++++--------
 2 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/fontdbutil.lua b/fontdbutil.lua
index 31c7dfa..fd01abb 100755
--- a/fontdbutil.lua
+++ b/fontdbutil.lua
@@ -1,11 +1,15 @@
 #!/usr/bin/env texlua
---[[
+
+--[[doc--
 This file was originally written by Elie Roux and Khaled Hosny and is under CC0
 license (see http://creativecommons.org/publicdomain/zero/1.0/legalcode).
 
-This file is a wrapper for the luaotfload's font names module. It is part of the
-luaotfload bundle, please see the luaotfload documentation for more info.
---]]
+This file is a wrapper for the luaotfload font names module
+(luaotfload-database.lua). It is part of the luaotfload bundle, please
+see the luaotfload documentation for more info. Report bugs to
+\url{https://github.com/lualatex/luaotfload/issues}.
+
+--doc]]--
 
 kpse.set_program_name"luatex"
 
@@ -14,18 +18,17 @@ local texiowrite_nl   = texio.write_nl
 local stringfind      = string.find
 local stringlower     = string.lower
 
--- First we need to be able to load module (code copied from
--- luatexbase-loader.sty):
+
 local loader_file = "luatexbase.loader.lua"
 local loader_path = assert(kpse.find_file(loader_file, "lua"),
                            "File '"..loader_file.."' not found")
 
+
 string.quoted = string.quoted or function (str)
   return string.format("%q",str) 
 end
 
---texiowrite_nl("("..loader_path..")")
-dofile(loader_path) -- FIXME this pollutes stdout with filenames
+dofile(loader_path)
 
 --[[doc--
 Depending on how the script is called we change its behavior.
@@ -73,7 +76,19 @@ config.lualibs.prefer_merged    = true
 config.lualibs.load_extended    = false
 
 require"lualibs"
+
+--[[doc--
+\fileent{luatex-basics-gen.lua} calls functions from the
+\luafunction{texio.*} library; too much for our taste.
+We intercept them with dummies.
+--doc]]--
+
+local dummy_function = function ( ) end
+local backup_write, backup_write_nl  = texio.write, texio.write_nl
+texio.write, texio.write_nl          = dummy_function, dummy_function
 require"luaotfload-basics-gen.lua"
+texio.write, texio.write_nl          = backup_write, backup_write_nl
+
 require"luaotfload-override.lua"  --- this populates the logs.* namespace
 require"luaotfload-database"
 require"alt_getopt"
diff --git a/luaotfload.dtx b/luaotfload.dtx
index e5e6abe..58fb9e1 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1041,13 +1041,19 @@ local error, warning, info, log =
     luatexbase.provides_module(luaotfload.module)
 
 %    \end{macrocode}
-%
-%    We set the minimum version requirement for \LUATEX to v0.74, as it was
-%    the first version to include version 5.2 of the \LUA interpreter.
+%    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
+%    available in earlier versions.\footnote{%
+%     See Taco’s announcement of v0.76:
+%     \url{http://comments.gmane.org/gmane.comp.tex.luatex.user/4042}
+%     and this commit by Hans that introduced those features.
+%     \url{http://repo.or.cz/w/context.git/commitdiff/a51f6cf6ee087046a2ae5927ed4edff0a1acec1b}.
+%   }
 %
 %    \begin{macrocode}
 
-local luatex_version = 74
+local luatex_version = 76
 
 if tex.luatexversion < luatex_version then
     warning("LuaTeX v%.2f is old, v%.2f is recommended.",
@@ -1110,7 +1116,6 @@ end
 % \fileent{luaotfload-merged.lua}.
 % If this file cannot be found, the original libraries from \CONTEXT of
 % which the merged code was composed are loaded instead.
-%
 % The imported font loader will call \luafunction{callback.register} once
 % while reading \fileent{font-def.lua}.
 % This is unavoidable unless we modify the imported files, but harmless
@@ -1418,8 +1423,10 @@ end
 %    \begin{macrocode}
 
 local read_font_file = fonts.definers.read
-local patch_defined_font = function (...)
-    local tfmdata = read_font_file(...)-- spec -> size -> id -> tmfdata
+
+--- spec -> size -> id -> tmfdata
+local patch_defined_font = function (specification, size, id)
+    local tfmdata = read_font_file(specification, size, id)
     if type(tfmdata) == "table" then
         call_callback("luaotfload.patch_font", tfmdata)
     end
@@ -1489,7 +1496,6 @@ loadmodule"features.lua" --- contains what was “font-ltx” and “font-otc”
 
 -- vim:tw=71:sw=4:ts=4:expandtab
 
-
 %    \end{macrocode}
 %
 % \iffalse
-- 
cgit v1.2.3