summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-01-26 04:49:56 -0800
committerPhilipp Gesang <phg42.2a@gmail.com>2014-01-26 04:49:56 -0800
commitd489b3db4c415aa58550df09d85315f2a31bc6db (patch)
tree0fa3557728ec2fc9a375c5e26ff219f3d9f15f8f
parent164185fd15939f480627513cd42f4623f9d6d4e2 (diff)
parent814443264c28faa585b364196b164cf5a9eed4ba (diff)
downloadluaotfload-d489b3db4c415aa58550df09d85315f2a31bc6db.tar.gz
Merge pull request #183 from phi-gamma/texlive2014
improve detection of bold fonts
-rw-r--r--luaotfload-database.lua48
-rw-r--r--luaotfload-parsers.lua3
-rwxr-xr-xluaotfload-tool.lua15
3 files changed, 31 insertions, 35 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 98c5d3f..28109ec 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -1479,17 +1479,10 @@ local organize_styledata = function (fontname,
return {
-- see http://www.microsoft.com/typography/OTSPEC/features_pt.htm#size
size = get_size_info (metadata),
- weight = {
- pfminfo.weight, -- integer (multiple of 100?)
- sanitize_fontname (info.weight), -- style name
- },
+ weight = pfminfo.weight or 400,
split = split_fontname (fontname),
width = pfminfo.width,
italicangle = metadata.italicangle,
--- italicangle = {
--- metadata.italicangle, -- float
--- info.italicangle, -- truncated to integer point size?
--- },
--- this is for querying, see www.ntg.nl/maps/40/07.pdf for details
units_per_em = metadata.units_per_em,
version = metadata.version,
@@ -1601,8 +1594,7 @@ t1_fullinfo = function (filename, _subfont, location, basename, format)
size = false,
splitstyle = splitstyle,
fontstyle_name = style ~= "" and style or weight,
- weight = { metadata.pfminfo.weight,
- weight },
+ weight = metadata.pfminfo.weight or 400,
italicangle = italicangle,
}
end
@@ -2458,13 +2450,29 @@ local check_regular
do
local splitfontname = lpeg.splitat "-"
- local choose_exact = function (field)
+ local choose_exact = function (field, weight)
+ local i = false
+ local b = false
+
if italic_synonym [field] then
+ i = true
+ end
+
+ if weight == 700 or field == "bold" then
+ b = true
+ end
+
+ if field == "bolditalic" or field == "boldoblique" then
+ b = true
+ i = true
+ end
+
+ if i and b then
+ return "bi"
+ elseif i then
return "i"
- elseif field == "bold" then
+ elseif b then
return "b"
- elseif field == "bolditalic" or field == "boldoblique" then
- return "bi"
end
return false
@@ -2473,16 +2481,17 @@ do
pick_style = function (fontstyle_name,
prefmodifiers,
subfamily,
- splitstyle)
+ splitstyle,
+ weight)
local style
if fontstyle_name then
- style = choose_exact (fontstyle_name)
+ style = choose_exact (fontstyle_name, weight)
end
if not style then
if prefmodifiers then
- style = choose_exact (prefmodifiers)
+ style = choose_exact (prefmodifiers, weight)
elseif subfamily then
- style = choose_exact (subfamily)
+ style = choose_exact (subfamily, weight)
end
end
-- if not style and splitstyle then
@@ -2628,7 +2637,8 @@ local collect_families = function (mappings)
local modifier = pick_style (fontstyle_name,
prefmodifiers,
subfamily,
- splitstyle)
+ splitstyle,
+ weight)
if not modifier then --- regular, exact only
modifier = check_regular (fontstyle_name,
diff --git a/luaotfload-parsers.lua b/luaotfload-parsers.lua
index 42a43aa..51d251c 100644
--- a/luaotfload-parsers.lua
+++ b/luaotfload-parsers.lua
@@ -56,6 +56,7 @@ local lfsisdir = lfs.isdir
local dot = P"."
local colon = P":"
+local semicolon = P";"
local comma = P","
local noncomma = 1 - comma
local slash = P"/"
@@ -476,7 +477,7 @@ local check_garbage = function (_,i, garbage)
return false
end
-local featuresep = comma
+local featuresep = comma + semicolon
--- modifiers ---------------------------------------------------------
--[[doc--
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 32086e1..5b7e0a2 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -88,21 +88,6 @@ end
require(loader_path)
---[[doc--
-Depending on how the script is called we change its behavior.
-For backwards compatibility, moving or symlinking the script to a
-file name starting with \fileent{mkluatexfontdb} will cause it to
-trigger a database update on every run.
-Running as \fileent{luaotfload-tool} -- the new name -- will do this upon
-request only.
-
-There are two naming conventions followed here: firstly that of
-utilities such as \fileent{mktexpk}, \fileent{mktexlsr} and the likes,
-and secondly that of \fileent{fmtutil}.
-After support for querying the database was added, the latter appeared
-to be the more appropriate.
---doc]]--
-
config = config or { }
local config = config
local luaotfloadconfig = config.luaotfload or { }