From 346d218c26f96764414def46d829ab841daabfbc Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 13 Nov 2013 02:04:03 +0100 Subject: [db] infer style for Type1 fonts --- luaotfload-database.lua | 22 ++++++++++++++++------ 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 diff --git a/mktests b/mktests index eaf931f..d496896 100755 --- a/mktests +++ b/mktests @@ -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 = { -- cgit v1.2.3