summaryrefslogtreecommitdiff
path: root/otfl-font-dum.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-01-15 07:05:57 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-01-15 08:28:18 +0200
commite9a6ba1faeb7d7e943e386286aa76e9c6345ed62 (patch)
tree206349975c8ba1ecbc76d37db75f1d552ee71800 /otfl-font-dum.lua
parentab822b50f8ee435e705ee0d510c5c7af8f99cb65 (diff)
downloadluaotfload-e9a6ba1faeb7d7e943e386286aa76e9c6345ed62.tar.gz
Try psname if familyname fails
Diffstat (limited to 'otfl-font-dum.lua')
-rw-r--r--otfl-font-dum.lua32
1 files changed, 22 insertions, 10 deletions
diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua
index e673331..d9fabfa 100644
--- a/otfl-font-dum.lua
+++ b/otfl-font-dum.lua
@@ -70,18 +70,30 @@ function fonts.names.resolve(name,sub,style)
end
if type(data) == "table" and data.version == fonts.names.version then
local condensed = string.gsub(string.lower(name),"[^%a%d]","")
- local found = data.mappings and data.mappings.families and data.mappings.families[condensed]
- if found then
- local style = style or "regular"
- found = found[style]
- local fontname, filename, subfont = found, found[1], found[2]
- if subfont then
- return filename, fontname
+ if data.mappings then
+ local psnames = data.mappings.psnames
+ local families = data.mappings.families
+ local family = families and families[condensed]
+ local psname = psnames and psnames[condensed]
+ if family then
+ local style = style or "regular"
+ family = family[style]
+ local fontname, filename, subfont = family, family[1], family[2]
+ if subfont then
+ return filename, fontname
+ else
+ return filename, false
+ end
+ elseif psname then
+ local fontname, filename, subfont = psname, psname[1], psname[2]
+ if subfont then
+ return filename, fontname
+ else
+ return filename, false
+ end
else
- return filename, false
+ return name, false -- fallback to filename
end
- else
- return name, false -- fallback to filename
end
end
end