From 58acd9e4271e17cd9d8073d4de69f6f68048adb4 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 5 Nov 2013 17:07:38 +0100 Subject: [db] add font name resolver --- luaotfload-database.lua | 22 +++++++++++++++++----- 1 file 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 -- cgit v1.2.3