From 69f51727fba1c348d78348d9f163cf884e7ab558 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 9 May 2013 13:45:14 +0200 Subject: add querying of font metadata to luaotfload-tool --- luaotfload-database.lua | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 576341f..96db195 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -146,10 +146,11 @@ This is a sketch of the luaotfload db: psname : string; subfamily : string; } - size : int list; - slant : int; - weight : int; - width : int; + size : int list; + slant : int; + weight : int; + width : int; + units_per_em : int; // mainly 1000, but also 2048 or 256 } and filestatus = (fullname, { index : int list; timestamp : int }) dict @@ -836,13 +837,16 @@ font_fullinfo = function (filename, subfont) report("log", 1, "db", "broken font rejected", "%s", basefile) return end - tfmdata.fontname = metadata.fontname - tfmdata.fullname = metadata.fullname - tfmdata.familyname = metadata.familyname - tfmdata.filename = { filename, subfont } -- always store full path - tfmdata.weight = metadata.pfminfo.weight - tfmdata.width = metadata.pfminfo.width - tfmdata.slant = metadata.italicangle + tfmdata.fontname = metadata.fontname + tfmdata.fullname = metadata.fullname + tfmdata.familyname = metadata.familyname + tfmdata.filename = { filename, subfont } -- always store full path + tfmdata.weight = metadata.pfminfo.weight + tfmdata.width = metadata.pfminfo.width + tfmdata.slant = metadata.italicangle + --- this is for querying + tfmdata.units_per_em = metadata.units_per_em + tfmdata.version = metadata.version -- don't waste the space with zero values tfmdata.size = { metadata.design_size ~= 0 and metadata.design_size or nil, -- cgit v1.2.3 From dde1b993cfd1aa07f31c0a97b8de8233e18f4fb4 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 9 May 2013 15:22:20 +0200 Subject: [doc] mention manpage in manual --- luaotfload-database.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 96db195..84b884d 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -71,7 +71,7 @@ fonts.definers = fonts.definers or { } local names = fonts.names -names.version = 2.203 +names.version = 2.204 names.data = nil --- contains the loaded database names.lookups = nil --- contains the lookup cache names.path = { -- cgit v1.2.3 From e6b989e65849ea7294500a6e156371696f7cbf52 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 9 May 2013 17:45:50 +0200 Subject: set higher loglevels for database tracing --- luaotfload-database.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 84b884d..f59954e 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1071,25 +1071,25 @@ local scan_dir = function (dirname, fontnames, newfontnames) - texmf used to be a boolean saying if we are scanning a texmf directory ]] local n_scanned, n_new = 0, 0 --- total of fonts collected - report("log", 2, "db", "scanning", "%s", dirname) + report("both", 2, "db", "scanning directory %s", dirname) for _,i in next, font_extensions do for _,ext in next, { i, stringupper(i) } do local found = dirglob(stringformat("%s/**.%s$", dirname, ext)) local n_found = #found --- note that glob fails silently on broken symlinks, which --- happens sometimes in TeX Live. - report("log", 2, "db", "%s '%s' fonts found", n_found, ext) + report("both", 4, "db", "%s '%s' fonts found", n_found, ext) n_scanned = n_scanned + n_found for j=1, n_found do local fullname = found[j] fullname = path_normalize(fullname) - report("log", 2, "db", "loading font ā€œ%sā€", fullname) + report("both", 4, "db", "loading font ā€œ%sā€", fullname) local new = load_font(fullname, fontnames, newfontnames) if new then n_new = n_new + 1 end end end end - report("log", 2, "db", "%d fonts found in '%s'", n_scanned, dirname) + report("both", 4, "db", "%d fonts found in '%s'", n_scanned, dirname) return n_scanned, n_new end @@ -1108,6 +1108,7 @@ local function scan_texmf_fonts(fontnames, newfontnames) fontdirs = fontdirs .. stringgsub(kpseexpand_path("$TTFONTS"), "^%.", "") if not stringis_empty(fontdirs) then for _,d in next, filesplitpath(fontdirs) do + report("info", 4, "db", "Entering directory %s", d) local found, new = scan_dir(d, fontnames, newfontnames) n_scanned = n_scanned + found n_new = n_new + new -- cgit v1.2.3 From 9f697f3c5f0e19ab3beab9a2891c42aa8cc8a325 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 9 May 2013 20:56:10 +0200 Subject: make file lookups return string instead of pair --- luaotfload-database.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 84b884d..df5b531 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -317,7 +317,7 @@ end local type1_formats = { "tfm", "ofm", } ---- string -> (string * bool | int) +--- string -> string crude_file_lookup_verbose = function (filename) if not names.data then names.data = load_names() end local data = names.data @@ -327,18 +327,18 @@ crude_file_lookup_verbose = function (filename) --- look up in db first ... found = data.barenames[filename] if found and mappings[found] then - found = mappings[found].filename + found = mappings[found].filename[1] report("info", 0, "db", "crude file lookup: req=%s; hit=bare; ret=%s", - filename, found[1]) + filename, found) return found end found = data.basenames[filename] if found and mappings[found] then - found = mappings[found].filename + found = mappings[found].filename[1] report("info", 0, "db", "crude file lookup: req=%s; hit=base; ret=%s", - filename, found[1]) + filename, found) return found end @@ -346,13 +346,13 @@ crude_file_lookup_verbose = function (filename) for i=1, #type1_formats do local format = type1_formats[i] if resolvers.findfile(filename, format) then - return { file.addsuffix(filename, format), false }, format + return file.addsuffix(filename, format), format end end - return { filename, false }, nil + return filename, nil end ---- string -> (string * bool | int) +--- string -> string crude_file_lookup = function (filename) if not names.data then names.data = load_names() end local data = names.data @@ -361,15 +361,15 @@ crude_file_lookup = function (filename) or data.basenames[filename] if found then found = data.mappings[found] - if found then return found.filename end + if found then return found.filename[1] end end for i=1, #type1_formats do local format = type1_formats[i] if resolvers.findfile(filename, format) then - return { file.addsuffix(filename, format), false }, format + return file.addsuffix(filename, format), format end end - return { filename, false }, nil + return filename, nil end --[[doc-- -- cgit v1.2.3