summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-08-10 14:46:46 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-08-10 14:46:46 +0200
commit5a04743e26573976feb4d176bc71f361423f96d2 (patch)
tree103a0f84d4e55473dd0307c7d7b65b8d2d55a775 /src
parent3d54b809e92a5518111d8a157582344e740ea9d0 (diff)
parentfb374b76a6f7f66b300652ba12f40f0f28a1a9b5 (diff)
downloadluaotfload-5a04743e26573976feb4d176bc71f361423f96d2.tar.gz
Merge pull request #250 from phi-gamma/master
[conf, main] add support for and preliminary implementation of verbose f...
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-configuration.lua9
-rw-r--r--src/luaotfload-main.lua41
2 files changed, 40 insertions, 10 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index ec38d90..a375c37 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -432,7 +432,14 @@ local option_spec = {
definer = {
in_t = string_t,
out_t = string_t,
- transform = function (d) return d == "generic" and d or "patch" end,
+ transform = function (d)
+ if d == "generic" or d == "patch"
+ or d == "info_generic" or d == "info_patch"
+ then
+ return d
+ end
+ return "patch"
+ end,
},
log_level = {
in_t = number_t,
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index 773a3cf..26d1515 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -4,7 +4,7 @@
-- REQUIREMENTS: luatex v.0.79 or later; packages lualibs, luatexbase
-- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang
-- VERSION: same as Luaotfload
--- MODIFIED: 2014-07-24 22:08:34+0200
+-- MODIFIED: 2014-08-08 23:14:37+0200
-----------------------------------------------------------------------
--
--- Note:
@@ -672,13 +672,13 @@ create_callback("luaotfload.patch_font", "simple", dummy_function)
--doc]]--
-local read_font_file = fonts.definers.read
-local definers = {
- generic = read_font_file,
- --- spec -> size -> id -> tmfdata
- patch = function (specification, size, id)
- local tfmdata = read_font_file (specification, size, id)
+local definers = { } --- (string, spec -> size -> id -> tmfdata) hash_t
+do
+ local read = fonts.definers.read
+
+ local patch = function (specification, size, id)
+ local tfmdata = read (specification, size, id)
if type (tfmdata) == "table" and tfmdata.shared then
--- We need to test for the “shared” field here
--- or else the fontspec capheight callback will
@@ -686,8 +686,31 @@ local definers = {
call_callback ("luaotfload.patch_font", tfmdata, specification)
end
return tfmdata
- end,
-}
+ end
+
+ local mk_info = function (name)
+ local definer = name == "patch" and patch or read
+ return function (specification, size, id)
+ logreport ("both", 0, "main",
+ "active font definer: %q", name)
+ logreport ("both", 0, "main", " > defining font no. %d", id)
+ logreport ("both", 0, "main", " > spec %q", specification)
+ logreport ("both", 0, "main", " > at size %.2f pt", size / 2^16)
+ local tfmdata = definer (specification, size, id)
+ if not tfmdata then
+ logreport ("both", 0, "main", "font definition failed")
+ return
+ end
+ logreport ("both", 0, "main", "font definition successful")
+ return tfmdata
+ end
+ end
+
+ definers.patch = patch
+ definers.generic = read
+ definers.info_patch = mk_info "patch"
+ definers.info_generic = mk_info "generic"
+end
reset_callback "define_font"