summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luaotfload-database.lua2
-rw-r--r--luaotfload-features.lua35
-rw-r--r--tests/pln-subfont-1.tex6
3 files changed, 38 insertions, 5 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 8caa35b..4aa966a 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -562,8 +562,6 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con
local found = { }
local synonym_set = style_synonyms.set
for _,face in next, data.mappings do
- --- TODO we really should store those in dedicated
- --- .sanitized field
local family, subfamily, fullname, psname, fontname, pfullname
local facenames = face.sanitized
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index de7ff3f..b11bf22 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -431,6 +431,35 @@ local select_lookup = function (request)
end
end
+local supported = {
+ b = "bold",
+ i = "italic",
+ bi = "bolditalic",
+ aat = false,
+ icu = false,
+ gr = false,
+}
+
+local handle_slashed = function (modifiers)
+ local style, optsize
+ for i=1, #modifiers do
+ local mod = modifiers[i]
+ if supported[mod] then
+ style = supported[mod]
+ --elseif stringfind(v, "^s=") then
+ elseif stringsub(v, 1, 2) == "s=" then
+ local val = stringsub(v, 3)
+ optsize = val
+ elseif stylename == false then
+ report("log", 0,
+ "load", "unsupported font option: %s", v)
+ elseif not stringis_empty(v) then
+ style = stringgsub(v, "[^%a%d]", "")
+ end
+ end
+ return style, optsize
+end
+
--- spec -> spec
local handle_request = function (specification)
local request = lpegmatch(font_request,
@@ -443,6 +472,11 @@ local handle_request = function (specification)
specification.lookup = lookup or specification.lookup
end
+ if request.modifiers then
+ local style, optsize = handle_slashed(request.modifiers)
+ specification.style, specification.optsize = style, optsize
+ end
+
for n=1, #import_values do
local feat = import_values[n]
local newvalue = request.features[feat]
@@ -451,6 +485,7 @@ local handle_request = function (specification)
request.features[feat] = nil
end
end
+
--- The next line sets the “rand” feature to “random”; I haven’t
--- investigated it any further (luatex-fonts-ext), so it will
--- just stay here.
diff --git a/tests/pln-subfont-1.tex b/tests/pln-subfont-1.tex
index 4877682..fb8e1e7 100644
--- a/tests/pln-subfont-1.tex
+++ b/tests/pln-subfont-1.tex
@@ -1,12 +1,12 @@
\ifdefined\directlua\input luaotfload.sty\fi
-
+%% This requires the Cambria fonts from MS.
\directlua{
inspect(fontloader.info"cambria.ttc")
}
-
+%% Here we load both subfonts in the collection
+%% with the not-quite documented subfont syntax.
\font\subfontone="file:cambria.ttc(0)" at 42pt
\font\subfonttwo="file:cambria.ttc(1)" at 42pt
-
\subfontone foo bar baz \endgraf
\subfonttwo foo bar baz \endgraf
\bye