diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-05 17:07:38 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-05 17:07:38 +0100 |
commit | 58acd9e4271e17cd9d8073d4de69f6f68048adb4 (patch) | |
tree | 09c3b9fb130d8d4163f8b91a90dc05171d753ba7 | |
parent | 653e9f10b170aff798cc9348d41bae472d7414f0 (diff) | |
download | luaotfload-58acd9e4271e17cd9d8073d4de69f6f68048adb4.tar.gz |
[db] add font name resolver
-rw-r--r-- | luaotfload-database.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 1a79c3e..5c60046 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1265,10 +1265,22 @@ local resolve_familyname = function (specification, name, style, askedsize) return resolved, subfont end -local resolve_fontname = function (specification, name, style, askedsize) - local resolved, subfont - --[[ TODO ]] - return resolved, subfont +local resolve_fontname = function (specification, name) + local mappings = name_index.mappings + for i = 1, #mappings do + local face = mappings [i] + local sanitized = face.names.sanitized + local info = sanitized.info + local english = sanitized.english + if info.fontname == name + or info.fullname == name + or english.psname == name + or english.fullname == name + then + return face.file.base, face.file.subfont + end + end + return nil, nil end --[[doc-- @@ -1302,7 +1314,7 @@ resolve_name = function (specification) resolved, subfont = resolve_familyname (specification, name, style, askedsize) if not resolved then - resolved, subfont = resolve_fontname (specification, name, style, askedsize) + resolved, subfont = resolve_fontname (specification, name) end if not resolved then resolved = specification.name, false |