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 From 52136f671bf0f3bd35804b19fa979a85528e9a95 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 7 May 2013 11:19:21 +0200 Subject: fix redundancy in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ff7e48..17eae41 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ NAME = luaotfload DOC = $(NAME).pdf DTX = $(NAME).dtx -OTFL = $(wildcard luaotfload-*.lua) luaotfload-blacklist.cnf $(GLYPHS) +OTFL = $(wildcard luaotfload-*.lua) luaotfload-blacklist.cnf GLYPHSCRIPT = mkglyphlist GLYPHSOURCE = glyphlist.txt -- cgit v1.2.3 From 9c8b4e0d6b2ca6557b490513a4d90182df12d16d Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 8 May 2013 12:37:19 +0200 Subject: adjust font sizing with nonstandard em sizes --- luaotfload-auxiliary.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 5de964d..2d459d0 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -64,7 +64,7 @@ local add_fontdata_fallbacks = function (fontdata) metadata = fontdata.shared.rawdata.metadata fontdata.units = fontparameters.units local resources = fontdata.resources - fontdata.size = fontparameters.size + fontdata.size = fontparameters.size * fontdata.units / 1000 --- for legacy fontspec.lua and unicode-math.lua fontdata.shared.otfdata = metadata fontdata.shared.otfdata.metadata = metadata --- brr, that’s meta indeed -- cgit v1.2.3