From 36c87427e9bba1b3ca1dc58a0d6f914ca21bc9a6 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 28 Nov 2015 00:08:20 +0100 Subject: [doc,init] clarify default/reference distinction * default: our package (without lualibs) * reference: the package from upstream --- src/luaotfload-init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua index 0f7464a..28fe4b5 100644 --- a/src/luaotfload-init.lua +++ b/src/luaotfload-init.lua @@ -292,10 +292,19 @@ local init_main = function () or "reference" fontloader = tostring (fontloader) - if fontloader == "reference" or fontloader == "default" then + if fontloader == "reference" then logreport ("log", 4, "init", "Using reference fontloader.") load_fontloader_module (luaotfload.fontloader_package) + elseif fontloader == "default" then + --- Same as above but loader name not correctly replaced by the file name + --- of our fontloader package. Perhaps something’s wrong with the status + --- file which contains the datestamped filename? In any case, it can’t + --- hurt reporting it as a bug. + logreport ("both", 0, "init", "Fontloader substitution failed, got “default”.") + logreport ("log", 4, "init", "Falling back to reference fontloader.") + load_fontloader_module (luaotfload.fontloader_package) + elseif fontloader == "unpackaged" then logreport ("both", 4, "init", "Loading fontloader components individually.") -- cgit v1.2.3 From e4f9dfc0ddff0700767bbc769e59dc429e127857 Mon Sep 17 00:00:00 2001 From: Dohyun Kim Date: Fri, 27 Nov 2015 17:14:25 +0900 Subject: [colors] support pgf transparency in luatex v0.85 With tex.scantoks provided by luatex v0.85, now we can support color transparency in harmony with beamer/pgf/tikz. No hacking needed at tex macro level, all done in lua code. --- src/luaotfload-colors.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua index ca5a067..572c9fc 100644 --- a/src/luaotfload-colors.lua +++ b/src/luaotfload-colors.lua @@ -37,11 +37,6 @@ local nodetail = nodedirect.tail local getattribute = nodedirect.has_attribute local setattribute = nodedirect.set_attribute -local texset = tex.set -local texget = tex.get -local texsettoks = tex.settoks -local texgettoks = tex.gettoks - local stringformat = string.format local identifiers = fonts.hashes.identifiers @@ -274,6 +269,12 @@ node_colorize = function (head, toplevel, current_color) return head, current_color end +local getpageres = pdf.getpageresources or function() return pdf.pageresources end +local setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end +local catat11 = luatexbase.registernumber("catcodetable@atletter") +local gettoks, scantoks = tex.gettoks, tex.scantoks +local pgf = { bye = "pgfutil@everybye", extgs = "\\pgf@sys@addpdfresource@extgs@plain" } + --- node -> node local color_handler = function (head) head = todirect(head) @@ -283,12 +284,11 @@ local color_handler = function (head) -- now append our page resources if res then res["1"] = true - local tpr = texget("pdfpageresources") - local no_extgs = not tpr:find("/ExtGState<<.*>>") - local pgf_loaded = no_extgs and luaotfload.pgf_loaded - if pgf_loaded then - tpr = texgettoks(pgf_loaded) + if scantoks and pgf.bye and not pgf.loaded then + pgf.loaded = token.create(pgf.bye).cmdname == "assign_toks" + pgf.bye = pgf.loaded and pgf.bye end + local tpr = pgf.loaded and gettoks(pgf.bye) or getpageres() or "" local t = "" for k in pairs(res) do @@ -298,14 +298,14 @@ local color_handler = function (head) end end if t ~= "" then - if pgf_loaded then - texsettoks("global", pgf_loaded, tpr..t) + if pgf.loaded then + scantoks("global", pgf.bye, catat11, stringformat("%s{%s}%s", pgf.extgs, t, tpr)) else - if no_extgs then - tpr = tpr .. "/ExtGState<<>>" + local tpr, n = tpr:gsub("/ExtGState<<", "%1"..t) + if n == 0 then + tpr = stringformat("%s/ExtGState<<%s>>", tpr, t) end - tpr = tpr:gsub("/ExtGState<<", "%1"..t) - texset("global", "pdfpageresources", tpr) + setpageres(tpr) end end res = nil -- reset res -- cgit v1.2.3 From 78a1273715f8681fe8cb013b9699df11bfa56eaa Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 28 Nov 2015 14:58:19 +0100 Subject: [diagnose] adapt invocation of getwritablepath() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some upstream API change (possibly in file.join()) caused that function to emit relative paths. file.join("/foo", "bar") --> good file.join("/foo", "" ) --> good file.join("/foo" ) --> wtf‽ --- src/luaotfload-diagnostics.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/luaotfload-diagnostics.lua b/src/luaotfload-diagnostics.lua index 582105a..cd5082c 100644 --- a/src/luaotfload-diagnostics.lua +++ b/src/luaotfload-diagnostics.lua @@ -171,6 +171,11 @@ local get_permissions = function (t, location) location = lpegmatch (stripslashes, location) end local attributes = lfsattributes (location) + if not attributes then + print"" + print("attr", location, attributes) + os.exit() + end if not attributes and t == "f" then attributes = get_tentative_attributes (location) @@ -238,12 +243,10 @@ local check_conformance = function (spec, permissions, errcnt) return errcnt end -local desired_permissions local init_desired_permissions = function () - inspect(config.luaotfload.paths) local paths = config.luaotfload.paths - desired_permissions = { - { "d", {"r","w"}, function () return caches.getwritablepath () end }, + return { + { "d", {"r","w"}, function () return caches.getwritablepath ("", "") end }, { "d", {"r","w"}, paths.prefix }, { "f", {"r","w"}, paths.index_path_lua .. ".gz" }, { "f", {"r","w"}, paths.index_path_luc }, @@ -254,7 +257,7 @@ end local check_permissions = function (errcnt) out [[=============== file permissions ==============]] - if not desired_permissions then init_desired_permissions () end + local desired_permissions = init_desired_permissions () for i = 1, #desired_permissions do local t, spec, path = unpack (desired_permissions[i]) if type (path) == "function" then -- cgit v1.2.3 From e0c25f5fce650835da6316287164408476152b45 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 28 Nov 2015 15:00:41 +0100 Subject: [tool,db] make cache directives work again These were rendered unusable due to the suspended initialization. Creating the directives mapping on the fly is just as good. --- src/luaotfload-database.lua | 2 +- src/luaotfload-tool.lua | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 35450b5..881cfe8 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -3414,7 +3414,7 @@ end local getwritablecachepath = function ( ) --- fonts.handlers.otf doesn’t exist outside a Luatex run, --- so we have to improvise - local writable = getwritablepath (config.luaotfload.paths.cache_dir) + local writable = getwritablepath (config.luaotfload.paths.cache_dir, "") if writable then return writable end diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index ab025b3..ab495a9 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -858,7 +858,7 @@ end --- bisect mode ------------------------------------------------------------------------------- -local bisect_status_path = caches.getwritablepath "bisect" +local bisect_status_path = caches.getwritablepath ("bisect", "") local bisect_status_file = bisect_status_path .."/" .. "luaotfload-bisect-status.lua" local bisect_status_fmt = [[ --[==[------------------------------------------------------------------------- @@ -1174,14 +1174,17 @@ actions.flush = function (job) return false, false end -local cache_directives = { - ["purge"] = fonts.names.purge_cache, - ["erase"] = fonts.names.erase_cache, - ["show"] = fonts.names.show_cache, -} +local cache_directives = function () + --- These exist only after initialization. + return { + ["purge"] = fonts.names.purge_cache, + ["erase"] = fonts.names.erase_cache, + ["show"] = fonts.names.show_cache, + } +end actions.cache = function (job) - local directive = cache_directives[job.cache] + local directive = cache_directives()[job.cache] if not directive or type(directive) ~= "function" then logreport ("info", 2, "cache", "Invalid font cache directive %s.", job.cache) -- cgit v1.2.3 From 64efae348057cedf3c6cebe0edc92952f0d51b81 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 28 Nov 2015 23:00:04 +0100 Subject: [main] remove locals for provides_module() return values As of ltluatex, provides_module() has no return value any longer. --- src/luaotfload-main.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index 17d06d4..6fe49e2 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -62,8 +62,7 @@ local luatexbase = luatexbase local require = require local type = type -local _error, _warning, _info, _log = - luatexbase.provides_module(luaotfload.module) +luatexbase.provides_module (luaotfload.module) --[[doc-- -- cgit v1.2.3 From fb41f30dd8120532307f6ca1c227cd4807d4f719 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 29 Nov 2015 21:41:23 +0100 Subject: [aux] fix typo in function name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Doesn’t seem like anyone is using these since this would’ve exploded immediately … --- src/luaotfload-auxiliary.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua index 15541af..c50e0cd 100644 --- a/src/luaotfload-auxiliary.lua +++ b/src/luaotfload-auxiliary.lua @@ -63,7 +63,7 @@ aux.start_rewrite_fontname = start_rewrite_fontname local stop_rewrite_fontname = function () if rewriting == true then - luatexbase.remove_fromt_callback + luatexbase.remove_from_callback ("luaotfload.patch_font", "luaotfload.rewrite_fontname") rewriting = false report ("log", 1, "aux", -- cgit v1.2.3 From f7f541616aaf77c5f2ecb40a50f72b2e94575675 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 29 Nov 2015 22:04:00 +0100 Subject: [loaders] customize define_font reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function needn’t be as general for this kind of callback. The new implementation is simpler but also complains about irregularities like multiple registered functions. --- src/luaotfload-loaders.lua | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index 715aa8a..0ae281e 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -110,13 +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) +local purge_define_font = function () + local cdesc = luatexbase.callback_descriptions "define_font" + --- define_font is an “exclusive” callback, meaning that there can + --- only ever be one entry. Everything beyond that would indicate + --- that something is broken. + local _, d = next (cdesc) + if d then + local i, d2 = next (cdesc, 1) + if d2 then --> issue warning + logreport ("both", 0, "loaders", + "Callback table for define_font contains multiple entries: \z + { [%d] = “%s” } -- seems fishy.", i, d2) + end + logreport ("log", 0, "loaders", + "Entry ``%s`` present in define_font callback; overriding.", d) + luatexbase.remove_from_callback ("define_font", d) end end @@ -125,7 +134,7 @@ local install_callbacks = function () local dummy_function = function () end create_callback ("luaotfload.patch_font", "simple", dummy_function) create_callback ("luaotfload.patch_font_unsafe", "simple", dummy_function) - reset_callback "define_font" + purge_define_font () local definer = config.luaotfload.run.definer luatexbase.add_to_callback ("define_font", definers[definer or "patch"], -- cgit v1.2.3 From e8c12e905db79d0a7cc716ae6d6d02663cbd085e Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 29 Nov 2015 22:26:45 +0100 Subject: [conf] ensure correct fontloader is loaded without config file --- src/luaotfload-configuration.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index 57311dc..0be7c14 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -126,8 +126,12 @@ local feature_presets = { --doc]]-- +local default_fontloader = function () + return luaotfloadstatus and luaotfloadstatus.notes.loader or "reference" +end + local registered_loaders = { - default = luaotfloadstatus and luaotfloadstatus.notes.loader or "reference", + default = default_fontloader (), reference = "reference", unpackaged = "unpackaged", context = "context", @@ -198,7 +202,7 @@ local default_config = { definer = "patch", log_level = 0, color_callback = "post_linebreak_filter", - fontloader = "default", + fontloader = default_fontloader (), }, misc = { bisect = false, -- cgit v1.2.3 From c27353ac580901c2afe392a473b2cc53ffcf394e Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 29 Nov 2015 22:35:33 +0100 Subject: [main] refine very early logging This kludge dumps the input arguments on one line each -- fix this by defining a dumb imitation of our real logger that is installed later on. --- src/luaotfload-main.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index 6fe49e2..dd94b1e 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -98,7 +98,13 @@ end local make_loader_name = function (prefix, name) local msg = luaotfload.log and luaotfload.log.report - or function (...) texio.write_nl ("log", ...) end + or function (stream, lvl, cat, ...) + if lvl > 1 then --[[not pressing]] return end + texio.write_nl ("log", + string.format ("luaotfload | %s : ", + tostring (cat))) + texio.write (string.format (...)) + end if not name then msg ("both", 0, "load", "Fatal error: make_loader_name (“%s”, “%s”).", -- cgit v1.2.3 From 9ceba217e323ab5572ab32708af1f4e1934397a7 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 29 Nov 2015 22:46:38 +0100 Subject: [*] tidy up headers, attributions --- src/luaotfload-colors.lua | 2 +- src/luaotfload-configuration.lua | 2 +- src/luaotfload-diagnostics.lua | 2 +- src/luaotfload-init.lua | 2 +- src/luaotfload-loaders.lua | 5 +++-- src/luaotfload-main.lua | 2 +- src/luaotfload.sty | 1 + 7 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua index 572c9fc..c75696a 100644 --- a/src/luaotfload-colors.lua +++ b/src/luaotfload-colors.lua @@ -1,7 +1,7 @@ if not modules then modules = { } end modules ['luaotfload-colors'] = { version = "2.6", comment = "companion to luaotfload-main.lua (font color)", - author = "Khaled Hosny, Elie Roux, Philipp Gesang, Dohyun Kim", + author = "Khaled Hosny, Elie Roux, Philipp Gesang, Dohyun Kim, David Carlisle", copyright = "Luaotfload Development Team", license = "GNU GPL v2.0" } diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index 0be7c14..5e2800d 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -3,7 +3,7 @@ -- FILE: luaotfload-configuration.lua -- DESCRIPTION: config file reader -- REQUIREMENTS: Luaotfload 2.6 or above --- AUTHOR: Philipp Gesang (Phg), +-- AUTHOR: Philipp Gesang, -- AUTHOR: Dohyun Kim ------------------------------------------------------------------------------- -- diff --git a/src/luaotfload-diagnostics.lua b/src/luaotfload-diagnostics.lua index cd5082c..a3a1841 100644 --- a/src/luaotfload-diagnostics.lua +++ b/src/luaotfload-diagnostics.lua @@ -3,7 +3,7 @@ -- FILE: luaotfload-diagnostics.lua -- DESCRIPTION: functionality accessible by the --diagnose option -- REQUIREMENTS: luaotfload-tool.lua --- AUTHOR: Philipp Gesang (Phg), +-- AUTHOR: Philipp Gesang ----------------------------------------------------------------------- -- local names = fonts.names diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua index 28fe4b5..a8fc77b 100644 --- a/src/luaotfload-init.lua +++ b/src/luaotfload-init.lua @@ -2,7 +2,7 @@ ----------------------------------------------------------------------- -- FILE: luaotfload-init.lua -- DESCRIPTION: Luaotfload font loader initialization --- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase +-- REQUIREMENTS: luatex v.0.80 or later; packages lualibs -- AUTHOR: Philipp Gesang (Phg), ----------------------------------------------------------------------- -- diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index 0ae281e..0f22f46 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -2,8 +2,9 @@ ----------------------------------------------------------------------- -- FILE: luaotfload-loaders.lua -- DESCRIPTION: Luaotfload callback handling --- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase --- AUTHOR: Philipp Gesang (Phg), , Hans Hagen, Khaled Hosny, Elie Roux +-- REQUIREMENTS: luatex v.0.80 or later; package lualibs +-- AUTHOR: Philipp Gesang +-- AUTHOR: Hans Hagen, Khaled Hosny, Elie Roux, David Carlisle ----------------------------------------------------------------------- -- --- Contains parts of the earlier main script. diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index dd94b1e..b8050e4 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -1,7 +1,7 @@ ----------------------------------------------------------------------- -- FILE: luaotfload-main.lua -- DESCRIPTION: Luaotfload entry point --- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase +-- REQUIREMENTS: luatex v.0.80 or later; packages lualibs -- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang ----------------------------------------------------------------------- -- diff --git a/src/luaotfload.sty b/src/luaotfload.sty index ad4ef2d..c674ab0 100644 --- a/src/luaotfload.sty +++ b/src/luaotfload.sty @@ -4,6 +4,7 @@ %% and Khaled Hosny %% and Philipp Gesang %% and Dohyun Kim +%% and David Carlisle %% %% This file is part of Luaotfload. %% -- cgit v1.2.3