summaryrefslogtreecommitdiff
path: root/otfl-font-nms.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-04-04 16:08:33 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-04-04 16:24:52 +0200
commitffd5d4830688ca36153885c0336d3e2090abe0ce (patch)
tree6eb8eef5a8b23d998ea51843bb8977c671e9a83c /otfl-font-nms.lua
parent7105951698c9a052f5bfad25a93c80728ae5e9e6 (diff)
downloadluaotfload-ffd5d4830688ca36153885c0336d3e2090abe0ce.tar.gz
Fix loading subfonts
Previously, we relied in the fact that origname contains the subfont in the form of |foo.otf(subfoo)| and that luatex would then load the right font, but this is not what the rest of the code expects and cause some bugs. We now return the filename and subfont properly (i.e.separately).
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r--otfl-font-nms.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index c057c07..dc8179b 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -10,7 +10,7 @@ fonts = fonts or { }
fonts.names = fonts.names or { }
local names = fonts.names
-names.version = 2.006 -- not the same as in context
+names.version = 2.007 -- not the same as in context
names.data = nil
names.path = {
basename = "otfl-names.lua",
@@ -83,7 +83,6 @@ function names.resolve(specification)
local psname = sanitize(face.names.psname)
local fontname = sanitize(face.fontname)
local pfullname = sanitize(face.fullname)
- local filename = face.filename
local optsize, dsnsize, maxsize, minsize
if #face.size > 0 then
optsize = face.size
@@ -136,8 +135,8 @@ function names.resolve(specification)
end
end
if #found == 1 then
- logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, found[1].filename)
- return found[1].filename, false
+ logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, found[1].filename[1])
+ return found[1].filename[1], found[1].filename[2]
elseif #found > 1 then
-- we found matching font(s) but not in the requested optical
-- sizes, so we loop through the matches to find the one with
@@ -152,8 +151,8 @@ function names.resolve(specification)
least = difference
end
end
- logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, closest.filename)
- return closest.filename, false
+ logs.report("load font", "font family='%s', subfamily='%s' found: %s", name, style, closest.filename[1])
+ return closest.filename[1], closest.filename[2]
else
return specification.name, false -- fallback to filename
end
@@ -238,7 +237,7 @@ local function font_fullinfo(filename, subfont, texmf)
t.fontname = m.fontname
t.fullname = m.fullname
t.familyname = m.familyname
- t.filename = texmf and basename(m.origname) or m.origname
+ t.filename = { texmf and basename(filename) or filename, subfont }
t.weight = m.pfminfo.weight
t.width = m.pfminfo.width
t.slant = m.italicangle
@@ -284,7 +283,7 @@ local function load_font(filename, fontnames, status, newfontnames, newstatus, t
newstatus[filename].index[#newstatus[filename].index+1] = #mappings
end
else
- local fullinfo = font_fullinfo(filename, nil, texmf)
+ local fullinfo = font_fullinfo(filename, false, texmf)
mappings[#mappings+1] = fullinfo
newstatus[filename].index[#newstatus[filename].index+1] = #mappings
end