From e8fe5e1e830658776413eb5e8af450ff4ae93ec7 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Fri, 19 Apr 2013 18:17:28 +0200 Subject: A more simple loadmodule function Simply using the luatexbase way... May change in the future, but stick with it for now. --- luaotfload.dtx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'luaotfload.dtx') diff --git a/luaotfload.dtx b/luaotfload.dtx index 818dbd9..8ffb8f9 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -905,14 +905,7 @@ end local fl_prefix = "otfl" -- “luatex” for luatex-plain local loadmodule = function (name) - local tofind = fl_prefix .."-"..name - local found = find_file(tofind,"tex") - if found then - log("loading file %s.", found) - dofile(found) - else - error("file %s not found.", tofind) - end + require(fl_prefix .."-"..name) end % \end{macrocode} -- cgit v1.2.3 From 4a13ae53c8441c1fba6d059f44f364cc7cdaa673 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Fri, 19 Apr 2013 18:29:23 +0200 Subject: Documenting and simplifying ofm font bug handling --- luaotfload.dtx | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'luaotfload.dtx') diff --git a/luaotfload.dtx b/luaotfload.dtx index 8ffb8f9..03b63c1 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -910,10 +910,12 @@ end % \end{macrocode} % -% Virtual fonts are resolved via a callback. -% \luafunction{find_vf_file} derives the name of the virtual font file -% from the filename. -% (NB: \CONTEXT handles this likewise in \fileent{font-vf.lua}.) +% Before \TeX Live 2013 version, \LUATEX had a bug that made ofm fonts fail +% when called with their extension. There was a side-effect making ofm +% totally unloadable when luaotfload was present. The following lines are +% a patch for this bug. The utility of these lines is questionable as they +% are not necessary since \TeX Live 2013. They should be removed in the next +% version. % % \begin{macrocode} local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match @@ -1120,22 +1122,19 @@ loadmodule"font-otc.lua" -- TODO check what we can drop from otfl-features loadmodule"lib-dir.lua" -- required by font-nms loadmodule"luat-ovr.lua" -if fonts and fonts.readers.tfm then - -------------------------------------------------------------------- - --- OFM; read this first - -------------------------------------------------------------------- - --- I can’t quite make out whether this is still relevant - --- as those ofm fonts always fail, even in the 2011 version - --- (mktexpk: don't know how to create bitmap font for omarabb.ofm) - --- the font loader appears to read ofm like tfm so if this - --- hack was supposed achieve that, we should excise it anyways - fonts.readers.ofm = fonts.readers.tfm - fonts.handlers.ofm = fonts.handlers.tfm --- empty anyways - fonts.formats.ofm = fonts.formats.tfm --- “type1” - --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm" - -------------------------------------------------------------------- -end - +% \end{macrocode} +% +% +% \CONTEXT does not support ofm, these lines were added in order to make it +% work. However they do not seem necessary so they are commented for now. +% +% \begin{macrocode} +-- if fonts and fonts.readers.tfm then +-- fonts.readers.ofm = fonts.readers.tfm +-- fonts.handlers.ofm = fonts.handlers.tfm --- empty anyways +-- fonts.formats.ofm = fonts.formats.tfm --- “type1” +-- --- fonts.readers.sequence[#fonts.readers.sequence+1] = "ofm" +--end % \end{macrocode} % % -- cgit v1.2.3 From 80e5042a10620dbb2c456cf5d3a472c66fe6a90f Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Fri, 19 Apr 2013 19:04:49 +0200 Subject: Verbosity reduction step 2 This implies a modification in otfl-fonts-merged.lua that should be asked to Hans... --- luaotfload.dtx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'luaotfload.dtx') diff --git a/luaotfload.dtx b/luaotfload.dtx index 03b63c1..e36bb36 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1045,6 +1045,23 @@ _G.non_generic_context = { luatex_fonts = { local trapped_register = callback.register callback.register = dummy_function +% \end{macrocode} +% +% In order to have an output with normal verbosity, we need to pre-override +% some \CONTEXT log function: +% +% \begin{macrocode} + +local dummylogfunction=function() end +local dummylogreporter=function(c) return function(...) log(string.formatters(...)) end end + +_G.logs={ + new=dummylogreporter, + reporter=dummylogreporter, + messenger=dummylogreporter, + report=dummylogfunction, +} + % \end{macrocode} % % Now that things are sorted out we can finally load the fontloader. -- cgit v1.2.3 From 89aaa92df44af21be14c32fa7425b1cfa0674820 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Fri, 19 Apr 2013 20:59:22 +0200 Subject: Stop using module() in luaotfload.lua These _G are a bit ugly... --- luaotfload.dtx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'luaotfload.dtx') diff --git a/luaotfload.dtx b/luaotfload.dtx index e36bb36..22afb45 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -822,7 +822,7 @@ and the derived files %<*lua> % \fi % \begin{macrocode} -module("luaotfload", package.seeall) +luaotfload = luaotfload or {} luaotfload.module = { name = "luaotfload", @@ -1019,15 +1019,9 @@ end % \identifier{luatexbase}-style callback handling here. % % \begin{macrocode} -if not _G. generic_context then _G. generic_context = { } end -if not _G.non_generic_context then _G.non_generic_context = { } end +generic_context = {no_callbacks_yet = true} -local generic_context = generic_context -local non_generic_context =non_generic_context - -generic_context.no_callbacks_yet = true - -_G.non_generic_context = { luatex_fonts = { +non_generic_context = { luatex_fonts = { load_before = "otfl-fonts-merged.lua", -- load_after = nil, --- TODO, this is meant for callbacks skip_loading = true, @@ -1055,7 +1049,7 @@ callback.register = dummy_function local dummylogfunction=function() end local dummylogreporter=function(c) return function(...) log(string.formatters(...)) end end -_G.logs={ +logs={ new=dummylogreporter, reporter=dummylogreporter, messenger=dummylogreporter, @@ -1091,9 +1085,9 @@ do local new_attribute = luatexbase.new_attribute local the_attributes = luatexbase.attributes - _G.attributes = _G.attributes or { } + attributes = attributes or { } - _G.attributes.private = function (name) + attributes.private = function (name) local attr = "otfl@" .. name local number = the_attributes[attr] if not number then -- cgit v1.2.3 From 267997e49570d3d08b4de3eb6c9c5394ec1d2f97 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Sat, 20 Apr 2013 14:28:25 +0200 Subject: Making the file method resolve fonts with the database --- luaotfload.dtx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'luaotfload.dtx') diff --git a/luaotfload.dtx b/luaotfload.dtx index 22afb45..595a9fa 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1157,6 +1157,20 @@ loadmodule"font-nms.lua" loadmodule"font-clr.lua" loadmodule"font-ltx.lua" --- new in 2.0, added 2011 +% \end{macrocode} +% +% +% This hack makes fonts called with file method found by fonts.names.resove +% instead of just trying to find them with kpse. It is necessary in case +% of fonts that are not accessible by kpse but present in the database, a +% quite common case under Linux. +% +% \begin{macrocode} + +fonts.definers.resolvers.file = function (specification) + specification.name = fonts.names.resolve('', '', specification) +end + % \end{macrocode} % % -- cgit v1.2.3