summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-02-05 20:43:45 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2014-02-05 20:43:45 +0100
commitf901a9b78f970f5674b2a0437f239789b6e12f36 (patch)
tree34e178a82d6e44bae56d0ba5b40fd0371121449a
parentbb99e2c94aaa32cb3635ec6e35a4dc8ca6e309ae (diff)
downloadluaotfload-f901a9b78f970f5674b2a0437f239789b6e12f36.tar.gz
[db] backport c29e7f302f6ab05b6e0975daeaa60240b530885d
Part of the 2.4 backport of this issue: https://github.com/lualatex/luaotfload/pull/188
-rw-r--r--luaotfload-database.lua24
1 files changed, 19 insertions, 5 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 7e5f8cb..cb3ec33 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -132,7 +132,7 @@ luaotfloadconfig.compress = luaotfloadconfig.compress ~= false
local names = fonts.names
local name_index = nil --> upvalue for names.data
local lookup_cache = nil --> for names.lookups
-names.version = 2.4
+names.version = 2.41
names.data = nil --- contains the loaded database
names.lookups = nil --- contains the lookup cache
@@ -1395,16 +1395,26 @@ local get_english_names = function (names, basename)
report("log", 1, "db",
"Broken font %s rejected due to missing names table.",
basename)
- return nil
end
- return english_names
+ 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 fontnames = {
--- see
--- https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html
@@ -1420,14 +1430,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,
@@ -2803,6 +2814,9 @@ local pull_values = function (entry)
end
local add_family = function (name, subtable, modifier, entry)
+ if not name then
+ return
+ end
local familytable = subtable [name]
if not familytable then
familytable = { }