From e49fa11fe2a2957f63d092a073109c68223037a9 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 7 May 2013 11:12:05 +0200 Subject: replace glyph list loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Karl Berry made us aware that our generated version of ``font-age.lua`` differs from the Context/Luatex-Fonts one and should be renamed. It’s trivial to do so but invasive still. This workaround may have to be adapted if Hans chooses to rewrite the Glyph List loader. --- Makefile | 2 +- filegraph.dot | 2 +- luaotfload-override.lua | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- luaotfload-tool.rst | 2 +- luaotfload.dtx | 8 ++++---- mkglyphlist | 4 ++-- 6 files changed, 58 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ded3418..9ff7e48 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ DOTPDF = $(GRAPH).pdf DOT = $(GRAPH).dot # Files grouped by generation mode -GLYPHS = font-age.lua +GLYPHS = luaotfload-glyphlist.lua GRAPHED = $(DOTPDF) MAN = $(MANPAGE) COMPILED = $(DOC) diff --git a/filegraph.dot b/filegraph.dot index 36e5764..8db137c 100644 --- a/filegraph.dot +++ b/filegraph.dot @@ -113,7 +113,7 @@ strict digraph luaotfload_files { //looks weird with circo ... fillcolor = "#01012222", color = grey40, style = "filled,dotted,rounded", - label = "font-age.lua"] + label = "luaotfload-glyphlist.lua"] font_names [style = "filled,dashed", shape = rect, diff --git a/luaotfload-override.lua b/luaotfload-override.lua index 863187f..c047dad 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -63,7 +63,7 @@ end local level_ids = { common = 0, loading = 1, search = 2 } -logs.names_report = function (mode, lvl, ...) +local names_report = function (mode, lvl, ...) if type(lvl) == "string" then lvl = level_ids[lvl] end @@ -81,4 +81,52 @@ logs.names_report = function (mode, lvl, ...) end end +logs.names_report = names_report + +--[[doc-- + + Adobe Glyph List. + ------------------------------------------------------------------- + + Context provides a somewhat different font-age.lua from an unclear + origin. Unfortunately, the file name it reads from is hard-coded + in font-enc.lua, so we have to replace the entire table. + + This shouldn’t cause any complications. Due to its implementation + the glyph list will be loaded upon loading a OTF or TTF for the + first time during a TeX run. (If one sticks to TFM/OFM then it is + never read at all.) For this reason we can install a metatable that + looks up the file of our choosing and only falls back to the + Context one in case it cannot be found. + +--doc]]-- + +if next(fonts.encodings.agl) then + print(next, fonts.encodings.agl) + --- unnecessary because the file shouldn’t be loaded at this time + --- but we’re just making sure + fonts.encodings.agl = nil + collectgarbage"collect" +end + + +fonts.encodings.agl = { } + +setmetatable(fonts.encodings.agl, { __index = function (t, k) + if k == "unicodes" then + local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua" + if glyphlist then + names_report("both", 0, "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") + end + local unicodes = dofile(glyphlist) + fonts.encodings.agl = { unicodes = unicodes } + return unicodes + else + return nil + end +end }) + -- vim:tw=71:sw=4:ts=4:expandtab diff --git a/luaotfload-tool.rst b/luaotfload-tool.rst index 13842e2..cd42606 100644 --- a/luaotfload-tool.rst +++ b/luaotfload-tool.rst @@ -17,7 +17,7 @@ SYNOPSIS **luaotfload** [ -cfFiquvVh ] -**luaotfload** --update [ --force ] [ --find ] [ --quiet ] [ --verbose ] +**luaotfload** --update [ --force ] [ --quiet ] [ --verbose ] **luaotfload** --find=filename [ --fuzzy ] [ --info ] diff --git a/luaotfload.dtx b/luaotfload.dtx index 2f88225..6c88e37 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1105,14 +1105,14 @@ and the derived files % % Also, the merged file at some point % loads the Adobe Glyph List from a \LUA table that is contained in -% \fileent{font-age.lua}, which is automatically generated by the +% \fileent{luaotfload-glyphlist.lua}, which is automatically generated by the % % script \fileent{mkglyphlist}.\footnote{% % See \fileent{luaotfload-font-enc.lua}. -% The hard-coded file name is why the file lacks the \fileent{luaotfload-} -% prefix. +% The hard-coded file name is why we have to replace the procedure +% that loads the file in \fileent{luaotfload-override.lua}. % } % There is a make target \identifier{glyphs} that will create a fresh -% \fileent{font-age.lua} so we don’t need to import it from \CONTEXT +% glyph list so we don’t need to import it from \CONTEXT % any longer. % % In addition to these, \identifier{luaotfload} requires a number of diff --git a/mkglyphlist b/mkglyphlist index 281c736..3366c9c 100755 --- a/mkglyphlist +++ b/mkglyphlist @@ -17,7 +17,7 @@ -- config ----------------------------------------------------------------------- local glyphfile = "./glyphlist.txt" -local font_age = "./font-age.lua" +local font_age = "./luaotfload-glyphlist.lua" local glyph_source = "http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt" ----------------------------------------------------------------------- @@ -93,7 +93,7 @@ end --[[doc-- Everything below has been autogenerated. Run mkglyphlist to rebuild -font-age.lua. +luaotfload-glyphlist.lua. --doc]]-- ]==] -- cgit v1.2.3