From 57edc8b592575a0fff30b0a23e6425adc04b974f Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Tue, 28 Jul 2015 18:39:05 +0100 Subject: Patch to not assume luatexbase needs to be loaded The ltluatex code being trialed at https://github.com/josephwright/ltluatex includes a luatexbase emulation package that allows luaotfload to run without change but the core code that is intended to be included in future latex formats requires two small changes and also would require that luaotfload detect that luatex support is already provided and so not load luatexbase. \RequireLuaModule is not defined by default in TeX and luatexbase.reset_callback is not defined by default in lua in the core ltluatex code. --- src/luaotfload-main.lua | 4 +++- src/luaotfload.sty | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index b633ed7..919e343 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -249,7 +249,9 @@ do definers.info_generic = mk_info "generic" end -reset_callback "define_font" +if not reset_callback == nil then + reset_callback "define_font" +end --[[doc-- diff --git a/src/luaotfload.sty b/src/luaotfload.sty index 34f9a87..bff949b 100644 --- a/src/luaotfload.sty +++ b/src/luaotfload.sty @@ -35,16 +35,24 @@ \let\ifluaotfloadloaded\endinput \bgroup\expandafter\expandafter\expandafter\egroup \expandafter\ifx\csname selectfont\endcsname\relax + \ifdefined\newluafunction\else \input luatexbase.sty + \fi \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luaotfload}% %% FIXME The date is meaningless, we need to find a way to %% use the git revision instead. [2015/03/29 v2.6 OpenType layout system] - \RequirePackage{luatexbase} + \ifdefined\newluafunction\else + \RequirePackage{luatexbase} + \fi +\fi +\ifdefined \RequireLuaModule + \RequireLuaModule{luaotfload-main} +\else + \directlua{require("luaotfload-main")} \fi -\RequireLuaModule{luaotfload-main} % for compatibility with beamer class, which loads pgf package. \ifcsname selectfont\endcsname -- cgit v1.2.3 From 2985566f7f478d5f0ac8eb9c9ec7330f6e9a10c2 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Tue, 28 Jul 2015 18:39:05 +0100 Subject: Patch to not assume luatexbase needs to be loaded The ltluatex code being trialed at https://github.com/josephwright/ltluatex includes a luatexbase emulation package that allows luaotfload to run without change but the core code that is intended to be included in future latex formats requires two small changes and also would require that luaotfload detect that luatex support is already provided and so not load luatexbase. \RequireLuaModule is not defined by default in TeX and luatexbase.reset_callback is not defined by default in lua in the core ltluatex code. --- src/luaotfload-main.lua | 4 +++- src/luaotfload.sty | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index b633ed7..919e343 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -249,7 +249,9 @@ do definers.info_generic = mk_info "generic" end -reset_callback "define_font" +if not reset_callback == nil then + reset_callback "define_font" +end --[[doc-- diff --git a/src/luaotfload.sty b/src/luaotfload.sty index c9c9864..825a3a5 100644 --- a/src/luaotfload.sty +++ b/src/luaotfload.sty @@ -35,14 +35,22 @@ \let\ifluaotfloadloaded\endinput \bgroup\expandafter\expandafter\expandafter\egroup \expandafter\ifx\csname selectfont\endcsname\relax + \ifdefined\newluafunction\else \input luatexbase.sty + \fi \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luaotfload}% %% FIXME The date is meaningless, we need to find a way to %% use the git revision instead. [2015/03/29 v2.6 OpenType layout system] - \RequirePackage{luatexbase} + \ifdefined\newluafunction\else + \RequirePackage{luatexbase} + \fi +\fi +\ifdefined \RequireLuaModule + \RequireLuaModule{luaotfload-main} +\else + \directlua{require("luaotfload-main")} \fi -\RequireLuaModule{luaotfload-main} -- cgit v1.2.3 From 7653d470fb19a1d1c83c674f847a3abc926fd115 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Sat, 3 Oct 2015 13:30:55 +0100 Subject: just use ltluatex not luatexbase --- src/luaotfload.sty | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/luaotfload.sty b/src/luaotfload.sty index 825a3a5..1445a28 100644 --- a/src/luaotfload.sty +++ b/src/luaotfload.sty @@ -33,24 +33,14 @@ %% \csname ifluaotfloadloaded\endcsname \let\ifluaotfloadloaded\endinput -\bgroup\expandafter\expandafter\expandafter\egroup -\expandafter\ifx\csname selectfont\endcsname\relax - \ifdefined\newluafunction\else - \input luatexbase.sty - \fi -\else - \NeedsTeXFormat{LaTeX2e} +\let\ifluaotfloadloaded\endinput +\ifx\newluafunction\@undefined + \input ltluatex +\fi +\ifdefined\ProvidesPackage \ProvidesPackage{luaotfload}% %% FIXME The date is meaningless, we need to find a way to %% use the git revision instead. - [2015/03/29 v2.6 OpenType layout system] - \ifdefined\newluafunction\else - \RequirePackage{luatexbase} - \fi -\fi -\ifdefined \RequireLuaModule - \RequireLuaModule{luaotfload-main} -\else - \directlua{require("luaotfload-main")} + [2014/08/10 v2.5-4 OpenType layout system] \fi - +\directlua{require('luaotfload-main')} -- cgit v1.2.3 From a472b6fd5461318ec1e5d2899af2ef57f0fb14e8 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Sat, 21 Nov 2015 21:41:44 +0000 Subject: for 2.6 --- src/luaotfload.sty | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/luaotfload.sty b/src/luaotfload.sty index 1445a28..ba61428 100644 --- a/src/luaotfload.sty +++ b/src/luaotfload.sty @@ -33,7 +33,6 @@ %% \csname ifluaotfloadloaded\endcsname \let\ifluaotfloadloaded\endinput -\let\ifluaotfloadloaded\endinput \ifx\newluafunction\@undefined \input ltluatex \fi @@ -41,6 +40,9 @@ \ProvidesPackage{luaotfload}% %% FIXME The date is meaningless, we need to find a way to %% use the git revision instead. - [2014/08/10 v2.5-4 OpenType layout system] + [2015/03/29 v2.6 OpenType layout system] \fi -\directlua{require('luaotfload-main')} +\directlua{ +require('luaotfload-main') +local _void = luaotfload.main () +} -- cgit v1.2.3 From 7c6bf5503a31142a91f4414d2f5ef4e6b0baed46 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Sat, 21 Nov 2015 21:47:18 +0000 Subject: local reset_callback definition for ltluatex --- src/luaotfload-loaders.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index 38062f6..715aa8a 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -110,12 +110,22 @@ end --doc]]-- +local function reset_callback(name,make_false) + for _,v in pairs(luatexbase.callback_descriptions(name)) + do + luatexbase.remove_from_callback(name,v) + end + if make_false == true then + luatexbase.disable_callback(name) + end +end + local install_callbacks = function () local create_callback = luatexbase.create_callback local dummy_function = function () end create_callback ("luaotfload.patch_font", "simple", dummy_function) create_callback ("luaotfload.patch_font_unsafe", "simple", dummy_function) - luatexbase.reset_callback "define_font" + reset_callback "define_font" local definer = config.luaotfload.run.definer luatexbase.add_to_callback ("define_font", definers[definer or "patch"], -- cgit v1.2.3