From 30f83b71d2110d38b99069e4c22d950f097a9315 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Mon, 22 Apr 2013 16:03:50 +0200
Subject: make main files recognize the new ``luaotfload-`` prefix

---
 luaotfload.dtx | 258 +++++++++++++++++++++++++++++++++------------------------
 1 file changed, 149 insertions(+), 109 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index 3685083..efc53eb 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -315,7 +315,7 @@ and the derived files
 % The next example shows how to load the \emphasis{Porson} font digitized by
 % the Greek Font Society using \XETEX-style syntax and an absolute path from a
 % non-standard directory:
-% 
+%
 % \begin{quote}
 %   \begin{verbatim}
 %   \font\gfsporson="[/tmp/GFSPorson.otf]" at 12pt
@@ -486,7 +486,7 @@ and the derived files
 %        Their arguments are names of \LUA tables that contain
 %        values for the respective features.\footnote{%
 %           For examples of the table layout please refer to the
-%           section of the file \fileent{otfl-fonts-ext.lua} where the
+%           section of the file \fileent{luaotfload-fonts-ext.lua} where the
 %           default values are defined.
 %           Alternatively and with loss of information, you can dump
 %           those tables into your terminal by issuing
@@ -701,7 +701,7 @@ and the derived files
 % approximate matching.
 % Suppose you cannot precisely remember if the variant of
 % \identifier{Iwona} you are looking for was “Bright” or “Light”.
-% The query 
+% The query
 %
 % \begin{quote}
 %   \begin{verbatim}
@@ -724,7 +724,7 @@ and the derived files
 % \LUATEX reference manual.\footnote{%
 %   In \TEX Live: \fileent{texmf-dist/doc/luatex/base/luatexref-t.pdf}.
 % }
-%  
+%
 % \verb|fontdbutil --help| will list the available command line
 % switches, including some not discussed in detail here.
 %
@@ -737,7 +737,7 @@ and the derived files
 % running \verb|fontdbutil -v| to increase verbosity.
 % Take a note of the \emphasis{filename} of the font that database
 % creation fails with and append it to the file
-% \fileent{otfl-blacklist.cnf}.
+% \fileent{luaotfload-blacklist.cnf}.
 %
 % A blacklist file is a list of font filenames, one per line.
 % Specifying the full path to where the file is located is optional, the
@@ -754,8 +754,8 @@ and the derived files
 % }
 % or just leave it in the working directory of your document.
 % \identifier{luaotfload} reads all files named
-% \fileent{otfl-blacklist.cnf} it finds, so the fonts in
-% \fileent{./otfl-blacklist.cnf} extend the global blacklist.
+% \fileent{luaotfload-blacklist.cnf} it finds, so the fonts in
+% \fileent{./luaotfload-blacklist.cnf} extend the global blacklist.
 %
 % Furthermore, a filename prepended with a dash character (|-|) is
 % removed from the blacklist, causing it to be temporarily whitelisted
@@ -814,10 +814,10 @@ and the derived files
 %     \def\incitem#1{%
 %       \normalitem{\fileent{#1}}
 %     }
-%     \fileitem{luatex-fonts.lua}{otfl-fonts.lua}
+%     \fileitem{luatex-fonts.lua}{luaotfload-fonts.lua}
 %           The wrapper that loads the font loader code.
 %
-%     \fileitem{luatex-fonts-merged.lua}{otfl-fonts-merged.lua}
+%     \fileitem{luatex-fonts-merged.lua}{luaotfload-fonts-merged.lua}
 %           The font loader package.
 %           It is generated by \fileent{mtx-package}, a \LUA
 %           source code merging tool developed by Hans
@@ -890,10 +890,10 @@ and the derived files
 %           instead.
 %           Their names remain the same as in \CONTEXT (without the
 %           \verb|otfl|-prefix) since they are hard-coded in
-%           \fileent{otfl-fonts.lua}.
+%           \fileent{luaotfload-fonts.lua}.
 %           Thus if you prefer running bleeding edge code from the
 %           \CONTEXT beta, all you have to do is remove
-%           \fileent{otfl-fonts-merged.lua} from the search path.
+%           \fileent{luaotfload-fonts-merged.lua} from the search path.
 %
 %   \end{itemize}
 %
@@ -908,20 +908,20 @@ and the derived files
 %       \normalitem{\fileent{#1}}%
 %       \space--\hskip1em
 %     }
-%     \ouritem {otfl-font-otc.lua} \fileent{font-otc} from \CONTEXT;
+%     \ouritem {luaotfload-font-otc.lua} \fileent{font-otc} from \CONTEXT;
 %                                  font feature handling.
-%     \ouritem {otfl-lib-dir.lua}  \fileent{l-dir} from \CONTEXT;
+%     \ouritem {luaotfload-lib-dir.lua}  \fileent{l-dir} from \CONTEXT;
 %                                  contains functionality required
-%                                  by \fileent{otfl-font-nms.lua}.
-%     \ouritem {otfl-luat-ovr.lua} overrides the \CONTEXT logging
+%                                  by \fileent{luaotfload-font-nms.lua}.
+%     \ouritem {luaotfload-luat-ovr.lua} overrides the \CONTEXT logging
 %                                  functionality.
-%     \ouritem {otfl-font-pfb.lua} registers the \OpenType
+%     \ouritem {luaotfload-font-pfb.lua} registers the \OpenType
 %                                  font reader as handler for
 %                                  Postscript fonts.
-%     \ouritem {otfl-font-nms.lua} font database.
-%     \ouritem {otfl-font-clr.lua} color handling.
-%     \ouritem {otfl-font-ltx.lua} font feature handling.
-%     \ouritem {otfl-features.lua} definitions of the \verb|anum| and
+%     \ouritem {luaotfload-font-nms.lua} font database.
+%     \ouritem {luaotfload-font-clr.lua} color handling.
+%     \ouritem {luaotfload-font-ltx.lua} font feature handling.
+%     \ouritem {luaotfload-features.lua} definitions of the \verb|anum| and
 %                                  \verb|tlig| features.
 % \end{itemize}
 %
@@ -991,6 +991,7 @@ and the derived files
 % \fi
 %    \begin{macrocode}
 luaotfload = luaotfload or {}
+local luaotfload  = luaotfload
 
 luaotfload.module = {
     name          = "luaotfload",
@@ -1008,6 +1009,7 @@ local type, next       = type, next
 local stringfind       = string.find
 local stringsub        = string.sub
 local stringmatch      = string.match
+local stringformat     = string.format
 local find_file        = kpse.find_file
 
 local add_to_callback, create_callback =
@@ -1019,6 +1021,7 @@ local dummy_function = function () end
 
 %    \end{macrocode}
 %
+%
 %    No final decision has been made on how to handle font definition.  At
 %    the moment, there are three candidates: The \identifier{generic}
 %    callback as hard-coded in the font loader, the \identifier{old}
@@ -1026,6 +1029,7 @@ local dummy_function = function () end
 %    that does nothing besides applying font patches.
 %
 %    \begin{macrocode}
+
 luaotfload.font_definer = "patch" --- | “generic” | “old”
 
 local error, warning, info, log =
@@ -1033,6 +1037,7 @@ local error, warning, info, log =
 
 %    \end{macrocode}
 %
+%
 %    This is a necessary initalization in order not to rebuild an existing
 %    font.
 %    Maybe 600 should be replaced by \texmacro{pdfpkresolution} %% (why?)
@@ -1048,6 +1053,7 @@ kpse.init_prog("", 600, "/")
 
 %    \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.
 %
@@ -1063,27 +1069,34 @@ end
 
 %    \end{macrocode}
 %
+%
 %    \subsection{Module loading}
 %
 %    We load the files imported from \CONTEXT with this function.
-%    It automatically prepends the prefix \fileent{otfl-} to its argument,
-%    so we can refer to the files with their actual \CONTEXT name.
+%    It automatically prepends the prefix \fileent{luaotfload-} to its
+%    argument, so we can refer to the files with their actual \CONTEXT name.
 %
 %    \begin{macrocode}
 
-local fl_prefix = "otfl" -- “luatex” for luatex-plain
+local fl_prefix = "luaotfload" -- “luatex” for luatex-plain
 local loadmodule = function (name)
-    require(fl_prefix .."-"..name)
+    local tofind = fl_prefix .."-"..name
+    local found = find_file(tofind,"tex")
+    if found then
+        log("loading file %s.", found)
+        dofile(found)
+    else
+        error("file %s not found.", tofind)
+    end
 end
 
 %    \end{macrocode}
 %
-%    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.
+%
+%    Virtual fonts are resolved via a callback.
+%    \luafunction{find_vf_file} derives the name of the virtual font file
+%    from the filename.
+%    (NB: \CONTEXT handles this likewise in \fileent{font-vf.lua}.)
 %
 %    \begin{macrocode}
 local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match
@@ -1104,51 +1117,14 @@ local find_vf_file = function (name)
     return fullname
 end
 
---[[-- keep --]]
---- from Hans (all merged):
-
----   file name              modified  include name
---- × basics-gen.lua         t         luat-basics-gen
---- × font-def -> fonts-def  t         luatex-font-def (there’s also the normal font-def!)
---- × fonts-enc              f         luatex-font-enc
---- × fonts-ext              t         luatex-fonts-ext
---- × fonts-lua              f         luatex-fonts-lua
----   fonts-tfm              f         luatex-fonts-tfm
---- × fonts-cbk              f         luatex-fonts-lua
-
---- from Hans (unmerged):
----   font-otc.lua -> otfl-font-otc.lua
-
---- from luaotfload:
----   otfl-luat-ovr.lua    -- override some luat-dum functions
----   otfl-font-clr.lua
----   otfl-font-ltx.lua
----   otfl-font-nms.lua
----   otfl-font-pfb.lua    -- ?
-
---[[-- new --]]
---- basics-nod          (merged as fonts-nod !)
---- fonts-demo-vf-1.lua
---- fonts-syn           (merged)
-
---[[-- merged, to be dropped --]]
---- otfl-data-con.lua
---- otfl-font-cid.lua
---- otfl-font-con.lua
---- otfl-font-ini.lua
---- otfl-font-ota.lua
---- otfl-font-otb.lua
---- otfl-font-otf.lua
---- otfl-font-oti.lua
---- otfl-font-otn.lua
-
 %    \end{macrocode}
 %
 %
+%
 %    \subsection{Preparing the Font Loader}
 %    We treat the fontloader as a black box so behavior is consistent
 %    between formats.
-%    The wrapper file is \fileent{otfl-fonts.lua} which we imported from
+%    The wrapper file is \fileent{luaotfload-fonts.lua} which we imported from
 %    \href{http://standalone.contextgarden.net/current/context/experimental/tex/generic/context/luatex/}{\LUATEX-Plain}.
 %    It has roughly two purposes:
 %
@@ -1163,7 +1139,7 @@ end
 %    How the first step is executed depends on the presence on the
 %    \emphasis{merged font loader code}.
 %    In \identifier{luaotfload} this is contained in the file
-%    \fileent{otfl-fonts-merged.lua}.
+%    \fileent{luaotfload-fonts-merged.lua}.
 %    If this file cannot be found,  the original libraries from \CONTEXT of
 %    which the merged code was composed are loaded instead.
 %
@@ -1187,16 +1163,63 @@ end
 %    \identifier{luatexbase}-style callback handling here.
 %
 %    \begin{macrocode}
-generic_context = {no_callbacks_yet = true}
 
-non_generic_context = { luatex_fonts = {
-        load_before     = "otfl-fonts-merged.lua",
-        -- load_after      = nil, --- TODO, this is meant for callbacks
+
+--- these are obsolescent due to our plan of removing luaotfload-fonts.lua
+generic_context      = generic_context or { }
+non_generic_context  = non_generic_context or { }
+
+generic_context.no_callbacks_yet = true
+
+non_generic_context.luatex_fonts = {
+        --- TODO we’ll kill luaotfload-fonts.lua soon, so
+        ---      this is gonna vanish, and the file will become
+        ---      luaotfload-merged.lua
+        load_before     = "luaotfload-fonts-merged.lua",
         skip_loading    = true,
-}}
+}
+
+%    \end{macrocode}
+%
+%
+%    In its raw form, the font loader will write to the terminal quite
+%    liberally, not using the proper channels (loggers) even of \CONTEXT.
+%    To make it behave we temporarily replace two functions from the
+%    \luafunction{texio} library with wrappers that redirect output to the
+%    log.
+%    Just in case Hans decides to call \luafunction{texio.write*} with the
+%    optional target parameter (which he doesn’t at the moment), we catch the
+%    first argument and skip it where appropriate.
+%    The originals are backed up and restored after loading
+%    \fileent{luaotfload-fonts.lua}.
+%
+%    Should we decide to do our own packaging (we’re capable of that
+%    anyways), this will most likely become unnecessary.
+%
+%    \begin{macrocode}
+
+local normal_write, normal_write_nl = texio.write, texio.write_nl
+
+local log_template = "luaotfload: %s"
+local fake_write = function (first, rest)
+    if first == "log" or first == "term" then -- ignore
+        normal_write("log", stringformat(log_template, rest))
+    else
+        normal_write("log", stringformat(log_template, first))
+    end
+end
+local fake_write_nl = function (first, rest)
+    if first == "log" or first == "term" then -- ignore
+        normal_write_nl("log", stringformat(log_template, rest))
+    else
+        normal_write_nl("log", stringformat(log_template, first, rest))
+    end
+end
+texio.write, texio.write_nl = fake_write, fake_write_nl
 
 %    \end{macrocode}
 %
+%
 %    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
@@ -1209,31 +1232,24 @@ callback.register      = dummy_function
 
 %    \end{macrocode}
 %
-%    In order to have an output with normal verbosity, we need to pre-override
-%    some \CONTEXT log function:
+%
+%    Now that things are sorted out we can finally load the fontloader.
 %
 %    \begin{macrocode}
 
-local dummylogfunction=function() end
-local dummylogreporter=function(c) return function(...) log(string.formatters(...)) end end
-
-logs={
-  new=dummylogreporter,
-  reporter=dummylogreporter,
-  messenger=dummylogreporter,
-  report=dummylogfunction,
-}
+loadmodule"fonts.lua"
 
 %    \end{macrocode}
 %
-%    Now that things are sorted out we can finally load the fontloader.
+%
+%    Here we restore the original \luafunction{texio} functions.
 %
 %    \begin{macrocode}
-
-loadmodule"fonts.lua"
+texio.write, texio.write_nl = normal_write, normal_write_nl
 
 %    \end{macrocode}
 %
+%
 %    By default, the fontloader requires a number of \emphasis{private
 %    attributes} for internal use.
 %    These must be kept consistent with the attribute handling methods as
@@ -1241,22 +1257,22 @@ loadmodule"fonts.lua"
 %    Our strategy is to override the function that allocates new attributes
 %    before we initialize the font loader, making it a wrapper around
 %    \luafunction{luatexbase.new_attribute}.\footnote{%
-%        Many thanks, again, to Hans Hagen for making this part
-%        configurable!
+%       Many thanks, again, to Hans Hagen for making this part
+%       configurable!
 %    }
-%    The attribute identifiers are prefixed “\fileent{otfl@}” to
+%    The attribute identifiers are prefixed “\fileent{luaotfload@}” to
 %    avoid name clashes.
 %
 %    \begin{macrocode}
 
 do
-    local new_attribute = luatexbase.new_attribute
-    local the_attributes = luatexbase.attributes
+    local new_attribute    = luatexbase.new_attribute
+    local the_attributes   = luatexbase.attributes
 
     attributes = attributes or { }
 
     attributes.private = function (name)
-        local attr   = "otfl@" .. name
+        local attr   = "luaotfload@" .. name --- used to be: “otfl@”
         local number = the_attributes[attr]
         if not number then
             number = new_attribute(attr)
@@ -1268,6 +1284,7 @@ end
 %    \end{macrocode}
 %
 %
+%
 %    \subsection{Callbacks}
 %
 %    After the fontloader is ready we can restore the callback trap from
@@ -1279,6 +1296,7 @@ callback.register = trapped_register
 
 %    \end{macrocode}
 %
+%
 %    We do our own callback handling with the means provided by luatexbase.
 %
 %    Note: \luafunction{pre_linebreak_filter} and \luafunction{hpack_filter}
@@ -1297,26 +1315,44 @@ add_to_callback("hpack_filter",
 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
+loadmodule"font-otc.lua"   -- TODO check what we can drop from luaotfload-features
 loadmodule"lib-dir.lua"    -- required by font-nms
 loadmodule"luat-ovr.lua"
 
 %    \end{macrocode}
 %
 %
-%    \CONTEXT does not support ofm, these lines were added in order to make it
-%    work. However they do not seem necessary so they are commented for now.
+%    We aim at reducing the clutter on the terminal, so there is a range of
+%    logging thresholds.
+%    (See \fileent{luaotfload-luat-ovr.lua} for the implementation.)
+%    Each log/report is assigned an integer parameter determining the log
+%    level at or above which it will appear.
+%    The default is “1”, and though there is no fixed upper bound,
+%    meaningful values should not exceed five.
 %
 %    \begin{macrocode}
--- if fonts and fonts.readers.tfm then
---  fonts.readers.ofm  = fonts.readers.tfm
---  fonts.handlers.ofm = fonts.handlers.tfm --- empty anyways
---  fonts.formats.ofm  = fonts.formats.tfm  --- “type1”
---  --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm"
---end
+logs.set_loglevel(3)
+
+if fonts and fonts.readers.tfm then
+  --------------------------------------------------------------------
+  --- OFM; read this first
+  --------------------------------------------------------------------
+  --- I can’t quite make out whether this is still relevant
+  --- as those ofm fonts always fail, even in the 2011 version
+  --- (mktexpk:  don't know how to create bitmap font for omarabb.ofm)
+  --- the font loader appears to read ofm like tfm so if this
+  --- hack was supposed achieve that, we should excise it anyways
+  fonts.readers.ofm  = fonts.readers.tfm
+  fonts.handlers.ofm = fonts.handlers.tfm --- empty anyways
+  fonts.formats.ofm  = fonts.formats.tfm  --- “type1”
+  --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm"
+  --------------------------------------------------------------------
+end
+
 %    \end{macrocode}
 %
 %
+%
 %    Now we load the modules written for \identifier{luaotfload}.
 %
 %    \begin{macrocode}
@@ -1328,15 +1364,15 @@ loadmodule"font-ltx.lua"    --- new in 2.0, added 2011
 %    \end{macrocode}
 %
 %
-%    This hack makes fonts called with file method found by fonts.names.resove
+%    This hack makes fonts called with file method found by fonts.names.resolve
 %    instead of just trying to find them with kpse. It is necessary in case
-%    of fonts that are not accessible by kpse but present in the database, a 
+%    of fonts that are not accessible by kpse but present in the database, a
 %    quite common case under Linux.
 %
 %    \begin{macrocode}
 
-fonts.definers.resolvers.file = function (specification) 
-  specification.name = fonts.names.resolve('', '', specification) 
+fonts.definers.resolvers.file = function (specification)
+  specification.name = fonts.names.resolve('', '', specification)
 end
 
 %    \end{macrocode}
@@ -1354,6 +1390,7 @@ create_callback("luaotfload.patch_font", "simple", dummy_function)
 %    \end{macrocode}
 %
 %
+%
 %    This is a wrapper for the imported font loader.
 %    As of 2013, everything it does appear to be redundand, so we won’t use
 %    it unless somebody points out a cogent reason.
@@ -1405,6 +1442,7 @@ end
 %    \end{macrocode}
 %
 %
+%
 %    \subsection{\CONTEXT override}
 %
 %    We provide a simplified version of the original font definition
@@ -1418,6 +1456,7 @@ local patch_defined_font = function (...)
     if type(tfmdata) == "table" then
         call_callback("luaotfload.patch_font", tfmdata)
     end
+    -- inspect(table.keys(tfmdata))
     return tfmdata
 end
 
@@ -1427,6 +1466,7 @@ reset_callback("define_font")
 
 %    \end{macrocode}
 %
+%
 %    Finally we register the callbacks
 %
 %    \begin{macrocode}
@@ -1646,7 +1686,7 @@ loadmodule"features.lua"
 %
 % \begin{enumerate}
 %
-% \item 
+% \item
 % You must cause the modified files to carry prominent notices stating that
 % you changed the files and the date of any change.
 %
-- 
cgit v1.2.3


From b4ae5d25bd724b449e76c9bd273670826f7bd01d Mon Sep 17 00:00:00 2001
From: Elie Roux <elie.roux@telecom-bretagne.eu>
Date: Fri, 19 Apr 2013 18:17:28 +0200
Subject: A more simple loadmodule function

Simply using the luatexbase way... May change in the future, but stick with it for now.
---
 luaotfload.dtx | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index efc53eb..07035a4 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1080,14 +1080,7 @@ end
 
 local fl_prefix = "luaotfload" -- “luatex” for luatex-plain
 local loadmodule = function (name)
-    local tofind = fl_prefix .."-"..name
-    local found = find_file(tofind,"tex")
-    if found then
-        log("loading file %s.", found)
-        dofile(found)
-    else
-        error("file %s not found.", tofind)
-    end
+    require(fl_prefix .."-"..name)
 end
 
 %    \end{macrocode}
-- 
cgit v1.2.3


From 9c573708a2e74b51062fc5cef728790dd85f66d6 Mon Sep 17 00:00:00 2001
From: Elie Roux <elie.roux@telecom-bretagne.eu>
Date: Fri, 19 Apr 2013 18:29:23 +0200
Subject: Documenting and simplifying ofm font bug handling

Conflicts:
	luaotfload.dtx
---
 luaotfload.dtx | 44 ++++++++++++++------------------------------
 1 file changed, 14 insertions(+), 30 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index 07035a4..0025e2f 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1085,11 +1085,12 @@ end
 
 %    \end{macrocode}
 %
-%
-%    Virtual fonts are resolved via a callback.
-%    \luafunction{find_vf_file} derives the name of the virtual font file
-%    from the filename.
-%    (NB: \CONTEXT handles this likewise in \fileent{font-vf.lua}.)
+%    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.
 %
 %    \begin{macrocode}
 local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match
@@ -1315,33 +1316,16 @@ loadmodule"luat-ovr.lua"
 %    \end{macrocode}
 %
 %
-%    We aim at reducing the clutter on the terminal, so there is a range of
-%    logging thresholds.
-%    (See \fileent{luaotfload-luat-ovr.lua} for the implementation.)
-%    Each log/report is assigned an integer parameter determining the log
-%    level at or above which it will appear.
-%    The default is “1”, and though there is no fixed upper bound,
-%    meaningful values should not exceed five.
+%    \CONTEXT does not support ofm, these lines were added in order to make it
+%    work. However they do not seem necessary so they are commented for now.
 %
 %    \begin{macrocode}
-logs.set_loglevel(3)
-
-if fonts and fonts.readers.tfm then
-  --------------------------------------------------------------------
-  --- OFM; read this first
-  --------------------------------------------------------------------
-  --- I can’t quite make out whether this is still relevant
-  --- as those ofm fonts always fail, even in the 2011 version
-  --- (mktexpk:  don't know how to create bitmap font for omarabb.ofm)
-  --- the font loader appears to read ofm like tfm so if this
-  --- hack was supposed achieve that, we should excise it anyways
-  fonts.readers.ofm  = fonts.readers.tfm
-  fonts.handlers.ofm = fonts.handlers.tfm --- empty anyways
-  fonts.formats.ofm  = fonts.formats.tfm  --- “type1”
-  --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm"
-  --------------------------------------------------------------------
-end
-
+-- if fonts and fonts.readers.tfm then
+--  fonts.readers.ofm  = fonts.readers.tfm
+--  fonts.handlers.ofm = fonts.handlers.tfm --- empty anyways
+--  fonts.formats.ofm  = fonts.formats.tfm  --- “type1”
+--  --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm"
+--end
 %    \end{macrocode}
 %
 %
-- 
cgit v1.2.3


From 4a90057e2bee570e0c0785da70d88754ac0ccd9a Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Mon, 22 Apr 2013 19:57:00 +0200
Subject: move everything relevant from luatex-fonts.lua into luaotfload.lua

---
 luaotfload.dtx | 454 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 228 insertions(+), 226 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index 0025e2f..3998859 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -990,8 +990,12 @@ and the derived files
 %<*lua>
 % \fi
 %    \begin{macrocode}
-luaotfload = luaotfload or {}
-local luaotfload  = luaotfload
+luaotfload                  = luaotfload or {}
+local luaotfload            = luaotfload
+
+config                      = config or { }
+config.luaotfload           = config.luaotfload or { }
+luaotfload.prefer_merge     = config.luaotfload.prefer_merge or true
 
 luaotfload.module = {
     name          = "luaotfload",
@@ -1006,6 +1010,7 @@ luaotfload.module = {
 local luatexbase = luatexbase
 
 local type, next       = type, next
+local setmetatable     = setmetatable
 local stringfind       = string.find
 local stringsub        = string.sub
 local stringmatch      = string.match
@@ -1020,13 +1025,11 @@ local reset_callback, call_callback =
 local dummy_function = function () end
 
 %    \end{macrocode}
-%
-%
-%    No final decision has been made on how to handle font definition.  At
-%    the moment, there are three candidates: The \identifier{generic}
-%    callback as hard-coded in the font loader, the \identifier{old}
-%    wrapper, and a simplified version of the latter (\identifier{patch})
-%    that does nothing besides applying font patches.
+% No final decision has been made on how to handle font definition.  At
+% the moment, there are three candidates: The \identifier{generic}
+% callback as hard-coded in the font loader, the \identifier{old}
+% wrapper, and a simplified version of the latter (\identifier{patch})
+% that does nothing besides applying font patches.
 %
 %    \begin{macrocode}
 
@@ -1036,26 +1039,22 @@ local error, warning, info, log =
     luatexbase.provides_module(luaotfload.module)
 
 %    \end{macrocode}
-%
-%
-%    This is a necessary initalization in order not to rebuild an existing
-%    font.
-%    Maybe 600 should be replaced by \texmacro{pdfpkresolution} %% (why?)
-%    or \luafunction{texconfig.pk_dpi} (and it should be replaced
-%    dynamically), but we don't have access (yet) to the
-%    \identifier{texconfig} table, so we let it be 600.
-%    Anyway, it does still work fine even if \texmacro{pdfpkresolution} is
-%    changed.
+% This is a necessary initalization in order not to rebuild an existing
+% font.
+% Maybe 600 should be replaced by \texmacro{pdfpkresolution} %% (why?)
+% or \luafunction{texconfig.pk_dpi} (and it should be replaced
+% dynamically), but we don't have access (yet) to the
+% \identifier{texconfig} table, so we let it be 600.
+% Anyway, it does still work fine even if \texmacro{pdfpkresolution} is
+% changed.
 %
 %    \begin{macrocode}
 
 kpse.init_prog("", 600, "/")
 
 %    \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.74, as it was
+% the first version to include version 5.2 of the \LUA interpreter.
 %
 %    \begin{macrocode}
 
@@ -1068,13 +1067,10 @@ if tex.luatexversion < luatex_version then
 end
 
 %    \end{macrocode}
-%
-%
-%    \subsection{Module loading}
-%
-%    We load the files imported from \CONTEXT with this function.
-%    It automatically prepends the prefix \fileent{luaotfload-} to its
-%    argument, so we can refer to the files with their actual \CONTEXT name.
+% \subsection{Module loading}
+% We load the files imported from \CONTEXT with this function.
+% It automatically prepends the prefix \fileent{luaotfload-} to its
+% argument, so we can refer to the files with their actual \CONTEXT name.
 %
 %    \begin{macrocode}
 
@@ -1084,13 +1080,12 @@ local loadmodule = function (name)
 end
 
 %    \end{macrocode}
-%
-%    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.
+% 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.
 %
 %    \begin{macrocode}
 local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match
@@ -1112,198 +1107,223 @@ local find_vf_file = function (name)
 end
 
 %    \end{macrocode}
-%
-%
-%
-%    \subsection{Preparing the Font Loader}
-%    We treat the fontloader as a black box so behavior is consistent
-%    between formats.
-%    The wrapper file is \fileent{luaotfload-fonts.lua} which we imported from
-%    \href{http://standalone.contextgarden.net/current/context/experimental/tex/generic/context/luatex/}{\LUATEX-Plain}.
-%    It has roughly two purposes:
-%
-%    \begin{enumerate}
-%
-%       \item insert the functionality required for fontloader; and
-%
-%       \item put it in place via the respective callbacks.
-%
-%    \end{enumerate}
-%
-%    How the first step is executed depends on the presence on the
-%    \emphasis{merged font loader code}.
-%    In \identifier{luaotfload} this is contained in the file
-%    \fileent{luaotfload-fonts-merged.lua}.
-%    If this file cannot be found,  the original libraries from \CONTEXT of
-%    which the merged code was composed are loaded instead.
-%
-%    Hans provides two global tables to control the font loader:
-%
-%      \begin{itemize}
-%        \item  \luafunction{generic_context}:
-%               encapsulation mechanism, callback functions
-%        \item  \luafunction{non generic_context}:
-%               customized code insertion
-%      \end{itemize}
-%
-%    With \luafunction{non_generic_context} we can tailor the font loader
-%    insertion to our file naming habits (key \luafunction{load_before}).
-%    Additionally, \luafunction{skip_loading} can be unset to force loading
-%    of the original libraries as though the merged code was absent.
-%    Another key, \luafunction{load_after} is called at the time when the
-%    font loader is actually inserted.
-%    In combination with the option \luafunction{no_callbacks_yet} in
-%    \luafunction{generic_context}, we can insert our own,
-%    \identifier{luatexbase}-style callback handling here.
+% \subsection{Preparing the Font Loader}
+% We treat the fontloader as a black box so behavior is consistent
+% between formats.
+% We do no longer run the intermediate wrapper file
+% \fileent{luaotfload-fonts.lua} which we used to import from
+% \href{http://standalone.contextgarden.net/current/context/experimental/tex/generic/context/luatex/}{\LUATEX-Plain}.
+% Rather, we load the fontloader code directly in the same fashion as
+% \identifier{luatex-fonts}.
+% How this is executed depends on the presence on the \emphasis{merged
+% font loader code}.
+% In \identifier{luaotfload} this is contained in the file
+% \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
+% if we make it call a dummy instead.
+% However, this problem might vanish if we decide to do the merging
+% ourselves, like the \identifier{lualibs} package does.
+% With this step we would obtain the freedom to load our own overrides in
+% the process right where they are needed, at the cost of losing
+% encapsulation.
+% The decision on how to progress is currently on indefinite hold.
 %
 %    \begin{macrocode}
 
+local starttime = os.gettimeofday()
 
---- these are obsolescent due to our plan of removing luaotfload-fonts.lua
-generic_context      = generic_context or { }
-non_generic_context  = non_generic_context or { }
+local trapped_register  = callback.register
+callback.register       = dummy_function
 
-generic_context.no_callbacks_yet = true
+%    \end{macrocode}
+% By default, the fontloader requires a number of \emphasis{private
+% attributes} for internal use.
+% These must be kept consistent with the attribute handling methods as
+% provided by \identifier{luatexbase}.
+% Our strategy is to override the function that allocates new attributes
+% before we initialize the font loader, making it a wrapper around
+% \luafunction{luatexbase.new_attribute}.\footnote{%
+%     Many thanks, again, to Hans Hagen for making this part
+%     configurable!
+% }
+% The attribute identifiers are prefixed “\fileent{luaotfload@}” to
+% avoid name clashes.
+%
+%    \begin{macrocode}
 
-non_generic_context.luatex_fonts = {
-        --- TODO we’ll kill luaotfload-fonts.lua soon, so
-        ---      this is gonna vanish, and the file will become
-        ---      luaotfload-merged.lua
-        load_before     = "luaotfload-fonts-merged.lua",
-        skip_loading    = true,
-}
+do
+    local new_attribute    = luatexbase.new_attribute
+    local the_attributes   = luatexbase.attributes
+
+    attributes = attributes or { }
+
+    attributes.private = function (name)
+        local attr   = "luaotfload@" .. name --- used to be: “otfl@”
+        local number = the_attributes[attr]
+        if not number then
+            number = new_attribute(attr)
+        end
+        return number
+    end
+end
 
 %    \end{macrocode}
-%
-%
-%    In its raw form, the font loader will write to the terminal quite
-%    liberally, not using the proper channels (loggers) even of \CONTEXT.
-%    To make it behave we temporarily replace two functions from the
-%    \luafunction{texio} library with wrappers that redirect output to the
-%    log.
-%    Just in case Hans decides to call \luafunction{texio.write*} with the
-%    optional target parameter (which he doesn’t at the moment), we catch the
-%    first argument and skip it where appropriate.
-%    The originals are backed up and restored after loading
-%    \fileent{luaotfload-fonts.lua}.
-%
-%    Should we decide to do our own packaging (we’re capable of that
-%    anyways), this will most likely become unnecessary.
+% These next lines replicate the behavior of \fileent{luatex-fonts.lua}.
 %
 %    \begin{macrocode}
 
-local normal_write, normal_write_nl = texio.write, texio.write_nl
+local context_environment = { }
 
-local log_template = "luaotfload: %s"
-local fake_write = function (first, rest)
-    if first == "log" or first == "term" then -- ignore
-        normal_write("log", stringformat(log_template, rest))
-    else
-        normal_write("log", stringformat(log_template, first))
+local push_namespaces = function ()
+    log("push namespace for font loader")
+    local normalglobal = { }
+    for k, v in next, _G do
+        normalglobal[k] = v
     end
+    return normalglobal
 end
-local fake_write_nl = function (first, rest)
-    if first == "log" or first == "term" then -- ignore
-        normal_write_nl("log", stringformat(log_template, rest))
+
+local pop_namespaces = function (normalglobal, isolate)
+    if normalglobal then
+        local _G = _G
+        local mode = "non-destructive"
+        if isolate then mode = "destructive" end
+        log("pop namespace from font loader -- "..mode)
+        for k, v in next, _G do
+            if not normalglobal[k] then
+                context_environment[k] = v
+                if isolate then
+                    _G[k] = nil
+                end
+            end
+        end
+        for k, v in next, normalglobal do
+            _G[k] = v
+        end
+        -- just to be sure:
+        setmetatable(context_environment,_G)
     else
-        normal_write_nl("log", stringformat(log_template, first, rest))
+        log("irrecoverable error during pop_namespace: no globals to restore")
+        os.exit()
     end
 end
-texio.write, texio.write_nl = fake_write, fake_write_nl
 
-%    \end{macrocode}
-%
-%
-%    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
-%    if we make it call a dummy instead.
-%
-%    \begin{macrocode}
+luaotfload.context_environment  = context_environment
+luaotfload.push_namespaces      = push_namespaces
+luaotfload.pop_namespaces       = pop_namespaces
 
-local trapped_register = callback.register
-callback.register      = dummy_function
+local our_environment = push_namespaces()
 
 %    \end{macrocode}
-%
-%
-%    Now that things are sorted out we can finally load the fontloader.
+% The font loader requires that the attribute with index zero be zero.
+% We happily oblige.
+% (Cf. \fileent{luatex-fonts-nod.lua}.)
 %
 %    \begin{macrocode}
 
-loadmodule"fonts.lua"
+tex.attribute[0] = 0
 
 %    \end{macrocode}
-%
-%
-%    Here we restore the original \luafunction{texio} functions.
+% Now that things are sorted out we can finally load the fontloader.
 %
 %    \begin{macrocode}
-texio.write, texio.write_nl = normal_write, normal_write_nl
+
+loadmodule"merged.lua"
+
+if fonts then
+
+    if not fonts._merge_loaded_message_done_ then
+        --- a program talking first person -- HH sure believes in strong AI ...
+        log[[“I am using the merged version of 'luaotfload.lua' here. If]]
+        log[[ you run into problems or experience unexpected behaviour,]]
+        log[[ and if you have ConTeXt installed you can try to delete the]]
+        log[[ file 'luaotfload-font-merged.lua' as I might then use the]]
+        log[[ possibly updated libraries. The merged version is not]]
+        log[[ supported as it is a frozen instance. Problems can be]]
+        log[[ reported to the ConTeXt mailing list.”]]
+    end
+    fonts._merge_loaded_message_done_ = true
+
+else--- the loading sequence is known to change, so this might have to
+    --- be updated with future updates!
+    --- do not modify it though unless there is a change to the merged
+    --- package!
+    loadmodule("l-lua.lua")
+    loadmodule("l-lpeg.lua")
+    loadmodule("l-function.lua")
+    loadmodule("l-string.lua")
+    loadmodule("l-table.lua")
+    loadmodule("l-io.lua")
+    loadmodule("l-file.lua")
+    loadmodule("l-boolean.lua")
+    loadmodule("l-math.lua")
+    loadmodule("util-str.lua")
+    loadmodule('luatex-basics-gen.lua')
+    loadmodule('data-con.lua')
+    loadmodule('luatex-basics-nod.lua')
+    loadmodule('font-ini.lua')
+    loadmodule('font-con.lua')
+    loadmodule('luatex-fonts-enc.lua')
+    loadmodule('font-cid.lua')
+    loadmodule('font-map.lua')
+    loadmodule('luatex-fonts-syn.lua')
+    loadmodule('luatex-fonts-tfm.lua')
+    loadmodule('font-oti.lua')
+    loadmodule('font-otf.lua')
+    loadmodule('font-otb.lua')
+    loadmodule('node-inj.lua')
+    loadmodule('font-ota.lua')
+    loadmodule('font-otn.lua')
+    loadmodule('luatex-fonts-lua.lua')
+    loadmodule('font-def.lua')
+    loadmodule('luatex-fonts-def.lua')
+    loadmodule('luatex-fonts-ext.lua')
+    loadmodule('luatex-fonts-cbk.lua')
+end --- non-merge fallback scope
 
 %    \end{macrocode}
-%
-%
-%    By default, the fontloader requires a number of \emphasis{private
-%    attributes} for internal use.
-%    These must be kept consistent with the attribute handling methods as
-%    provided by \identifier{luatexbase}.
-%    Our strategy is to override the function that allocates new attributes
-%    before we initialize the font loader, making it a wrapper around
-%    \luafunction{luatexbase.new_attribute}.\footnote{%
-%       Many thanks, again, to Hans Hagen for making this part
-%       configurable!
-%    }
-%    The attribute identifiers are prefixed “\fileent{luaotfload@}” to
-%    avoid name clashes.
+% Here we adjust the globals created during font loader initialization.
+% If the second argument to \luafunction{pop_namespaces()} is \verb|true|
+% this will restore the state of \luafunction{_G}, eliminating every
+% global generated since the last call to \luafunction{push_namespaces()}.
+% At the moment we see no reason to do this, and since the font loader is
+% considered an essential part of \identifier{luatex} as well as a very
+% well organized piece of code, we happily concede it the right to add to
+% \luafunction{_G} if needed.
 %
 %    \begin{macrocode}
 
-do
-    local new_attribute    = luatexbase.new_attribute
-    local the_attributes   = luatexbase.attributes
+pop_namespaces(our_environment, false)-- true)
 
-    attributes = attributes or { }
-
-    attributes.private = function (name)
-        local attr   = "luaotfload@" .. name --- used to be: “otfl@”
-        local number = the_attributes[attr]
-        if not number then
-            number = new_attribute(attr)
-        end
-        return number
-    end
-end
+log("fontloader loaded in %0.3f seconds", os.gettimeofday()-starttime)
 
 %    \end{macrocode}
-%
-%
-%
-%    \subsection{Callbacks}
-%
-%    After the fontloader is ready we can restore the callback trap from
-%    \identifier{luatexbase}.
+% \subsection{Callbacks}
+% After the fontloader is ready we can restore the callback trap from
+% \identifier{luatexbase}.
 %
 %    \begin{macrocode}
 
 callback.register = trapped_register
 
 %    \end{macrocode}
-%
-%
-%    We do our own callback handling with the means provided by luatexbase.
-%
-%    Note: \luafunction{pre_linebreak_filter} and \luafunction{hpack_filter}
-%    are coupled in \CONTEXT in the concept of \emphasis{node processor}.
+% We do our own callback handling with the means provided by luatexbase.
+% Note: \luafunction{pre_linebreak_filter} and \luafunction{hpack_filter}
+% are coupled in \CONTEXT in the concept of \emphasis{node processor}.
 %
 %    \begin{macrocode}
 
 add_to_callback("pre_linebreak_filter",
-                generic_context.callback_pre_linebreak_filter,
+                nodes.simple_font_handler,
                 "luaotfload.node_processor",
                 1)
 add_to_callback("hpack_filter",
-                generic_context.callback_hpack_filter,
+                nodes.simple_font_handler,
                 "luaotfload.node_processor",
                 1)
 add_to_callback("find_vf_file",
@@ -1314,10 +1334,8 @@ loadmodule"lib-dir.lua"    -- required by font-nms
 loadmodule"luat-ovr.lua"
 
 %    \end{macrocode}
-%
-%
-%    \CONTEXT does not support ofm, these lines were added in order to make it
-%    work. However they do not seem necessary so they are commented for now.
+% \CONTEXT does not support ofm, these lines were added in order to make it
+% work. However they do not seem necessary so they are commented for now.
 %
 %    \begin{macrocode}
 -- if fonts and fonts.readers.tfm then
@@ -1327,10 +1345,7 @@ loadmodule"luat-ovr.lua"
 --  --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm"
 --end
 %    \end{macrocode}
-%
-%
-%
-%    Now we load the modules written for \identifier{luaotfload}.
+% Now we load the modules written for \identifier{luaotfload}.
 %
 %    \begin{macrocode}
 loadmodule"font-pfb.lua"    --- new in 2.0, added 2011
@@ -1339,12 +1354,10 @@ loadmodule"font-clr.lua"
 loadmodule"font-ltx.lua"    --- new in 2.0, added 2011
 
 %    \end{macrocode}
-%
-%
-%    This hack makes fonts called with file method found by fonts.names.resolve
-%    instead of just trying to find them with kpse. It is necessary in case
-%    of fonts that are not accessible by kpse but present in the database, a
-%    quite common case under Linux.
+% This hack makes fonts called with file method found by fonts.names.resolve
+% instead of just trying to find them with kpse. It is necessary in case
+% of fonts that are not accessible by kpse but present in the database, a
+% quite common case under Linux.
 %
 %    \begin{macrocode}
 
@@ -1353,33 +1366,27 @@ fonts.definers.resolvers.file = function (specification)
 end
 
 %    \end{macrocode}
-%
-%
-%    We create a callback for patching fonts on the fly, to be used by other
-%    packages.
-%    It initially contains the empty function that we are going to override
-%    below.
+% We create a callback for patching fonts on the fly, to be used by other
+% packages.
+% It initially contains the empty function that we are going to override
+% below.
 %
 %    \begin{macrocode}
 
 create_callback("luaotfload.patch_font", "simple", dummy_function)
 
 %    \end{macrocode}
-%
-%
-%
-%    This is a wrapper for the imported font loader.
-%    As of 2013, everything it does appear to be redundand, so we won’t use
-%    it unless somebody points out a cogent reason.
-%    Nevertheless, it has been adapted to work with the current structure of
-%    font data objects and will stay here for reference / until breakage is
-%    reported.
-%
-%    \emphasis{TODO}
-%    This one also enables patching fonts.
-%    The current fontloader apparently comes with a dedicated mechanism for
-%    that already: enhancers.
-%    How those work remains to be figured out.
+% This is a wrapper for the imported font loader.
+% As of 2013, everything it does appear to be redundand, so we won’t use
+% it unless somebody points out a cogent reason.
+% Nevertheless, it has been adapted to work with the current structure of
+% font data objects and will stay here for reference / until breakage is
+% reported.
+% \emphasis{TODO}
+% This one also enables patching fonts.
+% The current fontloader apparently comes with a dedicated mechanism for
+% that already: enhancers.
+% How those work remains to be figured out.
 %
 %    \begin{macrocode}
 local define_font_wrapper = function (...)
@@ -1417,13 +1424,9 @@ local define_font_wrapper = function (...)
 end
 
 %    \end{macrocode}
-%
-%
-%
-%    \subsection{\CONTEXT override}
-%
-%    We provide a simplified version of the original font definition
-%    callback.
+% \subsection{\CONTEXT override}
+% We provide a simplified version of the original font definition
+% callback.
 %
 %    \begin{macrocode}
 
@@ -1442,9 +1445,7 @@ caches.compilemethod = "both"
 reset_callback("define_font")
 
 %    \end{macrocode}
-%
-%
-%    Finally we register the callbacks
+% Finally we register the callbacks.
 %
 %    \begin{macrocode}
 
@@ -1455,7 +1456,7 @@ if luaotfload.font_definer == "old"  then
                   1)
 elseif luaotfload.font_definer == "generic"  then
   add_to_callback("define_font",
-                  generic_context.callback_define_font,
+                  fonts.definers.read,
                   "luaotfload.define_font",
                   1)
 elseif luaotfload.font_definer == "patch"  then
@@ -1501,6 +1502,7 @@ loadmodule"features.lua"
 
 -- vim:tw=71:sw=4:ts=4:expandtab
 
+
 %    \end{macrocode}
 %
 % \iffalse
-- 
cgit v1.2.3


From 2be4a38fb2bc699fa7430193ee9ee0cb2bdb2454 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Mon, 22 Apr 2013 20:17:04 +0200
Subject: update documentation to reflect current state of files

---
 luaotfload.dtx | 161 ++++++++++++++++++++++++++-------------------------------
 1 file changed, 73 insertions(+), 88 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index 3998859..6f2c323 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -801,102 +801,87 @@ and the derived files
 % \identifier{luaotfload} in one way or the other.
 % See figure \ref{file-graph} on page \pageref{file-graph} for a
 % graphical representation of the dependencies.
-% From \LUATEX-Fonts the following files have been imported:
+% From \LUATEX-Fonts, only the file \fileent{luatex-fonts-merged.lua}
+% has been imported as \fileent{luaotfload-merged.lua}.
+% It is generated by \fileent{mtx-package}, a \LUA source code merging
+% too developed by Hans Hagen.\footnote{%
+%   \fileent{mtx-package} is
+%   \href
+%     {http://repo.or.cz/w/context.git/blob_plain/refs/heads/origin:/scripts/context/lua/mtx-package.lua}
+%     {part of \CONTEXT}
+%   and requires \fileent{mtxrun}.
+%   Run
+%   \verb|mtxrun --script package --help|
+%   to display further information.
+%   For the actual merging code see the file
+%   \fileent{util-mrg.lua} that is part of \CONTEXT.
+% }
+% It houses several \LUA files that can be classed in three
+% categories.
 %
 %   \begin{itemize}
 %     \let\normalitem=\item
-%     \def\fileitem#1#2{%
-%       \normalitem{\fileent{#1}}%
-%       \hfill
-%       (as \fileent{\itshape#2})%
-%       \break
-%     }
 %     \def\incitem#1{%
 %       \normalitem{\fileent{#1}}
 %     }
-%     \fileitem{luatex-fonts.lua}{luaotfload-fonts.lua}
-%           The wrapper that loads the font loader code.
-%
-%     \fileitem{luatex-fonts-merged.lua}{luaotfload-fonts-merged.lua}
-%           The font loader package.
-%           It is generated by \fileent{mtx-package}, a \LUA
-%           source code merging tool developed by Hans
-%           Hagen.\footnote{%
-%             \fileent{mtx-package} is
-%             \href
-%               {http://repo.or.cz/w/context.git/blob_plain/refs/heads/origin:/scripts/context/lua/mtx-package.lua}
-%               {part of \CONTEXT}
-%             and requires \fileent{mtxrun}.
-%             Run
-%             \verb|mtxrun --script package --help|
-%             to display further information.
-%             For the actual merging code see the file
-%             \fileent{util-mrg.lua} that is part of \CONTEXT.
-%           }
-%
-%           Included are several Lua files that can be classed in three
-%           categories.
-%           \begin{itemize}
-%             \normalitem \emphasis{\LUA utility libraries}, a subset
-%                         of what is provided by the \identifier{lualibs}
-%                         package.
-%
-%                         \begin{multicols}{2}
-%                           \begin{itemize}
-%                             \incitem{l-lua.lua}       \incitem{l-lpeg.lua}
-%                             \incitem{l-function.lua}  \incitem{l-string.lua}
-%                             \incitem{l-table.lua}     \incitem{l-io.lua}
-%                             \incitem{l-file.lua}      \incitem{l-boolean.lua}
-%                             \incitem{l-math.lua}      \incitem{util-str.lua}
-%                           \end{itemize}
-%                         \end{multicols}
-%
-%             \normalitem The \emphasis{font loader} itself.
-%                         These files have been written for
-%                         \LUATEX-Fonts and they are distributed along
-%                         with \identifier{luaotfload}.
-%                         \begin{multicols}{2}
-%                           \begin{itemize}
-%                             \incitem{luatex-basics-gen.lua}
-%                             \incitem{luatex-basics-nod.lua}
-%                             \incitem{luatex-fonts-enc.lua}
-%                             \incitem{luatex-fonts-syn.lua}
-%                             \incitem{luatex-fonts-tfm.lua}
-%                             \incitem{luatex-fonts-chr.lua}
-%                             \incitem{luatex-fonts-lua.lua}
-%                             \incitem{luatex-fonts-def.lua}
-%                             \incitem{luatex-fonts-ext.lua}
-%                             \incitem{luatex-fonts-cbk.lua}
-%                           \end{itemize}
-%                         \end{multicols}
-%
-%             \normalitem Code related to \emphasis{font handling and
-%                         node processing}, taken directly from
-%                         \CONTEXT.
-%                         \begin{multicols}{2}
-%                           \begin{itemize}
-%                             \incitem{data-con.lua} \incitem{font-ini.lua}
-%                             \incitem{font-con.lua} \incitem{font-cid.lua}
-%                             \incitem{font-map.lua} \incitem{font-oti.lua}
-%                             \incitem{font-otf.lua} \incitem{font-otb.lua}
-%                             \incitem{node-inj.lua} \incitem{font-ota.lua}
-%                             \incitem{font-otn.lua} \incitem{font-def.lua}
-%                           \end{itemize}
-%                         \end{multicols}
-%           \end{itemize}
-%
-%           Note that if \identifier{luaotfload} cannot locate the
-%           merged file, it will load the individual \LUA libraries
-%           instead.
-%           Their names remain the same as in \CONTEXT (without the
-%           \verb|otfl|-prefix) since they are hard-coded in
-%           \fileent{luaotfload-fonts.lua}.
-%           Thus if you prefer running bleeding edge code from the
-%           \CONTEXT beta, all you have to do is remove
-%           \fileent{luaotfload-fonts-merged.lua} from the search path.
-%
+%     \normalitem \emphasis{\LUA utility libraries}, a subset
+%                 of what is provided by the \identifier{lualibs}
+%                 package.
+%
+%                 \begin{multicols}{2}
+%                   \begin{itemize}
+%                     \incitem{l-lua.lua}       \incitem{l-lpeg.lua}
+%                     \incitem{l-function.lua}  \incitem{l-string.lua}
+%                     \incitem{l-table.lua}     \incitem{l-io.lua}
+%                     \incitem{l-file.lua}      \incitem{l-boolean.lua}
+%                     \incitem{l-math.lua}      \incitem{util-str.lua}
+%                   \end{itemize}
+%                 \end{multicols}
+%
+%     \normalitem The \emphasis{font loader} itself.
+%                 These files have been written for
+%                 \LUATEX-Fonts and they are distributed along
+%                 with \identifier{luaotfload}.
+%                 \begin{multicols}{2}
+%                   \begin{itemize}
+%                     \incitem{luatex-basics-gen.lua}
+%                     \incitem{luatex-basics-nod.lua}
+%                     \incitem{luatex-fonts-enc.lua}
+%                     \incitem{luatex-fonts-syn.lua}
+%                     \incitem{luatex-fonts-tfm.lua}
+%                     \incitem{luatex-fonts-chr.lua}
+%                     \incitem{luatex-fonts-lua.lua}
+%                     \incitem{luatex-fonts-def.lua}
+%                     \incitem{luatex-fonts-ext.lua}
+%                     \incitem{luatex-fonts-cbk.lua}
+%                   \end{itemize}
+%                 \end{multicols}
+%
+%     \normalitem Code related to \emphasis{font handling and
+%                 node processing}, taken directly from
+%                 \CONTEXT.
+%                 \begin{multicols}{2}
+%                   \begin{itemize}
+%                     \incitem{data-con.lua} \incitem{font-ini.lua}
+%                     \incitem{font-con.lua} \incitem{font-cid.lua}
+%                     \incitem{font-map.lua} \incitem{font-oti.lua}
+%                     \incitem{font-otf.lua} \incitem{font-otb.lua}
+%                     \incitem{node-inj.lua} \incitem{font-ota.lua}
+%                     \incitem{font-otn.lua} \incitem{font-def.lua}
+%                   \end{itemize}
+%                 \end{multicols}
 %   \end{itemize}
 %
+% Note that if \identifier{luaotfload} cannot locate the
+% merged file, it will load the individual \LUA libraries
+% instead.
+% Their names remain the same as in \CONTEXT (without the
+% \verb|otfl|-prefix) since we imported the relevant section of
+% \fileent{luatex-fonts.lua} unmodified into \fileent{luaotfload.lua}.
+% Thus if you prefer running bleeding edge code from the
+% \CONTEXT beta, all you have to do is remove
+% \fileent{luaotfload-merged.lua} from the search path.
+%
 % In addition to these, \identifier{luaotfload} requires a number of
 % files not contained in the merge. Some of these have no equivalent in
 % \LUATEX-Fonts or \CONTEXT, some were taken unmodified from the
-- 
cgit v1.2.3


From e102132858d372928719193246c6bd480704e11d Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Mon, 22 Apr 2013 20:23:41 +0200
Subject: update graph to current dependency structure

---
 luaotfload.dtx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index 6f2c323..ddbf228 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -911,8 +911,8 @@ and the derived files
 % \end{itemize}
 %
 % \begin{figure}[b]
-%   \caption{Schematic of the Files in \identifier{Luaotfload}}
-%   \includegraphics[width=\textheight,angle=90]{filegraph.pdf}
+%   \caption{Schematic of the files in \identifier{Luaotfload}}
+%   \includegraphics[width=\textwidth]{filegraph.pdf}
 %   \label{file-graph}
 % \end{figure}
 %
-- 
cgit v1.2.3


From 1faface747fdf8ca61c4f50518525e5d11bb1063 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 23 Apr 2013 00:56:09 +0200
Subject: move to human-readable names 1

---
 luaotfload.dtx | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index ddbf228..a22eb3f 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1314,9 +1314,9 @@ add_to_callback("hpack_filter",
 add_to_callback("find_vf_file",
                 find_vf_file, "luaotfload.find_vf_file")
 
-loadmodule"font-otc.lua"   -- TODO check what we can drop from luaotfload-features
-loadmodule"lib-dir.lua"    -- required by font-nms
-loadmodule"luat-ovr.lua"
+loadmodule"font-otc.lua"  --- TODO check what we can drop from luaotfload-features
+loadmodule"lib-dir.lua"   --- required by luaofload-database.lua
+loadmodule"override.lua"  --- “luat-ovr”
 
 %    \end{macrocode}
 % \CONTEXT does not support ofm, these lines were added in order to make it
@@ -1333,10 +1333,10 @@ loadmodule"luat-ovr.lua"
 % Now we load the modules written for \identifier{luaotfload}.
 %
 %    \begin{macrocode}
-loadmodule"font-pfb.lua"    --- new in 2.0, added 2011
-loadmodule"font-nms.lua"
-loadmodule"font-clr.lua"
-loadmodule"font-ltx.lua"    --- new in 2.0, added 2011
+loadmodule"loaders.lua"    --- “font-pfb” new in 2.0, added 2011
+loadmodule"database.lua"   --- “font-nms”
+loadmodule"colors.lua"     --- “font-clr”
+loadmodule"font-ltx.lua"   --- new in 2.0, added 2011
 
 %    \end{macrocode}
 % This hack makes fonts called with file method found by fonts.names.resolve
-- 
cgit v1.2.3


From 4701d59810a9a1aefd2d661abd3ba54a3248cf53 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 23 Apr 2013 03:54:00 +0200
Subject: annihilate luaotfload-font-otc.lua

---
 luaotfload.dtx | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index a22eb3f..790f520 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1314,7 +1314,6 @@ add_to_callback("hpack_filter",
 add_to_callback("find_vf_file",
                 find_vf_file, "luaotfload.find_vf_file")
 
-loadmodule"font-otc.lua"  --- TODO check what we can drop from luaotfload-features
 loadmodule"lib-dir.lua"   --- required by luaofload-database.lua
 loadmodule"override.lua"  --- “luat-ovr”
 
@@ -1336,7 +1335,6 @@ loadmodule"override.lua"  --- “luat-ovr”
 loadmodule"loaders.lua"    --- “font-pfb” new in 2.0, added 2011
 loadmodule"database.lua"   --- “font-nms”
 loadmodule"colors.lua"     --- “font-clr”
-loadmodule"font-ltx.lua"   --- new in 2.0, added 2011
 
 %    \end{macrocode}
 % This hack makes fonts called with file method found by fonts.names.resolve
@@ -1483,7 +1481,7 @@ do
 end
 --]]--
 
-loadmodule"features.lua"
+loadmodule"features.lua" --- contains what was “font-ltx” and “font-otc”
 
 -- vim:tw=71:sw=4:ts=4:expandtab
 
-- 
cgit v1.2.3

