summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-01-25 15:08:31 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-01-28 15:41:02 +0200
commitb8cc1d86abe249c56168f32dd16e020a57aaf02e (patch)
treeec8f046602715c56d348d7ef002b3cc244db84cd
parent563425e120af64b9596d5c88b88bd29a4ffab067 (diff)
downloadluaotfload-b8cc1d86abe249c56168f32dd16e020a57aaf02e.tar.gz
Fix LM style name issue
According to OpenType spec, size feature can define a common style name for different optical sizes of the same font, now we use it. See http://www.microsoft.com/typography/otspec/features_pt.htm#size
-rw-r--r--luaotfload-fonts.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua
index 390ff4c..aa0d02f 100644
--- a/luaotfload-fonts.lua
+++ b/luaotfload-fonts.lua
@@ -32,6 +32,14 @@ function fontloader.fullinfo(...)
local f = fontloader.open(...)
local m = f and fontloader.to_table(f)
fontloader.close(f)
+ -- see http://www.microsoft.com/typography/OTSPEC/features_pt.htm#size
+ if m.fontstyle_name then
+ for _,v in pairs(m.fontstyle_name) do
+ if v.lang == 1033 then
+ t.fontstyle_name = v.name
+ end
+ end
+ end
if m.names then
for _,v in pairs(m.names) do
if v.lang == "English (US)" then
@@ -39,19 +47,12 @@ function fontloader.fullinfo(...)
-- see http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html
fullname = v.names.compatfull or v.names.fullname, -- 18, 4
family = v.names.preffamilyname or v.names.family, -- 17, 1
- subfamily = v.names.prefmodifiers or v.names.subfamily,-- 16, 2
+ subfamily = t.fontstyle_name or v.names.prefmodifiers or v.names.subfamily, -- opt. style, 16, 2
psname = v.names.postscriptname --or t.fontname
}
end
end
end
- if m.fontstyle_name then
- for _,v in pairs(m.fontstyle_name) do
- if v.lang == 1033 then
- t.fontstyle_name = v.name
- end
- end
- end
if m.pfminfo then
t.pfminfo = {
weight = m.pfminfo.weight,