From 4a780f891cd39b7c450bbe53f89e57c0b3dc2884 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 8 Dec 2013 15:12:09 +0100 Subject: [tool] adapt --inspect option --- luaotfload-tool.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index a945ee2..ec6ee57 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -685,7 +685,7 @@ The font info knows two levels of detail: --doc]]-- local show_font_info = function (basename, askedname, detail, warnings) - local filenames = names.data().filenames + local filenames = names.data().files local index = filenames.base[basename] local fullname = filenames.full[index] askedname = sanitize_fontname (askedname) -- cgit v1.2.3 From 13871bb788c515e70a702162a3f9833c1e60317f Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 13 Dec 2013 11:25:31 +0100 Subject: [db] do not truncate paths that fit the term width --- luaotfload-database.lua | 19 ++++++++++++------- mktests | 6 ++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index d258a19..b47fc8b 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -81,9 +81,9 @@ local stringsub = string.sub local stringupper = string.upper local tableconcat = table.concat local tablesort = table.sort -local texiowrite_nl = texio.write_nl local utf8gsub = unicode.utf8.gsub local utf8lower = unicode.utf8.lower +local utf8length = unicode.utf8.length local zlibcompress = zlib.compress --- these come from Lualibs/Context @@ -2115,10 +2115,15 @@ end --- into a given terminal width. The parameter “restrict” (int) --- indicates the number of characters already consumed on the --- line. -local ellipsis = ".." local truncate_string = function (str, restrict) - local wd = luaotfloadconfig.termwidth - restrict - 2 - return ellipsis .. stringsub(str, #str - wd) + local tw = luaotfloadconfig.termwidth + local wd = tw - restrict + local len = utf8length (str) + if wd - len < 0 then + --- combined length exceeds terminal, + str = ".." .. stringsub(str, len - wd + 2) + end + return str end --[[doc-- @@ -2170,11 +2175,11 @@ local scan_dir = function (dirname, currentnames, targetnames, report ("log", 2, "db", "Would have been loading %s.", fullname) report_status ("term", "db", - "Would have been loading %s.", truncated) + "Would have been loading %s", truncated) else local truncated = truncate_string (fullname, 32) report ("log", 2, "db", "Loading font %s.", fullname) - report_status ("term", "db", "Loading font %s.", truncated) + report_status ("term", "db", "Loading font %s", truncated) local new = read_font_names (fullname, currentnames, targetnames, texmf) if new == true then @@ -3424,7 +3429,7 @@ local show_cache = function ( ) separator () print_cache ("writable path", writable_path, luanames, lucnames, rest) - texiowrite_nl"" + texio.write_nl"" for i=1,#readable_paths do local readable_path = readable_paths[i] if readable_path ~= writable_path then diff --git a/mktests b/mktests index d496896..688e5f8 100755 --- a/mktests +++ b/mktests @@ -64,6 +64,12 @@ local pprint_spec = function (spec) spec.optsize or 0) end +----------------------------------------------------------------------- +--- tool tests +----------------------------------------------------------------------- + + + ----------------------------------------------------------------------- --- font tests ----------------------------------------------------------------------- -- cgit v1.2.3 From 77bc18e06aa2956abc67a32ad6c28e890a252451 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 13 Dec 2013 11:27:40 +0100 Subject: [diagnose] fix missing reference to ioopen() (thanks, Robert\!) --- luaotfload-diagnostics.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/luaotfload-diagnostics.lua b/luaotfload-diagnostics.lua index f191913..9d0eff6 100644 --- a/luaotfload-diagnostics.lua +++ b/luaotfload-diagnostics.lua @@ -25,6 +25,8 @@ local lfsreadlink = lfs.readlink local md5 = require "md5" local md5sumhexa = md5.sumhexa +local ioopen = io.open + local osgetenv = os.getenv local osname = os.name local osremove = os.remove -- cgit v1.2.3 From 21ebcc5a7c7907a8a2141b09b230e6c259594b76 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 13 Dec 2013 11:30:40 +0100 Subject: [diagnose] adapt to new index structure --- luaotfload-diagnostics.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/luaotfload-diagnostics.lua b/luaotfload-diagnostics.lua index 9d0eff6..97390ce 100644 --- a/luaotfload-diagnostics.lua +++ b/luaotfload-diagnostics.lua @@ -56,10 +56,10 @@ end local check_index = function (errcnt) out "================= font names ==================" - local name_index = names.data() + local namedata = names.data() - if not name_index then - name_index = names.load () + if not namedata then + namedata = names.load () end local mappings = namedata.mappings @@ -69,9 +69,9 @@ local check_index = function (errcnt) return errcnt + 1 end - out ("Database version: %.3f.", names.version) + out ("Database version: %.3f.", namedata.meta.version) out ("Font formats indexed: %s.", - tableconcat (namedata.formats, ", ")) + tableconcat (namedata.meta.formats, ", ")) out ("%d font files indexed.", #mappings) local by_format = { } -- cgit v1.2.3 From 41b172923704902bbe23ec9372df2eb097c25d87 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 13 Dec 2013 11:46:34 +0100 Subject: [diagnose] test permissions of gzipped index --- luaotfload-diagnostics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luaotfload-diagnostics.lua b/luaotfload-diagnostics.lua index 97390ce..68ed18c 100644 --- a/luaotfload-diagnostics.lua +++ b/luaotfload-diagnostics.lua @@ -243,7 +243,7 @@ local path = names.path local desired_permissions = { { "d", {"r","w"}, function () return caches.getwritablepath () end }, { "d", {"r","w"}, path.globals.prefix }, - { "f", {"r","w"}, path.index.lua }, + { "f", {"r","w"}, path.index.lua .. ".gz" }, { "f", {"r","w"}, path.index.luc }, { "f", {"r","w"}, path.lookups.lua }, { "f", {"r","w"}, path.lookups.luc }, -- cgit v1.2.3