diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2015-11-29 22:53:50 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2015-11-29 22:53:50 +0100 |
commit | 12b177a7f918797314efadf3a70afe40b3e060e5 (patch) | |
tree | 3254587ae3352186b2f6798c2a06b89cbf1d6ee0 | |
parent | 3966255142bdf450ea92376349160f90a69368f8 (diff) | |
parent | 9ceba217e323ab5572ab32708af1f4e1934397a7 (diff) | |
download | luaotfload-12b177a7f918797314efadf3a70afe40b3e060e5.tar.gz |
Merge pull request #301 from phi-gamma/master
fixes, rc3
-rw-r--r-- | Makefile | 15 | ||||
-rw-r--r-- | doc/filegraph.dot | 2 | ||||
-rw-r--r-- | doc/luaotfload-main.tex | 49 | ||||
-rw-r--r-- | doc/luaotfload.conf.rst | 44 | ||||
-rwxr-xr-x | scripts/mkstatus | 116 | ||||
-rw-r--r-- | src/luaotfload-auxiliary.lua | 2 | ||||
-rw-r--r-- | src/luaotfload-colors.lua | 34 | ||||
-rw-r--r-- | src/luaotfload-configuration.lua | 10 | ||||
-rw-r--r-- | src/luaotfload-database.lua | 2 | ||||
-rw-r--r-- | src/luaotfload-diagnostics.lua | 15 | ||||
-rw-r--r-- | src/luaotfload-init.lua | 13 | ||||
-rw-r--r-- | src/luaotfload-loaders.lua | 30 | ||||
-rw-r--r-- | src/luaotfload-main.lua | 13 | ||||
-rwxr-xr-x | src/luaotfload-tool.lua | 17 | ||||
-rw-r--r-- | src/luaotfload.sty | 1 |
15 files changed, 245 insertions, 118 deletions
@@ -194,10 +194,14 @@ sign: $(CTAN_ZIPSIG) .PHONY: install manifest clean mrproper show showtargets check import news -install: $(ALL_STATUS) - @echo "Installing in '$(TEXMFROOT)'." - $(run-install-docs) - $(run-install) +install: + @echo " ××××××××××××××××××××××××××××××××" + @echo " There is no “install” target." + @echo " ××××××××××××××××××××××××××××××××" + @echo " Compile a TDS zipball (make tds)" + @echo " and extract that into your local" + @echo " TEXMF instead." + @echo " ××××××××××××××××××××××××××××××××" manifest: @echo "Source files:" @@ -237,6 +241,9 @@ showtargets: @echo " chars import char-def.lua as luaotfload-characters.lua" @echo " status create repository info (luaotfload-status.lua)" @echo + @echo " import grab files from upstream" + @echo " package package fontloader" + @echo @echo " tds package a zipball according to the TDS" @echo " ctan package a zipball for uploading to CTAN" @echo " sign sign zipball" diff --git a/doc/filegraph.dot b/doc/filegraph.dot index af3c8ad..9773ebd 100644 --- a/doc/filegraph.dot +++ b/doc/filegraph.dot @@ -204,7 +204,7 @@ strict digraph luaotfload_files { //looks weird with circo ... style = "filled,rounded", penwidth=2] - fontloader [label = "fontloader-reference.lua", + fontloader [label = "fontloader-YY-MM-DD.lua", shape = rect, width = "3.2cm", height = "1.2cm", diff --git a/doc/luaotfload-main.tex b/doc/luaotfload-main.tex index 28f92f7..26d7314 100644 --- a/doc/luaotfload-main.tex +++ b/doc/luaotfload-main.tex @@ -1105,6 +1105,7 @@ Below is a commented list of the files distributed with See figure \ref{file-graph} on page \pageref{file-graph} for a graphical representation of the dependencies. % +\label{package}% Through the script \fileent{luaotfload-package.lua} the \CONTEXT utility \fileent{mtx-package} is invoked to create the \identifier{luaotfload} fontloader as a merged (amalgamated) source @@ -1120,14 +1121,24 @@ file.\footnote{% \fileent{util-mrg.lua} that is part of \CONTEXT. } % -This file constitutes the “reference fontloader” and is part of the -\identifier{luaotfload} package as \fileent{fontloader-reference.lua}. +This file constitutes the “default fontloader” and is part of the +\identifier{luaotfload} package as \fileent{fontloader-YY-MM-DD.lua}, +where the uppercase letters are placeholders for the build date. +% A companion to it, \fileent{luatex-basics-gen.lua} must be loaded beforehand to set up parts of the environment required by the \CONTEXT libraries. % During a \TEX\ run, the fontloader initialization and injection happens in the module \fileent{luaotfload-init.lua}. +% +Additionally, the “reference fontloader” as imported from \LUATEX-Fonts +is provided as the file \fileent{fontloader-reference.lua}. +% +This file is self-contained in that it packages all the auxiliary \LUA +libraries too, as Luaotfload did up to the 2.5 series; since that job +has been offloaded to the \identifier{Lualibs} package, loading this +fontloader introduces a certain code duplication. A number of \emphasis{\LUA utility libraries} are not part of the \identifier{luaotfload} fontloader, contrary to its equivalent in @@ -1273,14 +1284,17 @@ files not contained in the merge. Some of these have no equivalent in \beginsubsection {Packaging} +\label{sec:pkg}% The fontloader code is integrated as an isolated component that can be switched out on demand. +% To specify the fontloader you wish to use, the configuration file (described in section \ref{sec:conf}) provides the option \inlinecode{fontloader}. +% Its value can be one of the identifiers \inlinecode{default} or -\inlinecode{reference} or the name of a file somewhere in the search -path of \LUATEX. +\inlinecode{reference} (see above, section \ref{package}) or the name +of a file somewhere in the search path of \LUATEX. % This will make \identifier {Luaotfload} locate the \CONTEXT source by means of \identifier{kpathsea} lookups and use those instead of the @@ -1298,18 +1312,12 @@ The parameter may be extended with a path to the \CONTEXT standalone distribution or a source repository -- outside the current \TEX distribution. -Like the \identifier{Lualibs} package, the reference fontloader is -deployed as a \emphasis{merged package} containing a series of \LUA -files joined together in their expected order and stripped of -non-significant parts. +Like the \identifier{Lualibs} package, the fontloader is deployed as a +\emphasis{merged package} containing a series of \LUA files joined +together in their expected order and stripped of non-significant parts. % The \fileent{mkimport} utility assists in pulling the files from a \CONTEXT tree and packaging them for use with \identifier{Luaotfload}.% -\footnote{% - These tasks are performed, respectively, by the build targets - \inlinecode{import} and \inlinecode{package} of the - \identifier{Luaotfload} makefile. -} % The state of the files currently in \identifier{Luaotfload}’s repository can be queried: @@ -1329,6 +1337,21 @@ Whereas the command for packaging requires a path to the ./scripts/mkimport package ./src/fontloader/luaotfload-package.lua fontloader-custom.lua \endlisting +From the toplevel makefile, the targets \inlinecode{import} and +\inlinecode{package} provide easy access to the commands as invoked during +the \identifier{Luaotfload} build process.\footnote{% + \emphasis{Hint for those interested in the packaging process}: issue + \inlinecode{make show} for a list of available build routines. +} +These will call \inlinecode{mkimport} script with the correct +parameters to generate a datestamped package. +% +Whether files have been updated in the upstream distribution can be +queried by \inlinecode{./scripts/mkimport news}. +% +This will compare the imported files with their counterparts in the +\CONTEXT distribution and report changes. + \endsubsection \endsection diff --git a/doc/luaotfload.conf.rst b/doc/luaotfload.conf.rst index 12dd887..958ecee 100644 --- a/doc/luaotfload.conf.rst +++ b/doc/luaotfload.conf.rst @@ -297,27 +297,29 @@ break tools like Fontspect that rely on the ``patch_font`` callback provided by Luaotfload to perform important corrections on font data. The fontloader backend can be selected by setting the value of -``fontloader``. Other than the default, which selects the packaged -``reference`` loader as shipped with Luaotfload, a file name accessible -by kpathsea can be specified. Alternatively, the individual files that -constitute the fontloader can be loaded directly. While less efficient, -this greatly aids debugging since error messages will reference the -actual line numbers of the source files and explanatory comments are -not stripped. Currently, three distinct loading strategies are -available: ``unpackaged`` will load the batch that is part of -Luaotfload. These contain the identical source code that the reference -fontloader has been compiled from. Another option, ``context`` will -attempt to load the same files by their names in the Context format -from the search path. Consequently this option allows to use the -version of Context that comes with the TeX distribution. Distros tend -to prefer the stable version (“current” in Context jargon) of those -files so certain bugs encountered in the more bleeding edge Luaotfload -can be avoided this way. A third option is to use ``context`` with a -colon to specify a directory prefix where the *TEXMF* is located that -the files should be loaded from, e. g. ``context:~/context/tex/texmf-context``. -This can be used when referencing another distribution like the Context -minimals that is installed under a different path not indexed by -kpathsea. +``fontloader``. The most important choices are ``default``, which will +load the dedicated Luaotfload fontloader, and ``reference``, the +upstream package as shipped with Luaotfload. Other than those, a file +name accessible via kpathsea can be specified. + +Alternatively, the individual files that constitute the fontloader can +be loaded directly. While less efficient, this greatly aids debugging +since error messages will reference the actual line numbers of the +source files and explanatory comments are not stripped. Currently, +three distinct loading strategies are available: ``unpackaged`` will +load the batch that is part of Luaotfload. These contain the identical +source code that the reference fontloader has been compiled from. +Another option, ``context`` will attempt to load the same files by +their names in the Context format from the search path. Consequently +this option allows to use the version of Context that comes with the +TeX distribution. Distros tend to prefer the stable version (“current” +in Context jargon) of those files so certain bugs encountered in the +more bleeding edge Luaotfload can be avoided this way. A third option +is to use ``context`` with a colon to specify a directory prefix where +the *TEXMF* is located that the files should be loaded from, e. g. +``context:~/context/tex/texmf-context``. This can be used when +referencing another distribution like the Context minimals that is +installed under a different path not indexed by kpathsea. The value of ``log-level`` sets the default verbosity of messages printed by Luaotfload. Only messages defined with a verbosity of less diff --git a/scripts/mkstatus b/scripts/mkstatus index 809d4af..f27d571 100755 --- a/scripts/mkstatus +++ b/scripts/mkstatus @@ -35,35 +35,95 @@ local stringmatch = string.match local verbose = false local filelist = "./build/luaotfload-status.lua" --- result +local srcdir = "src" +local builddir = "build" +local scriptdir = "scripts" +local loaderdir = "src/fontloader" +local rtdir = "src/fontloader/runtime" +local miscdir = "src/fontloader/misc" + local names = { - --- only the runtime files and scripts - { "src", "luaotfload-auxiliary.lua", }, - { "src/fontloader/runtime", "fontloader-basics-gen.lua", }, - --{ "src/fontloader", "fontloader-basics-nod.lua", }, - { "build", "luaotfload-characters.lua", }, - { "src", "luaotfload-colors.lua", }, - { "src", "luaotfload-database.lua", }, - { "src", "luaotfload-diagnostics.lua", }, - { "src", "luaotfload-features.lua", }, - --{ "src/fontloader", "fontloader-fonts-cbk.lua", }, - --{ "src/fontloader", "fontloader-fonts-def.lua", }, - --{ "src/fontloader", "fontloader-fonts-enc.lua", }, - --{ "src/fontloader", "fontloader-fonts-ext.lua", }, - --{ "src/fontloader", "fontloader-fonts-lua.lua", }, - --{ "src/fontloader", "fontloader-fonts-tfm.lua", }, - { "build", "luaotfload-glyphlist.lua", }, - { "src", "luaotfload-letterspace.lua", }, - { "src", "luaotfload-loaders.lua", }, - { "src", "luaotfload-log.lua", }, - { "src", "luaotfload-main.lua", }, - { "src/fontloader/runtime", "fontloader-reference.lua", }, - --{ "src", "luaotfload-override.lua", }, --> part of init now - { "src", "luaotfload-parsers.lua", }, - { "src", "luaotfload-tool.lua", }, - { "scripts", "mkcharacters", }, - { "scripts", "mkglyphlist", }, - { "scripts", "mkstatus", }, -} + + --- Luaotfload runtime files + { srcdir, "luaotfload-auxiliary.lua", }, + { srcdir, "luaotfload-colors.lua", }, + { srcdir, "luaotfload-configuration.lua", }, + { srcdir, "luaotfload-database.lua", }, + { srcdir, "luaotfload-diagnostics.lua", }, + { srcdir, "luaotfload-features.lua", }, + { srcdir, "luaotfload-init.lua", }, + { srcdir, "luaotfload-letterspace.lua", }, + { srcdir, "luaotfload-loaders.lua", }, + { srcdir, "luaotfload-log.lua", }, + { srcdir, "luaotfload-main.lua", }, + { srcdir, "luaotfload-parsers.lua", }, + { srcdir, "luaotfload-resolvers.lua", }, + { srcdir, "luaotfload-tool.lua", }, + + --- generated files + { builddir, "luaotfload-characters.lua", }, + { builddir, "luaotfload-glyphlist.lua", }, + + --- scripts + { scriptdir, "mkcharacters", }, + { scriptdir, "mkglyphlist", }, + { scriptdir, "mkimport", }, + { scriptdir, "mkstatus", }, + { scriptdir, "mktests", }, + + --- merge script + { loaderdir, "luaotfload-package.lua", }, + + --- fontloader runtimes + { rtdir, "fontloader-basics-gen.lua", }, + { rtdir, "fontloader-reference.lua", }, + { rtdir, "fontloader-tl2014.lua", }, + + --- fontloader constituents + { miscdir, "fontloader-basics-nod.lua", }, + { miscdir, "fontloader-data-con.lua", }, + { miscdir, "fontloader-font-afk.lua", }, + { miscdir, "fontloader-font-afm.lua", }, + { miscdir, "fontloader-font-cid.lua", }, + { miscdir, "fontloader-font-con.lua", }, + { miscdir, "fontloader-font-def.lua", }, + { miscdir, "fontloader-font-ini.lua", }, + { miscdir, "fontloader-font-map.lua", }, + { miscdir, "fontloader-font-otb.lua", }, + { miscdir, "fontloader-font-otf.lua", }, + { miscdir, "fontloader-font-oti.lua", }, + { miscdir, "fontloader-font-otp.lua", }, + { miscdir, "fontloader-fonts-cbk.lua", }, + { miscdir, "fontloader-fonts-def.lua", }, + { miscdir, "fontloader-fonts-demo-vf-1.lua", }, + { miscdir, "fontloader-fonts-enc.lua", }, + { miscdir, "fontloader-fonts-ext.lua", }, + { miscdir, "fontloader-fonts-inj.lua", }, + { miscdir, "fontloader-fonts.lua", }, + { miscdir, "fontloader-fonts-lua.lua", }, + { miscdir, "fontloader-fonts-ota.lua", }, + { miscdir, "fontloader-fonts-otn.lua", }, + { miscdir, "fontloader-fonts-syn.lua", }, + { miscdir, "fontloader-fonts-tfm.lua", }, + { miscdir, "fontloader-font-tfm.lua", }, + { miscdir, "fontloader-languages.lua", }, + { miscdir, "fontloader-l-boolean.lua", }, + { miscdir, "fontloader-l-file.lua", }, + { miscdir, "fontloader-l-function.lua", }, + { miscdir, "fontloader-l-io.lua", }, + { miscdir, "fontloader-l-lpeg.lua", }, + { miscdir, "fontloader-l-lua.lua", }, + { miscdir, "fontloader-l-math.lua", }, + { miscdir, "fontloader-l-string.lua", }, + { miscdir, "fontloader-l-table.lua", }, + { miscdir, "fontloader-math.lua", }, + { miscdir, "fontloader-mplib.lua", }, + { miscdir, "fontloader-preprocessor.lua", }, + { miscdir, "fontloader-swiglib.lua", }, + { miscdir, "fontloader-swiglib-test.lua", }, + { miscdir, "fontloader-util-str.lua", }, + +} --[[local names]] ----------------------------------------------------------------------- -- helpers 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", diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua index ca5a067..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" } @@ -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 diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index 57311dc..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), <phg42.2a@gmail.com> +-- AUTHOR: Philipp Gesang, <phg@phi-gamma.net> -- AUTHOR: Dohyun Kim <nomosnomos@gmail.com> ------------------------------------------------------------------------------- -- @@ -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, 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-diagnostics.lua b/src/luaotfload-diagnostics.lua index 582105a..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), <phg42.2a@gmail.com> +-- AUTHOR: Philipp Gesang <phg@phi-gamma.net> ----------------------------------------------------------------------- -- local names = fonts.names @@ -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 diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua index 0f7464a..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), <phg@phi-gamma.net> ----------------------------------------------------------------------- -- @@ -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.") diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index 715aa8a..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), <phg@phi-gamma.net>, Hans Hagen, Khaled Hosny, Elie Roux +-- REQUIREMENTS: luatex v.0.80 or later; package lualibs +-- AUTHOR: Philipp Gesang <phg@phi-gamma.net> +-- AUTHOR: Hans Hagen, Khaled Hosny, Elie Roux, David Carlisle ----------------------------------------------------------------------- -- --- Contains parts of the earlier main script. @@ -110,13 +111,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 +135,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"], diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index 17d06d4..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 ----------------------------------------------------------------------- -- @@ -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-- @@ -99,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”).", 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) 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 <khaledhosny@eglug.org> %% and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> %% and Dohyun Kim <nomosnomos@gmail.com> +%% and David Carlisle <d.p.carlisle@gmail.com> %% %% This file is part of Luaotfload. %% |