diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | luaotfload-features.lua | 53 | ||||
-rw-r--r-- | luaotfload-override.lua | 33 | ||||
-rw-r--r-- | luaotfload.dtx | 40 |
4 files changed, 80 insertions, 48 deletions
@@ -62,7 +62,7 @@ DO_TEX = luatex --interaction=batchmode $< >/dev/null DO_LATEX = latexmk -pdf -e '$$pdflatex = q(lualatex %O %S)' -silent $< >/dev/null DO_GRAPHVIZ = dot -Tpdf -o $@ $< > /dev/null DO_GLYPHLIST = texlua ./mkglyphlist > /dev/null -DO_DOCUTILS = rst2man2 $< >$@ 2>/dev/null +DO_DOCUTILS = rst2man $< >$@ 2>/dev/null all: $(GENERATED) graph: $(GRAPHED) diff --git a/luaotfload-features.lua b/luaotfload-features.lua index e732ed9..1c85dd7 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -873,8 +873,14 @@ local toboolean = function (s) return stringlower(s) end ---- dirty test if a file: request is actually a path: lookup; don’t ---- ask! +--[[doc-- + + Dirty test if a file: request is actually a path: lookup; don’t + ask! Note this fails on Windows-style absolute paths. These will + *really* have to use the correct request. + +--doc]]-- + local check_garbage = function (_,i, garbage) if stringfind(garbage, "/") then report("log", 0, "load", --- ffs use path! @@ -1053,7 +1059,7 @@ local handle_request = function (specification) specification.specification) report("log", 0, "load", "use square bracket syntax or consult the documentation.") specification.name = specification.specification - specification.lookup = "file" + specification.lookup = "path" return specification end local lookup, name = select_lookup(request) @@ -1388,9 +1394,13 @@ local anum_specification = { }, } ---- below the specifications as given in the removed font-otc.lua ---- the rest was identical to what this file had from the beginning ---- both make the “anum.tex” test pass anyways +--[[doc-- + + Below the specifications as given in the removed font-otc.lua. + The rest was identical to what this file had from the beginning. + Both make the “anum.tex” test pass anyways. + +--doc]]-- otf.addfeature("anum",anum_specification) @@ -1399,35 +1409,4 @@ registerotffeature { description = 'arabic digits', } -if characters.combined then - - local tcom = { } - - local function initialize() - characters.initialize() - for first, seconds in next, characters.combined do - for second, combination in next, seconds do - tcom[combination] = { first, second } - end - end - -- return false - end - - local tcom_specification = { - type = "ligature", - features = everywhere, - data = tcom, - flags = noflags, - initialize = initialize, - } - - otf.addfeature("tcom",tcom_specification) - - registerotffeature { - name = 'tcom', - description = 'tex combinations', - } - -end - -- vim:tw=71:sw=4:ts=4:expandtab diff --git a/luaotfload-override.lua b/luaotfload-override.lua index 6c44f35..5e642e4 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['luat-ovr'] = { license = "GNU GPL v2" } -local module_name = "luaotfload" +local module_name = "luaotfload" local texiowrite_nl = texio.write_nl local stringformat = string.format @@ -75,6 +75,32 @@ end --- at default (zero), we aim to be quiet local level_ids = { common = 1, loading = 2, search = 3 } +--[[doc-- + + The names_report logger is used more or less all over luaotfload. + Its requirements are twofold: + + 1) Provide two logging channels, the terminal and the log file; + 2) Allow for control over verbosity levels. + + The first part is addressed by specifying the log *mode* as the + first argument that can be either “log”, meaning the log file, or + “both”: log file and stdout. Anything else is taken as referring to + stdout only. + + Verbosity levels, though not as fine-grained as e.g. Context’s + system of tracers, allow keeping the logging spam caused by + different subsystems manageable. By default, luaotfload will not + emit anything if things are running smoothly on level zero. Only + warning messages are relayed, while the other messages are skipped + over. (This is a little sub-optimal performance-wise since the + function calls to the logger are executed regardless.) The log + level during a Luatex run can be adjusted by setting the “loglevel” + field in config.luaotfload, or by calling logs.set_loglevel() as + defined above. + +--doc]]-- + local names_report = function (mode, lvl, ...) if type(lvl) == "string" then lvl = level_ids[lvl] @@ -147,10 +173,11 @@ if fonts then --- need to be running TeX if k == "unicodes" then local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua" if glyphlist then - names_report("both", 0, "load", "loading the Adobe glyph list") + names_report("log", 1, "load", "loading the Adobe glyph list") else glyphlist = resolvers.findfile"font-age.lua" - names_report("both", 0, "load", "loading the extended glyph list from ConTeXt") + names_report("both", 0, "load", + "loading the extended glyph list from ConTeXt") end local unicodes = dofile(glyphlist) fonts.encodings.agl = { unicodes = unicodes } diff --git a/luaotfload.dtx b/luaotfload.dtx index e576112..16f7bf6 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1832,13 +1832,13 @@ local resolvefile = fonts.names.crude_file_lookup --local resolvefile = fonts.names.crude_file_lookup_verbose function request_resolvers.file(specification) - local name=resolvefile(specification.name) - local suffix=file.suffix(name) + local name = resolvefile(specification.name) + local suffix = file.suffix(name) if formats[suffix] then - specification.forced=suffix - specification.name=file.removesuffix(name) + specification.forced = suffix + specification.name = file.removesuffix(name) else - specification.name=name + specification.name = name end end @@ -1869,6 +1869,7 @@ end % For this reason, we introduce an extra check with an early return. % % \begin{macrocode} + local type1_formats = { "tfm", "ofm", } request_resolvers.anon = function (specification) @@ -1880,6 +1881,20 @@ request_resolvers.anon = function (specification) return end end + --- under some weird circumstances absolute paths get + --- passed to the definer; we have to catch them + --- before the name: resolver misinterprets them. + name = specification.specification + local exists, _ = lfsisfile(name) + if exists then --- garbage; we do this because we are nice, + --- not because it is correct + logs.names_report("log", 1, "load", "file “%s” exists", name) + logs.names_report("log", 1, "load", + "... overriding borked anon: lookup with path: lookup") + specification.name = name + request_resolvers.path(specification) + return + end request_resolvers.name(specification) end @@ -1892,9 +1907,21 @@ end % % \begin{macrocode} request_resolvers.path = function (specification) - local exists, _ = lfsisfile(specification.name) + local name = specification.name + local exists, _ = lfsisfile(name) if not exists then -- resort to file: lookup + logs.names_report("log", 1, "load", + "path lookup of “%s” unsuccessful, falling back to file:", + name) request_resolvers.file(specification) + else + local suffix = file.suffix(name) + if formats[suffix] then + specification.forced = suffix + specification.name = file.removesuffix(name) + else + specification.name = name + end end end @@ -1956,7 +1983,6 @@ loadmodule"auxiliary.lua" --- additionaly high-level functionality (new) -- vim:tw=71:sw=4:ts=4:expandtab - % \end{macrocode} % % \iffalse |