From 608b4d7816a854663c7c2bb1696127c81ce5de09 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 21 Apr 2013 23:47:27 +0200 Subject: reduce verbosity of the font loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this is my version of: https://github.com/phi-gamma/luaotfload/commit/3a59b8b6b226ed22ccd16aec2dc2e272f015cc74 I undid the original because our policy is not to change imported files except for applying hot fixes in advance that Hans will add eventually. However, we’ll see if we really need otfl-fonts.lua anyways as its functionality might fit better in to luaotfload.lua. --- luaotfload.lua | 41 +++++++++++++++++++++++++++++++++++++++++ tests/marks.tex | 7 ++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/luaotfload.lua b/luaotfload.lua index c85041b..f11218e 100644 --- a/luaotfload.lua +++ b/luaotfload.lua @@ -16,6 +16,7 @@ local type, next = type, next local stringfind = string.find local stringsub = string.sub local stringmatch = string.match +local stringformat = string.format local find_file = kpse.find_file local add_to_callback, create_callback = @@ -169,6 +170,41 @@ _G.non_generic_context = { luatex_fonts = { skip_loading = true, }} +--[[doc-- +In its raw form, the font loader will write to the terminal quite +liberally, not using the proper channels (loggers) even of \CONTEXT. +To make it behave we temporarily replace two functions from the +\luafunction{texio} library with wrappers that redirect output to the +log. +Just in case Hans decides to call \luafunction{texio.write*} with the +optional target parameter (which he doesn’t at the moment), we catch the +first argument and skip it where appropriate. +The originals are backed up and restored after loading +\fileent{otfl-fonts.lua}. + +Should we decide to do our own packaging (we’re capable of that +anyways), this will most likely become unnecessary. +--doc]]-- + +local normal_write, normal_write_nl = texio.write, texio.write_nl + +local log_template = "luaotfload: %s" +local fake_write = function (first, rest) + if first == "log" or first == "term" then -- ignore + normal_write("log", stringformat(log_template, rest)) + else + normal_write("log", stringformat(log_template, first)) + end +end +local fake_write_nl = function (first, rest) + if first == "log" or first == "term" then -- ignore + normal_write_nl("log", stringformat(log_template, rest)) + else + normal_write_nl("log", stringformat(log_template, first, rest)) + end +end +texio.write, texio.write_nl = fake_write, fake_write_nl + --[[doc-- The imported font loader will call \luafunction{callback.register} once while reading \fileent{font-def.lua}. @@ -185,6 +221,11 @@ Now that things are sorted out we can finally load the fontloader. loadmodule"fonts.lua" +--[[doc-- +Here we restore the original \luafunction{texio} functions. +--doc]]-- +texio.write, texio.write_nl = normal_write, normal_write_nl + --[[doc-- By default, the fontloader requires a number of \emphasis{private attributes} for internal use. diff --git a/tests/marks.tex b/tests/marks.tex index 3af264e..9dcf460 100644 --- a/tests/marks.tex +++ b/tests/marks.tex @@ -1,9 +1,10 @@ \input luaotfload.sty \font\test={file:GenBasR.ttf:script=latn} +%font\test={name:AntykwaTorunska:script=latn} \test ä\quad Ä -\test a\char"0308 -\quad A\char"0308 -\quad j\char"0323 +\test a\char"0308 %% -> combining dihaeresis +\quad A\char"0308 %% -> combining dihaeresis +\quad j\char"0323 %% -> combining dot below \bye -- cgit v1.2.3