summaryrefslogtreecommitdiff
path: root/luaotfload-tool.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-06-25 16:13:40 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-06-25 16:13:40 +0200
commit23d194d78d1afbe9dcc000e2d108563ba2a8bf76 (patch)
tree22c4cc7372f156cefb7a005ea3724bd0fe7a27f0 /luaotfload-tool.lua
parentde200c1846690e75a33aeaef920d74af34e4b001 (diff)
downloadluaotfload-23d194d78d1afbe9dcc000e2d108563ba2a8bf76.tar.gz
add ascii heading formatter to luaotfload-tool
Diffstat (limited to 'luaotfload-tool.lua')
-rwxr-xr-xluaotfload-tool.lua39
1 files changed, 31 insertions, 8 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 7301db2..dd8484d 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -241,11 +241,22 @@ local version_msg = function ( )
config.luaotfload.self, version, names.version))
end
+
+--- makeshift formatting
+
+local head_adornchars = {
+ [1] = "*", [2] = "=", [3] = "~", [4] = "-", [5] = "ยท",
+}
local tw = 80
-local print_font_name = function (name)
- local s = "-- " .. name .. " "
- s = s .. string.rep("-", tw-string.len(s))
- texiowrite_nl (s)
+
+local print_heading = function (title, level)
+ if not level or level > #head_adornchars then
+ level = #head_adornchars
+ end
+ local adornchar = head_adornchars[level]
+
+ local s = adornchar .. adornchar .. " " .. title .. " "
+ texiowrite_nl (s .. string.rep(adornchar, tw-utf.len(s)))
texiowrite_nl ""
end
@@ -254,7 +265,7 @@ local warn_fmt = [[(%d %s)]]
local show_info_items = function (fontinfo)
local items = table.sortedkeys(fontinfo)
- print_font_name(fontinfo.fullname)
+ print_heading(fontinfo.fullname, 1)
for n = 1, #items do
local item = items[n]
texiowrite_nl(stringformat(
@@ -270,9 +281,10 @@ local p_lines = Ct(p_line * (p_eol^1 * p_line^-1)^0)
local show_fontloader_warnings = function (ws)
local nws = #ws
- texiowrite_nl(stringformat(
- [[* the fontloader emitted %d warnings *]],
- nws, name))
+ print_heading(stringformat(
+ [[the fontloader emitted %d warnings]],
+ nws), 2)
+ texiowrite_nl ""
for i=1, nws do
local w = ws[i]
texiowrite_nl (stringformat("%d:", i))
@@ -285,6 +297,13 @@ local show_fontloader_warnings = function (ws)
end
end
+local display_names = function (names)
+ print_heading("Font Metadata", 2)
+ for i=1, #names do
+ local namedata = names[i]
+ end
+end
+
local show_full_info = function (path, subfont, warnings)
local rawinfo, warn = fontloader.open(path, subfont)
if warnings then
@@ -294,8 +313,12 @@ local show_full_info = function (path, subfont, warnings)
texiowrite_nl(stringformat([[cannot open font %s]], path))
return
end
+ local fontdata = { }
local fullinfo = fontloader.to_table(rawinfo)
+ local fields = fontloader.fields(rawinfo.glyphs[0])
fontloader.close(rawinfo)
+ --inspect(fields)
+ display_names(fullinfo.names)
end
--- Subfonts returned by fontloader.info() do not correspond