summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-08 00:48:36 +0000
committerKarl Berry <karl@freefriends.org>2010-06-08 00:48:36 +0000
commitbc4237aa7d632dca64332e75d8853f642523cb9d (patch)
tree8fb472e99bf7d4d1f591796f7ad6d7e7aec3c672 /Master/texmf-dist/tex/luatex
parent382d08439593ce35f62e6f2d132c13575a690e5b (diff)
luaotfload 1.10 (7jun10)
git-svn-id: svn://tug.org/texlive/trunk@18808 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua27
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty2
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua204
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua16
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-ovr.lua1
6 files changed, 148 insertions, 104 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
index bcf831d10f9..7396218ca4d 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.lua
@@ -20,8 +20,8 @@ module('luaotfload', package.seeall)
luaotfload.module = {
name = "luaotfload",
- version = 1.09,
- date = "2010/05/30",
+ version = 1.10,
+ date = "2010/06/07",
description = "ConTeXt font loading system.",
author = "Elie Roux & Hans Hagen",
copyright = "Elie Roux",
@@ -111,6 +111,27 @@ luaotfload.loadmodule('font-dum.lua')
luaotfload.loadmodule('font-nms.lua')
luaotfload.loadmodule('font-clr.lua')
+local function def_font(...)
+ local fontdata = fonts.define.read(...)
+ if type(fontdata) == "table" and fontdata.shared then
+ local capheight
+ local units = fontdata.units
+ local size = fontdata.size
+ local otfdata = fontdata.shared.otfdata
+
+ if otfdata.pfminfo.os2_capheight > 0 then
+ capheight = otfdata.pfminfo.os2_capheight/units*size
+ else
+ if fontdata.characters[string.byte("X")] then
+ capheight = fontdata.characters[string.byte("X")].height
+ else
+ capheight = otfdata.metadata.ascent/units*size
+ end
+ end
+ fontdata.parameters[8] = capheight
+ end
+ return fontdata
+end
fonts.mode = "node"
@@ -124,7 +145,7 @@ function luaotfload.register_callbacks()
'luaotfload.hpack_filter')
luatexbase.reset_callback('define_font')
luatexbase.add_to_callback('define_font',
- fonts.define.read,
+ def_font,
'luaotfload.define_font', 1)
luatexbase.add_to_callback('find_vf_file',
fonts.vf.find,
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty
index 4a1aa9d4559..c2bccfdcb51 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload.sty
@@ -24,7 +24,7 @@
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luaotfload}%
- [2010/05/30 v1.09 ConTeXt font loading system]
+ [2010/06/07 v1.10 ConTeXt font loading system]
\RequirePackage{luatextra}
\fi
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua
index e1f0faa4184..a6cf63ffc9f 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua
@@ -16,7 +16,7 @@ table.insert(fonts.triggers,"color")
function initializers.common.color(tfmdata,value)
if value then
- tfmdata.color = value
+ tfmdata.color = tostring(value)
add_color_callback()
end
end
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua
index 4050f266096..73a45c9dbf0 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua
@@ -38,7 +38,7 @@ local splitpath, expandpath = file.split_path, kpse.expand_path
local glob, basename = dir.glob, file.basename
local upper, lower, format = string.upper, string.lower, string.format
local gsub, match, rpadd = string.gsub, string.match, string.rpadd
-local gmatch, sub = string.gmatch, string.sub
+local gmatch, sub, find = string.gmatch, string.sub, string.find
local utfgsub = unicode.utf8.gsub
local trace_short = false --tracing adapted to rebuilding of the database inside a document
@@ -93,11 +93,10 @@ function names.load()
foundname = systempath
end
if data then
- logs.report("load font",
- "loaded font names database: %s", foundname)
+ logs.info("Font names database loaded: " .. foundname)
else
- logs.report("load font",
- "no font names database found, generating new one")
+ logs.info([[Font names database not found, generating new one.
+ This can take several minutes; please be patient.]])
data = names.update()
names.save(data)
end
@@ -128,24 +127,6 @@ local loaded = false
local reloaded = false
function names.resolve(specification)
- local tfm = resolvers.find_file(specification.name, "tfm")
- local ext = lower(file.extname(specification.name))
-
- if tfm then
- -- is a tfm font, skip names database
- if ext == 'tfm' then
- return specification.name, false
- else
- return specification.name..'.tfm', false
- end
- elseif resolvers.find_file(specification.name, "ofm") then
- if ext == 'ofm' then
- return specification.name, false
- else
- return specification.name..'.ofm', false
- end
- end
-
local name = sanitize(specification.name)
local style = sanitize(specification.style) or "regular"
@@ -165,28 +146,6 @@ function names.resolve(specification)
local data = names.data
if type(data) == "table" and data.version == names.version then
if data.mappings then
- -- if the specified name ends like a font file, we first look for
- -- it through kpse, and if we don't find it, we look for it in
- -- the database.
- if table.contains(font_extensions_lc, ext) then
- local fname = specification.name
- -- for absolute and relative path, kpse will find them, so
- -- there shouldn't be any problem
- local path = resolvers.find_file(fname, "opentype fonts")
- if not path then
- path = resolvers.find_file(fname, "truetype fonts")
- end
- if path then
- return path -- or fname ?
- else
- for _,face in ipairs(data.mappings) do
- if basename(face.filename[1]) == fname then
- return face.filename[1], face.filename[2]
- end
- end
- end
- return specification.name
- end
local found = { }
for _,face in ipairs(data.mappings) do
local family = sanitize(face.names.family)
@@ -230,8 +189,6 @@ function names.resolve(specification)
found[1] = face
break
end
- else
- found[1] = face
end
else
if name == fullname
@@ -437,9 +394,6 @@ local function load_font(filename, fontnames, newfontnames, texmf)
end
return
end
- if trace_loading then
- logs.report("loading font: %s", basefile)
- end
local info = fontloader.info(filename)
if info then
if type(info) == "table" and #info > 1 then
@@ -508,15 +462,9 @@ fonts.path_normalize = path_normalize
if os.name == "macosx" then
-- While Mac OS X 10.6 has a problem with TTC files, ignore them globally:
- font_extensions = {
- "otf", "ttf", "dfont", "OTF", "TTF", "DFONT"
- }
- font_extensions_lc = { "otf", "ttf", "dfont" }
+ font_extensions = { "otf", "ttf", "dfont" }
else
- font_extensions = {
- "otf", "ttf", "ttc", "dfont", "OTF", "TTF", "TTC", "DFONT"
- }
- font_extensions_lc = { "otf", "ttf", "ttc", "dfont" }
+ font_extensions = { "otf", "ttf", "ttc", "dfont" }
end
local function scan_dir(dirname, fontnames, newfontnames, texmf)
@@ -532,23 +480,28 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf)
if trace_search then
logs.report("scanning '%s'", dirname)
end
- for _,ext in ipairs(font_extensions) do
- found = glob(dirname .. "/**." .. ext)
- -- note that glob fails silently on broken symlinks, which happens
- -- sometimes in TeX Live.
- if trace_search then
- logs.report("%s '%s' fonts found", #found, ext)
+ for _,i in next, font_extensions do
+ for _,ext in next, { i, upper(i) } do
+ found = glob(format("%s/**.%s$", dirname, ext))
+ -- note that glob fails silently on broken symlinks, which happens
+ -- sometimes in TeX Live.
+ if trace_search then
+ logs.report("%s '%s' fonts found", #found, ext)
+ end
+ nbfound = nbfound + #found
+ table.append(list, found)
end
- nbfound = nbfound + #found
- table.append(list, found)
end
if trace_search then
logs.report("%d fonts found in '%s'", nbfound, dirname)
end
list = remove_ignore_fonts(list) -- fixme: general solution required
- for _,fnt in ipairs(list) do
- fnt = path_normalize(fnt)
- load_font(fnt, fontnames, newfontnames, texmf)
+ for _,file in next, list do
+ file = path_normalize(file)
+ if trace_loading then
+ logs.report("loading font: %s", file)
+ end
+ load_font(file, fontnames, newfontnames, texmf)
end
end
@@ -583,15 +536,15 @@ local function scan_texmf_fonts(fontnames, newfontnames)
--]]
if trace_progress then
if expandpath("$OSFONTDIR"):is_empty() then
- logs.report("scanning TEXMF fonts:")
+ logs.report("Scanning TEXMF fonts:")
else
- logs.report("scanning TEXMF and OS fonts:")
+ logs.report("Scanning TEXMF and OS fonts:")
end
elseif trace_short then
if expandpath("$OSFONTDIR"):is_empty() then
- logs.info("scanning TEXMF fonts...")
+ logs.info("Scanning TEXMF fonts...")
else
- logs.info("scanning TEXMF and OS fonts...")
+ logs.info("Scanning TEXMF and OS fonts...")
end
end
local fontdirs = expandpath("$OPENTYPEFONTS"):gsub("^\.", "")
@@ -625,26 +578,73 @@ end
The code is minimal, please report any error it may generate.
]]
-local function read_fonts_conf()
- local f = io.open("/etc/fonts/fonts.conf")
+local function read_fonts_conf(path, results)
+ local f = io.open(path)
if not f then
- error("Cannot open the file /etc/fonts/fonts.conf")
+ error("Cannot open the file "..path)
end
- local results = {}
local incomments = false
for line in f:lines() do
- -- spaghetti code... hmmm...
- if incomments and sub(line, 1, 3) == '-->' then
- incomments = false
- elseif sub(line, 1, 4) == '<!--' then
- incomments = true
- else
- for dir in gmatch(line, '<dir>([^<]+)</dir>') do
- -- now we need to replace ~ by kpse.expand_path('~')
- if sub(dir, 1, 1) == '~' then
- dir = kpse.expand_path('~') .. sub(dir, 2)
+ while line and line ~= "" do
+ -- spaghetti code... hmmm...
+ if incomments then
+ local tmp = find(line, '-->')
+ if tmp then
+ incomments = false
+ line = sub(line, tmp+3)
+ else
+ line = nil
+ end
+ else
+ local tmp = find(line, '<!--')
+ local newline = line
+ if tmp then
+ -- for the analysis, we take everything that is before the
+ -- comment sign
+ newline = sub(line, 1, tmp-1)
+ -- and we loop again with the comment
+ incomments = true
+ line = sub(line, tmp+4)
+ else
+ -- if there is no comment start, the block after that will
+ -- end the analysis, we exit the while loop
+ line = nil
+ end
+ for dir in gmatch(newline, '<dir>([^<]+)</dir>') do
+ -- now we need to replace ~ by kpse.expand_path('~')
+ if sub(dir, 1, 1) == '~' then
+ dir = kpse.expand_path('~') .. sub(dir, 2)
+ end
+ -- we exclude paths with texmf in them, as they should be
+ -- found anyway
+ if not find(dir, 'texmf') then
+ results[#results+1] = dir
+ end
+ end
+ for include in gmatch(newline, '<include[^<]*>([^<]+)</include>') do
+ -- include here can be four things: a directory or a file,
+ -- in absolute or relative path.
+ if sub(include, 1, 1) == '~' then
+ include = kpse.expand_path('~') .. sub(include, 2)
+ -- First if the path is relative, we make it absolute:
+ elseif not lfs.isfile(include) and not lfs.isdir(include) then
+ include = file.join(file.dirname(path), include)
+ end
+ if lfs.isfile(include) then
+ -- maybe we should prevent loops here?
+ -- we exclude path with texmf in them, as they should
+ -- be found otherwise
+ read_fonts_conf(include, results)
+ elseif lfs.isdir(include) then
+ if sub(include, -1, 0) ~= "/" then
+ include = include.."/"
+ end
+ found = glob(include.."*.conf")
+ for _, f in ipairs(found) do
+ read_fonts_conf(f, results)
+ end
+ end
end
- results[#results+1] = dir
end
end
end
@@ -652,6 +652,9 @@ local function read_fonts_conf()
return results
end
+-- for testing purpose
+names.read_fonts_conf = read_fonts_conf
+
local function get_os_dirs()
if os.name == 'macosx' then
return {
@@ -664,7 +667,7 @@ local function get_os_dirs()
local windir = os.getenv("WINDIR")
return {windir..'\\Fonts',}
else
- return read_fonts_conf()
+ return read_fonts_conf("/etc/fonts/fonts.conf", {})
end
end
@@ -675,12 +678,12 @@ local function scan_os_fonts(fontnames, newfontnames)
- a static set of directories for Windows and MacOSX
--]]
if trace_progress then
- logs.report("scanning OS fonts:")
+ logs.report("Scanning OS fonts:")
elseif trace_short then
- logs.info("scanning OS fonts...")
+ logs.info("Scanning OS fonts...")
end
if trace_search then
- logs.info("searching in static system directories...")
+ logs.info("Searching in static system directories...")
end
count = 0
local os_dirs = get_os_dirs()
@@ -708,7 +711,7 @@ local function update_names(fontnames, force)
or fontnames.version ~= names.version then
fontnames = fontnames_init()
if trace_search then
- logs.report("no font names database or old one found, "
+ logs.report("No font names database or old one found; "
.."generating new one")
end
end
@@ -730,6 +733,19 @@ local function save_names(fontnames)
table.serialize(fontnames, true))
end
-names.scan = scan_dir
+local function scan_external_dir(dir)
+ local old_names, new_names
+ if loaded then
+ old_names = names.data
+ else
+ old_names = names.load()
+ loaded = true
+ end
+ new_names = table.copy(old_names)
+ scan_dir("zapfino", old_names, new_names)
+ names.data = new_names
+end
+
+names.scan = scan_external_dir
names.update = update_names
names.save = save_names
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua
index 10062deed95..c8bcd2214e6 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-xtx.lua
@@ -90,7 +90,6 @@ otf.tables = otf.tables or { }
otf.tables.defaults = {
dflt = {
- "calt",
"ccmp", "locl", "rlig", "liga", "clig",
"kern", "mark", "mkmk",
},
@@ -174,11 +173,10 @@ local function istrue (s) list[s] = true end
local function isfalse(s) list[s] = false end
local spaces = lpeg.P(" ")^0
--- ER: now accepting names like C:/program files/texlive/2009/...
-local namespec = (lpeg.R("az", "AZ") * lpeg.P(":"))^-1 * (1-lpeg.S("/:("))^1 -- was: (1-lpeg.S("/: ("))^0
+local namespec = (1-lpeg.S("/:("))^0 -- was: (1-lpeg.S("/: ("))^0
+local filespec = (lpeg.R("az", "AZ") * lpeg.P(":"))^-1 * (1-lpeg.S(":("))^1
local crapspec = spaces * lpeg.P("/") * (((1-lpeg.P(":"))^0)/isstyle) * spaces
--- ER: can't understand why the 'file:' thing doesn't work with fontnames starting by c:...
-local filename = (lpeg.P("file:")/isfile * (namespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isname * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]"))
+local filename = (lpeg.P("file:")/isfile * (filespec/thename)) + (lpeg.P("[") * lpeg.P(true)/isfile * (((1-lpeg.P("]"))^0)/thename) * lpeg.P("]"))
local fontname = (lpeg.P("name:")/isname * (namespec/thename)) + lpeg.P(true)/issome * (namespec/thename)
local sometext = (lpeg.R("az","AZ","09") + lpeg.S("+-."))^1
local truevalue = lpeg.P("+") * spaces * (sometext/istrue)
@@ -204,6 +202,14 @@ function fonts.define.specify.colonized(specification) -- xetex mode
list.optsize = nil
end
if list.name then
+ if resolvers.find_file(list.name, "tfm") then
+ list.lookup = "file"
+ list.name = list.name .. ".tfm"
+ elseif resolvers.find_file(list.name, "ofm") then
+ list.lookup = "file"
+ list.name = list.name .. ".ofm"
+ end
+
specification.name = list.name
list.name = nil
end
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-ovr.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-ovr.lua
index 20d2b73dafc..7bac97d0f7c 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-ovr.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-luat-ovr.lua
@@ -32,6 +32,7 @@ function logs.info(category,fmt,...)
else
write_nl(format("%s |",name))
end
+ io.flush()
end
function logs.simple(fmt,...)