summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-01-14 18:35:13 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-01-15 08:28:18 +0200
commit5f4df7b29cab5afa15d2c691b69f5013119ac74c (patch)
tree69be30ec86ef0422bd58dbb3fca10d581df977ea
parent44850a658e40bd8a5e904e123b63256e475538b4 (diff)
downloadluaotfload-5f4df7b29cab5afa15d2c691b69f5013119ac74c.tar.gz
Fix more buggy fonts (Linux Libertine Bold et al.)
Now this code is getting really ugly!
-rw-r--r--luaotfload-fonts.lua21
1 files changed, 13 insertions, 8 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua
index 56f1239..431cc55 100644
--- a/luaotfload-fonts.lua
+++ b/luaotfload-fonts.lua
@@ -52,8 +52,8 @@ function fontloader.fullinfo(filename, subfont)
if m.names then
for _,v in pairs(m.names) do
if v.lang == "English (US)" then
- n.full = v.names.compatfull
- n.family = v.names.preffamilyname
+ n.fullname = v.names.compatfull
+ n.familyname = v.names.preffamilyname
n.subfamily = v.names.subfamily
n.modifier = v.names.prefmodifiers
end
@@ -67,8 +67,8 @@ function fontloader.fullinfo(filename, subfont)
end
end
t.psname = m.fontname
- t.fullname = n.full or m.fullname
- t.family = n.family or m.familyname
+ t.fullname = n.fullname or m.fullname
+ t.family = n.familyname or m.familyname
t.style = n.subfamily or m.style
if not t.style or t.style:is_empty() then
local s = t.psname:split("-")
@@ -80,13 +80,18 @@ function fontloader.fullinfo(filename, subfont)
t.style = n.modifier
end
if not t.style or t.style:is_empty() then
- if n.full and n.family then
- t.style = n.full:gsub(n.family, "")
+ if n.fullname and n.familyname then
+ t.style = (n.fullname:gsub(n.familyname, "") ~= n.fullname and n.fullname:gsub(n.familyname, "")) or nil
elseif m.fontname and m.familyname then
- t.style = m.fontname:gsub(m.familyname, "")
+ t.style = (m.fontname:gsub(m.familyname, "") ~= m.fontname and m.fontname:gsub(m.familyname, "")) or nil
end
end
- if t.style:is_empty() then t.style = "Regular" end
+ if not t.style or t.style:is_empty() then
+ t.style = (m.fullname:gsub(m.familyname, "") ~= m.fullname and m.fullname:gsub(m.familyname, "")) or nil
+ end
+ if not t.style or t.style:is_empty() then
+ t.style = "Regular"
+ end
-- tprint(m) print(w)
m, n = nil, nil
return t