summaryrefslogtreecommitdiff
path: root/luaotfload-fonts.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-01-25 14:47:36 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-01-28 15:39:29 +0200
commit563425e120af64b9596d5c88b88bd29a4ffab067 (patch)
tree7c6fd46fd2fe02aabe381f1685bd3b9b190daf3a /luaotfload-fonts.lua
parent13d1fa34450ff9ae90f39e36d5ca41cbf75dd0a3 (diff)
downloadluaotfload-563425e120af64b9596d5c88b88bd29a4ffab067.tar.gz
Fix font names preference
Prefer different values of font names as suggested by TrueType specs. See http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html
Diffstat (limited to 'luaotfload-fonts.lua')
-rw-r--r--luaotfload-fonts.lua25
1 files changed, 11 insertions, 14 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua
index 732e691..390ff4c 100644
--- a/luaotfload-fonts.lua
+++ b/luaotfload-fonts.lua
@@ -36,12 +36,11 @@ function fontloader.fullinfo(...)
for _,v in pairs(m.names) do
if v.lang == "English (US)" then
t.names = {
- fullname = v.names.fullname,
- family = v.names.family,
- subfamily = v.names.subfamily,
- compatfull = v.names.compatfull,
- preffamilyname = v.names.preffamilyname,
- prefmodifiers = v.names.prefmodifiers,
+ -- 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
+ psname = v.names.postscriptname --or t.fontname
}
end
end
@@ -69,8 +68,6 @@ function fontloader.fullinfo(...)
t.design_size = m.design_size ~= 0 and m.design_size or nil
t.design_range_bottom = m.design_range_bottom ~= 0 and m.design_range_bottom or nil
t.design_range_top = m.design_range_top ~= 0 and m.design_range_top or nil
- -- used for indexing
- t.family = t.names.preffamilyname or t.names.family or t.familyname
return t
end
@@ -88,10 +85,10 @@ local function load_font(filename, names, texmf)
fullinfo.filename = basename(filename)
end
mappings[#mappings+1] = fullinfo
- if not families[fullinfo.family] then
- families[fullinfo.family] = { }
+ if not families[fullinfo.names.family] then
+ families[fullinfo.names.family] = { }
end
- table.insert(families[fullinfo.family], #mappings)
+ table.insert(families[fullinfo.names.family], #mappings)
end
else
local fullinfo = fontloader.fullinfo(filename)
@@ -99,10 +96,10 @@ local function load_font(filename, names, texmf)
fullinfo.filename = basename(filename)
end
mappings[#mappings+1] = fullinfo
- if not families[fullinfo.family] then
- families[fullinfo.family] = { }
+ if not families[fullinfo.names.family] then
+ families[fullinfo.names.family] = { }
end
- table.insert(families[fullinfo.family], #mappings)
+ table.insert(families[fullinfo.names.family], #mappings)
end
else
log(1, "Failed to load %s", filename)