summaryrefslogtreecommitdiff
path: root/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-11-13 02:04:03 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-11-13 02:04:03 +0100
commit346d218c26f96764414def46d829ab841daabfbc (patch)
tree42fe208423ac96c0b252e9f7908a1245ea7f7a6c /luaotfload-database.lua
parent7c0629c2c2748e3ba32d0fc92f6a425629f1c4b9 (diff)
downloadluaotfload-346d218c26f96764414def46d829ab841daabfbc.tar.gz
[db] infer style for Type1 fonts
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r--luaotfload-database.lua22
1 files changed, 16 insertions, 6 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index c15cd60..fba01cc 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -1536,14 +1536,14 @@ end
t1_fullinfo = function (filename, _subfont, location, basename, format)
local sanitized
- local metadata = load_font_file (filename)
-
+ local metadata = load_font_file (filename)
local fontname = metadata.fontname
local fullname = metadata.fullname
local familyname = metadata.familyname
local italicangle = metadata.italicangle
- local weight = metadata.weight --- string identifier
local splitstyle = split_fontname (fontname)
+ local style = ""
+ local weight
sanitized = sanitize_fontnames ({
fontname = fontname,
@@ -1551,10 +1551,20 @@ t1_fullinfo = function (filename, _subfont, location, basename, format)
pfullname = fullname,
metafamily = family,
familyname = familyname,
- subfamily = weight,
+ weight = metadata.weight, --- string identifier
prefmodifiers = style,
})
+ weight = sanitized.weight
+
+ if weight == "bold" then
+ style = weight
+ end
+
+ if italicangle ~= 0 then
+ style = style .. "italic"
+ end
+
return {
basename = basename,
fullpath = filename,
@@ -1569,9 +1579,9 @@ t1_fullinfo = function (filename, _subfont, location, basename, format)
version = metadata.version,
size = false,
splitstyle = splitstyle,
- fontstyle_name = splitstyle or sanitized.subfamily,
+ fontstyle_name = style ~= "" and style or weight,
weight = { metadata.pfminfo.weight,
- sanitized.subfamily },
+ weight },
italicangle = italicangle,
}
end