From 4e3c25d0fa4ad115416c5004e0e544b2faf99788 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 15 Nov 2013 21:47:45 +0100 Subject: [fontloader] sync with Context as of 2013-11-15 --- luaotfload-database.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index fba01cc..bccfd7b 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1349,6 +1349,7 @@ local get_english_names = function (names, basename) local english_names if names then + inspect(names) for _, raw_namedata in next, names do if raw_namedata.lang == "English (US)" then english_names = raw_namedata.names @@ -1369,8 +1370,6 @@ local organize_namedata = function (metadata, english_names, basename, info) - - --print (english_names.family, "<>", english_names.preffamilyname) local fontnames = { --- see --- https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html @@ -1385,18 +1384,18 @@ local organize_namedata = function (metadata, --- non-abbreviated fashion, for most fonts at any rate. --- However, in some fonts (e.g. CMU) all three fields are --- identical. - fullname = english_names.compatfull - or english_names.fullname, + fullname = --[[ 18 ]] english_names.compatfull + or --[[ 4 ]] english_names.fullname, --- we keep both the “preferred family” and the “family” --- values around since both are valid but can turn out --- quite differently, e.g. with Latin Modern: --- preffamily: “Latin Modern Sans”, --- family: “LM Sans 10” - preffamily = english_names.preffamilyname, - family = english_names.family, - prefmodifiers = english_names.prefmodifiers, - subfamily = english_names.subfamily, - psname = english_names.postscriptname, + preffamily = --[[ 16 ]] english_names.preffamilyname, + family = --[[ 1 ]] english_names.family, + prefmodifiers = --[[ 17 ]] english_names.prefmodifiers, + subfamily = --[[ 2 ]] english_names.subfamily, + psname = --[[ 6 ]] english_names.postscriptname, }, metadata = { -- cgit v1.2.3 From 2be8db31dc0406e149a89c62bd628cfa6756ab30 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 16 Nov 2013 22:36:37 +0100 Subject: [db] use tput to determine the terminal size if appropriate --- luaotfload-database.lua | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index bccfd7b..714c37c 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -47,7 +47,6 @@ local C, Cc, Cf, Cg, Cs, Ct --- Luatex builtins local load = load local next = next -local pcall = pcall local require = require local tonumber = tonumber local unpack = table.unpack @@ -59,6 +58,7 @@ local fontloaderopen = fontloader.open local gzipopen = gzip.open local iolines = io.lines local ioopen = io.open +local iopopen = io.popen local kpseexpand_path = kpse.expand_path local kpseexpand_var = kpse.expand_var local kpsefind_file = kpse.find_file @@ -123,6 +123,26 @@ local luaotfloadconfig = config.luaotfload --- always present luaotfloadconfig.resolver = luaotfloadconfig.resolver or "normal" luaotfloadconfig.formats = luaotfloadconfig.formats or "otf,ttf,ttc,dfont" luaotfloadconfig.strip = luaotfloadconfig.strip == true +--- The “termwidth” value is only considered when printing +--- short status messages, e.g. when building the database +--- online. +if not luaotfloadconfig.termwidth then + local tw = 79 + if not ( os.type == "windows" --- Assume broken terminal. + or os.getenv "TERM" == "dumb") + and iopopen + then + local p = iopopen "tput cols" + if p then + result = p:read "*all" + p:close () + if result then + tw = tonumber (result) or tw + end + end + end + luaotfloadconfig.termwidth = tw +end --- this option allows for disabling updates --- during a TeX run @@ -1349,7 +1369,7 @@ local get_english_names = function (names, basename) local english_names if names then - inspect(names) + --inspect(names) for _, raw_namedata in next, names do if raw_namedata.lang == "English (US)" then english_names = raw_namedata.names @@ -2086,6 +2106,16 @@ local find_font_files = function (root, recurse) end end +--- truncate_string -- Cut the first part of a string to fit it +--- 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) +end + --[[doc-- scan_dir() scans a directory and populates the list of fonts @@ -2131,10 +2161,12 @@ local scan_dir = function (dirname, currentnames, targetnames, local new if dry_run == true then + local truncated = truncate_string (fullname, 43) report_status ("both", "db", - "Would have been loading %q", fullname) + "Would have been loading %s", truncated) else - report_status ("both", "db", "Loading font %q", fullname) + local truncated = truncate_string (fullname, 32) + report_status ("both", "db", "Loading font %s", truncated) local new = read_font_names (fullname, currentnames, targetnames, texmf) if new == true then -- cgit v1.2.3