From d99f5611eb09923ce4107b64e50c9826aa4601b1 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg@phi-gamma.net>
Date: Wed, 23 Dec 2015 07:50:47 +0100
Subject: [auxiliary] move callback handling to initialization

---
 src/luaotfload-auxiliary.lua | 81 +++++++++++++++++++++++++++++++-------------
 src/luaotfload-main.lua      |  2 +-
 2 files changed, 59 insertions(+), 24 deletions(-)

diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua
index 11d3101..8292ddd 100644
--- a/src/luaotfload-auxiliary.lua
+++ b/src/luaotfload-auxiliary.lua
@@ -10,10 +10,7 @@
 --- this file addresses issue #24
 --- https://github.com/lualatex/luaotfload/issues/24#
 
-luaotfload                  = luaotfload or {}
-luaotfload.aux              = luaotfload.aux or { }
-
-local aux                   = luaotfload.aux
+luaotfload                  = luaotfload or { }
 local log                   = luaotfload.log
 local logreport             = log.report
 local fonthashes            = fonts.hashes
@@ -35,6 +32,9 @@ local stringbyte            = string.byte
 local stringfind            = string.find
 local tablecopy             = table.copy
 
+local aux                   = { }
+local luaotfload_callbacks  = { }
+
 -----------------------------------------------------------------------
 ---                          font patches
 -----------------------------------------------------------------------
@@ -89,10 +89,9 @@ local set_sscale_dimens = function (fontdata)
   return fontdata
 end
 
-luatexbase.add_to_callback(
-  "luaotfload.patch_font",
-  set_sscale_dimens,
-  "luaotfload.aux.set_sscale_dimens")
+luaotfload_callbacks [#luaotfload_callbacks + 1] = {
+  "patch_font", set_sscale_dimens, "set_sscale_dimens",
+}
 
 --- fontobj -> int
 local lookup_units = function (fontdata)
@@ -124,11 +123,10 @@ local patch_cambria_domh = function (fontdata)
   end
 end
 
-luatexbase.add_to_callback(
-  "luaotfload.patch_font",
-  patch_cambria_domh,
-  "luaotfload.aux.patch_cambria_domh")
-  
+luaotfload_callbacks [#luaotfload_callbacks + 1] = {
+  "patch_font", patch_cambria_domh, "patch_cambria_domh",
+}
+
 
 --[[doc--
 
@@ -152,11 +150,10 @@ local fixup_fontdata = function (data)
 
 end
 
-luatexbase.add_to_callback(
-  "luaotfload.patch_font_unsafe",
-  fixup_fontdata,
-  "luaotfload.aux.fixup_fontdata")
-  
+luaotfload_callbacks [#luaotfload_callbacks + 1] = {
+  "patch_font_unsafe", fixup_fontdata, "fixup_fontdata",
+}
+
 
 --[[doc--
 
@@ -204,10 +201,9 @@ local set_capheight = function (fontdata)
     end
 end
 
-luatexbase.add_to_callback(
-  "luaotfload.patch_font",
-  set_capheight,
-  "luaotfload.aux.set_capheight")
+luaotfload_callbacks [#luaotfload_callbacks + 1] = {
+  "patch_font", set_capheight, "set_capheight",
+}
 
 -----------------------------------------------------------------------
 ---                      glyphs and characters
@@ -843,4 +839,43 @@ end
 
 aux.get_quad = get_quad
 
--- vim:tw=71:sw=2:ts=2:expandtab
+
+-----------------------------------------------------------------------
+---                         initialization
+-----------------------------------------------------------------------
+
+local inject_callbacks = function (lst)
+  if not lst and next (lst) then return false end
+
+  local inject = function (def)
+    local cb, fn, id = unpack (def)
+    cb = tostring (cb)
+    id = tostring (id)
+    if not cb or not fn or not id or not type (fn) == "function" then
+      logreport ("both", 0, "aux", "Invalid callback requested (%q, %s, %q).",
+                 cb, tostring (fn), id)
+      return false
+    end
+    cb = stringformat ("luaotfload.%s",     cb)
+    id = stringformat ("luaotfload.aux.%s", id)
+    logreport ("log", 5, "aux", "Installing callback %q->%q.", cb, id)
+    luatexbase.add_to_callback (cb, fn, id)
+    return true
+  end
+
+  local ret = true
+  for i = 1, #lst do ret = inject (lst [i]) end
+  return ret
+end
+
+return {
+  init = function ()
+    local ret = true
+    luaotfload.aux = aux
+    ret = inject_callbacks (luaotfload_callbacks)
+    return ret
+  end
+}
+
+-- vim:tw=79:sw=2:ts=8:et
+
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index 9525ca4..c843f26 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -254,7 +254,7 @@ luaotfload.main = function ()
 
     initialize "features"     --- font request and feature handling
     loadmodule "letterspace"  --- extra character kerning
-    loadmodule "auxiliary"    --- additional high-level functionality
+    initialize "auxiliary"    --- additional high-level functionality
 
     luaotfload.aux.start_rewrite_fontname () --- to be migrated to fontspec
 
-- 
cgit v1.2.3


From f2bec680fb7d011b2a1b4f0add90a94100f610a2 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg@phi-gamma.net>
Date: Wed, 23 Dec 2015 22:07:14 +0100
Subject: [fontloader] sync reference loader

---
 src/fontloader/runtime/fontloader-reference.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/fontloader/runtime/fontloader-reference.lua b/src/fontloader/runtime/fontloader-reference.lua
index 46de1d0..9208e52 100644
--- a/src/fontloader/runtime/fontloader-reference.lua
+++ b/src/fontloader/runtime/fontloader-reference.lua
@@ -1,6 +1,6 @@
 -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
 -- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date  : 12/21/15 16:29:15
+-- merge date  : 12/22/15 10:50:54
 
 do -- begin closure to overcome local limits and interference
 
@@ -7418,6 +7418,7 @@ local ordered_enhancers={
   "check encoding",
   "add duplicates",
   "expand lookups",
+  "check extra features",
   "cleanup tables",
   "compact lookups",
   "purge names",
@@ -7688,7 +7689,6 @@ function otf.load(filename,sub,featurefile)
       applyruntimefixes(filename,data)
     end
     enhance("add dimensions",data,filename,nil,false)
-enhance("check extra features",data,filename)
     if trace_sequences then
       showfeatureorder(data,filename)
     end
-- 
cgit v1.2.3


From 9320186751b6c6a1113f41331716d3b68d73af7a Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg@phi-gamma.net>
Date: Wed, 23 Dec 2015 22:40:58 +0100
Subject: [features] excise stray feature definition

Closing #309

Many thanks for @simifilm for the report!
---
 src/luaotfload-features.lua | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua
index 3f9d67a..3922882 100644
--- a/src/luaotfload-features.lua
+++ b/src/luaotfload-features.lua
@@ -1405,19 +1405,6 @@ local tlig_specification = {
     },
 }
 
-local tlig_specification = {
-    type      = "substitution",
-    features  = everywhere,
-    data      = {
-        [0x0022] = 0x201D,                   -- quotedblright
-        [0x0027] = 0x2019,                   -- quoteleft
-        [0x0060] = 0x2018,                   -- quoteright
-    },
-    flags     = noflags,
-    order     = { "tlig" },
-    prepend   = true,
-}
-
 local anum_arabic = { --- these are the same as in font-otc
     [0x0030] = 0x0660,
     [0x0031] = 0x0661,
-- 
cgit v1.2.3