summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luaotfload-database.lua37
-rwxr-xr-xluaotfload-tool.lua28
2 files changed, 40 insertions, 25 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index cf9e672..023d5f8 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -1376,21 +1376,34 @@ local get_english_names = function (names, basename)
english_names = raw_namedata.names
end
end
- else
- -- no names table, probably a broken font
- report("log", 1, "db",
- "Broken font %s rejected due to missing names table.",
- basename)
- return nil
end
- return english_names
+ if not english_names then
+ -- no (English) names table, probably a broken font
+ report("both", 3, "db",
+ "%s: missing or broken names table.", basename)
+ end
+
+ return english_names or { }
end
local organize_namedata = function (metadata,
english_names,
basename,
info)
+ local default_name = english_names.compatfull
+ or english_names.fullname
+ or english_names.postscriptname
+ or metadata.fullname
+ or metadata.fontname
+ or info.fullname --- TODO check if fontloader.info() is ready for prime
+ or info.fontname
+ local default_family = english_names.preffamily
+ or english_names.family
+ or metadata.familyname
+ or info.familyname
+-- local default_modifier = english_names.prefmodifiers
+-- or english_names.subfamily
local fontnames = {
--- see
--- https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html
@@ -1406,14 +1419,15 @@ local organize_namedata = function (metadata,
--- However, in some fonts (e.g. CMU) all three fields are
--- identical.
fullname = --[[ 18 ]] english_names.compatfull
- or --[[ 4 ]] english_names.fullname,
+ or --[[ 4 ]] english_names.fullname
+ or default_name,
--- 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 = --[[ 16 ]] english_names.preffamilyname,
- family = --[[ 1 ]] english_names.family,
+ family = --[[ 1 ]] english_names.family or default_family,
prefmodifiers = --[[ 17 ]] english_names.prefmodifiers,
subfamily = --[[ 2 ]] english_names.subfamily,
psname = --[[ 6 ]] english_names.postscriptname,
@@ -1477,7 +1491,7 @@ local organize_styledata = function (fontname,
local names = metadata.names
return {
- -- see http://www.microsoft.com/typography/OTSPEC/features_pt.htm#size
+ --- see http://www.microsoft.com/typography/OTSPEC/features_pt.htm#size
size = get_size_info (metadata),
weight = pfminfo.weight or 400,
split = split_fontname (fontname),
@@ -2568,6 +2582,9 @@ local pull_values = function (entry)
end
local add_family = function (name, subtable, modifier, entry)
+ if not name then --- probably borked font
+ return
+ end
local familytable = subtable [name]
if not familytable then
familytable = { }
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 5b7e0a2..8bc590a 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -104,18 +104,7 @@ if not luaotfloadconfig.strip then
luaotfloadconfig.strip = true
end
-do -- we don’t have file.basename and the likes yet, so inline parser ftw
- local slash = P"/"
- local dot = P"."
- local noslash = 1 - slash
- local slashes = slash^1
- local path = slashes^-1 * (noslash^1 * slashes)^1
- local thename = (1 - slash - dot)^1
- local extension = dot * (1 - slash - dot)^1
- local p_basename = path^-1 * C(thename) * extension^-1 * P(-1)
-
- luaotfloadconfig.self = "luaotfload-tool"
-end
+luaotfloadconfig.self = "luaotfload-tool"
config.lualibs = config.lualibs or { }
config.lualibs.verbose = false
@@ -175,12 +164,13 @@ local help_messages = {
Usage: %s [OPTIONS...]
-Operations on the Luaotfload font names database.
+ Luaotfload font management and diagnostic utility.
+ This program is part of the Luaotfload package.
-This tool is part of the luaotfload package. Valid options are:
+ Valid options are:
-------------------------------------------------------------------------------
- VERBOSITY AND LOGGING
+ VERBOSITY AND DIAGNOSTICS
-q --quiet don't output anything
-v --verbose=LEVEL be more verbose (print the searched directories)
@@ -266,8 +256,16 @@ local help_msg = function (version)
luaotfloadconfig.cache_dir)))
end
+local about = [[
+%s:
+ Luaotfload font management and diagnostic utility.
+ License: GNU GPL v2.0.
+ Report problems to <https://github.com/lualatex/luaotfload/issues>
+]]
+
local version_msg = function ( )
local out = function (...) texiowrite_nl (stringformat (...)) end
+ out (about, luaotfloadconfig.self)
out ("%s version %q", luaotfloadconfig.self, version)
out ("revision %q", luaotfloadstatus.notes.revision)
out ("database version %q", names.version)