diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-01-13 07:06:04 -0800 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-01-13 07:06:04 -0800 |
commit | 05be8708a9ee3ff36632e90a9c9820cbef3272ca (patch) | |
tree | 81bf1c9937152a1f15b735e3f0cfbfeeb1a4684f | |
parent | 2535650cb1371c07a335dce92699aad5c9f3a9a9 (diff) | |
parent | ef4abccff44fa27fbdf5bb658164d77903f914ef (diff) | |
download | luaotfload-05be8708a9ee3ff36632e90a9c9820cbef3272ca.tar.gz |
Merge pull request #178 from phi-gamma/texlive2014
[tool] adapt --info option for version 0.78
-rwxr-xr-x | luaotfload-tool.lua | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index ba3fcb5..1f57b44 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -349,15 +349,36 @@ local print_heading = function (title, level) texiowrite_nl (s .. stringrep(adornchar, textwidth-utf.len(s))) end +local baseindent = " " + +--[[doc-- + + show_info_items -- Together with show_info_table prints the table returned by + fontloader.info(), recursing into nested tables if appropriate (as necessitated + by Luatex versions 0.78+ which include the pfminfo table in the result. + +--doc]]-- + +local show_info_table show_info_table = function (t, depth) + depth = depth or 0 + local indent = stringrep (baseindent, depth) + local keys = table.sortedkeys (t) + for n = 1, #keys do + local key = keys [n] + local val = t [key] + if type (val) == "table" then + texiowrite_nl (indent .. stringformat (info_fmt, key, "<table>")) + show_info_table (val, depth + 1) + else + texiowrite_nl (indent .. stringformat (info_fmt, key, val)) + end + end +end + local show_info_items = function (fontinfo) - local items = table.sortedkeys(fontinfo) - print_heading(fontinfo.fullname, 1) + print_heading (fontinfo.fullname, 1) texiowrite_nl "" - for n = 1, #items do - local item = items[n] - texiowrite_nl(stringformat( - info_fmt, item, fontinfo[item])) - end + show_info_table (fontinfo) texiowrite_nl "" end |