diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-13 02:04:03 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-13 02:04:03 +0100 |
commit | 346d218c26f96764414def46d829ab841daabfbc (patch) | |
tree | 42fe208423ac96c0b252e9f7908a1245ea7f7a6c | |
parent | 7c0629c2c2748e3ba32d0fc92f6a425629f1c4b9 (diff) | |
download | luaotfload-346d218c26f96764414def46d829ab841daabfbc.tar.gz |
[db] infer style for Type1 fonts
-rw-r--r-- | luaotfload-database.lua | 22 | ||||
-rwxr-xr-x | mktests | 24 |
2 files changed, 28 insertions, 18 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 @@ -119,18 +119,18 @@ local choose_style = { --- this needs a database built with --formats=+pfa,pfb,afm local resolve_t1_font = { - { { name = "URW Gothic L", style = "regular" }, "uagk8a.pfb" }, - { { name = "URW Gothic L", style = "italic" }, "uagko8a.pfb" }, - { { name = "URW Gothic L", style = "bold" }, "uagd8a.pfb" }, - { { name = "URW Gothic L", style = "bolditalic" }, "uagdo8a.pfb" }, - { { name = "Century Schoolbook L", style = "regular" }, "uncr8a.pfb" }, - { { name = "Century Schoolbook L", style = "italic" }, "uncri8a.pfb" }, - { { name = "Century Schoolbook L", style = "bold" }, "uncb8a.pfb" }, - { { name = "Century Schoolbook L", style = "bolditalic" }, "uncbi8a.pfb" }, - { { name = "Nimbus Roman No9 L", style = "regular" }, "utmr8a.pfb" }, - { { name = "Nimbus Roman No9 L", style = "italic" }, "utmri8a.pfb" }, - { { name = "Nimbus Roman No9 L", style = "bold" }, "utmb8a.pfb" }, --- medium, actually - { { name = "Nimbus Roman No9 L", style = "bolditalic" }, "utmbi8a.pfb" }, + { { name = "URW Gothic L", style = "regular" }, "a010013l.pfb" }, --> “book” +-- { { name = "URW Gothic L", style = "italic" }, "a010033l.pfb" }, --> “book oblique” +-- { { name = "URW Gothic L", style = "bold" }, "a010015l.pfb" }, --> “demi” +-- { { name = "URW Gothic L", style = "bolditalic" }, "a010035l.pfb" }, --> “demi oblique” + { { name = "Century Schoolbook L", style = "regular" }, "c059013l.pfb" }, + { { name = "Century Schoolbook L", style = "italic" }, "c059033l.pfb" }, + { { name = "Century Schoolbook L", style = "bold" }, "c059016l.pfb" }, + { { name = "Century Schoolbook L", style = "bolditalic" }, "c059036l.pfb" }, + { { name = "Nimbus Roman No9 L", style = "regular" }, "n021003l.pfb" }, + { { name = "Nimbus Roman No9 L", style = "italic" }, "n021023l.pfb" }, + { { name = "Nimbus Roman No9 L", style = "bold" }, "n021004l.pfb" }, --- medium, actually + { { name = "Nimbus Roman No9 L", style = "bolditalic" }, "n021024l.pfb" }, } local translate_style = { |