summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2011-10-01 18:21:46 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2011-10-01 18:21:46 +0200
commitfefa84ef5bb84934f5e210624a03b977245af633 (patch)
tree0e1be7572d9576ffcd941f6c50fe20ccf05d40c2
parentd82976c0549baf895b9720d633c231ace492b756 (diff)
parentba68760ae19267de980f4c1856c280f6db8a379b (diff)
downloadluaotfload-fefa84ef5bb84934f5e210624a03b977245af633.tar.gz
Merge branch 'master' into unstable
-rw-r--r--NEWS6
-rw-r--r--luaotfload.dtx25
-rwxr-xr-xmkluatexfontdb.lua3
-rw-r--r--otfl-blacklist.cnf39
-rw-r--r--otfl-font-nms.lua107
5 files changed, 132 insertions, 48 deletions
diff --git a/NEWS b/NEWS
index ee579ed..42e6e14 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,12 @@
Change History
--------------
+2011/04/21, luaotfload v1.25:
+ * Fix bug loading *.dfont fonts
+ * Misc. documentation fixes
+ * Fix the need to manually delete font cache when feature file is changed
+ * Hack to support Demi fonts
+
2011/02/16, luaotfload v1.24:
* Fix infinite loop first time creating a name list
diff --git a/luaotfload.dtx b/luaotfload.dtx
index c6386f0..36f403f 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -36,7 +36,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: luaotfload v1.24 OpenType layout system}
+\Msg{* Package: luaotfload v1.25 OpenType layout system}
\Msg{************************************************************************}
\keepsilent
@@ -104,7 +104,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luaotfload.drv}%
- [2011/02/16 v1.24 OpenType layout system]%
+ [2011/04/21 v1.25 OpenType layout system]%
\documentclass{ltxdoc}
\usepackage{metalogo,multicol,mdwlist,fancyvrb,xcolor,xspace}
\usepackage[
@@ -166,7 +166,7 @@ and the derived files
% \GetFileInfo{luaotfload.drv}
%
% \title{The \textsf{luaotfload} package}
-% \date{2011/02/16 v1.24}
+% \date{2011/04/21 v1.25}
% \author{Elie Roux and Khaled Hosny\\
% Support: \email{lualatex-dev@tug.org}}
%
@@ -379,7 +379,18 @@ and the derived files
% Simply, create a file named |otfl-blacklist.cnf| and added the to be
% blacklisted files, one per line. Then put the file some where \textsf{kpse}
% can find. You can either use the base name or the full path. Any thing after
-% a |%| sign is ignored.
+% a |%| sign is ignored. \textsf{luaotfload} reads all files named named
+% |otfl-blacklist.cnf|, so you can add your own fonts to the global blacklist
+% by creating a local file |otfl-blacklist.cnf| with the entries you need.
+% You can also remove a font from this blacklist by prepending the name with
+% a dash (|-|).
+%
+% \begin{verbatim}
+% % example otf-blacklist.cnf
+% /Library/Fonts/GillSans.ttc % luaotfload ignores this font
+% -/Library/Fonts/Optima.ttc % it is usable again, even if it
+% % is blacklisted somewhere else
+% \end{verbatim}
%
% \section{Required \context files}
%
@@ -452,8 +463,8 @@ module("luaotfload", package.seeall)
luaotfload.module = {
name = "luaotfload",
- version = 1.24,
- date = "2011/02/16",
+ version = 1.25,
+ date = "2011/04/21",
description = "OpenType layout system.",
author = "Elie Roux & Hans Hagen",
copyright = "Elie Roux",
@@ -700,7 +711,7 @@ luatexbase.add_to_callback("find_vf_file",
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luaotfload}%
- [2011/02/16 v1.24 OpenType layout system]
+ [2011/04/21 v1.25 OpenType layout system]
\RequirePackage{luatexbase}
\fi
diff --git a/mkluatexfontdb.lua b/mkluatexfontdb.lua
index 553332d..99d1552 100755
--- a/mkluatexfontdb.lua
+++ b/mkluatexfontdb.lua
@@ -89,8 +89,9 @@ end
local function generate(force)
local fontnames, saved
fontnames = names.update(fontnames, force)
- logs.report("%s fonts in the database", #fontnames.mappings)
+ logs.report("fonts in the database", "%i", #fontnames.mappings)
saved = names.save(fontnames)
+ texio.write_nl("")
end
process_cmdline()
diff --git a/otfl-blacklist.cnf b/otfl-blacklist.cnf
index f77de5b..771649b 100644
--- a/otfl-blacklist.cnf
+++ b/otfl-blacklist.cnf
@@ -1,22 +1,23 @@
-% Tackes ages to load
+% Takes ages to load
LastResort.ttf % a MacOSX font, but also available for free from unicode.org
% Mac OS X TTC fonts, this list need to be filtered out
-/Library/Fonts/AmericanTypewriter.ttc
-/Library/Fonts/Baskerville.ttc
-/Library/Fonts/Chalkboard.ttc
-/Library/Fonts/Cochin.ttc
-/Library/Fonts/Copperplate.ttc
-/Library/Fonts/Didot.ttc
-/Library/Fonts/Futura.ttc
-/Library/Fonts/GillSans.ttc
-/Library/Fonts/Hoefler Text.ttc
-/Library/Fonts/MarkerFelt.ttc
-/Library/Fonts/Optima.ttc
-/Library/Fonts/Papyrus.ttc
-/Library/Fonts/STHeiti Medium.ttc
-/System/Library/Fonts/AquaKana.ttc
-/System/Library/Fonts/HelveticaNeue.ttc
-/System/Library/Fonts/LucidaGrande.ttc
-/System/Library/Fonts/Menlo.ttc
-/System/Library/Fonts/STHeiti Light.ttc
+% luatex bug fixed?
+% /Library/Fonts/AmericanTypewriter.ttc
+% /Library/Fonts/Baskerville.ttc
+% /Library/Fonts/Chalkboard.ttc
+% /Library/Fonts/Cochin.ttc
+% /Library/Fonts/Copperplate.ttc
+% /Library/Fonts/Didot.ttc
+% /Library/Fonts/Futura.ttc
+% /Library/Fonts/GillSans.ttc
+% /Library/Fonts/Hoefler Text.ttc
+% /Library/Fonts/MarkerFelt.ttc
+% /Library/Fonts/Optima.ttc
+% /Library/Fonts/Papyrus.ttc
+% /Library/Fonts/STHeiti Medium.ttc
+% /System/Library/Fonts/AquaKana.ttc
+% /System/Library/Fonts/HelveticaNeue.ttc
+% /System/Library/Fonts/LucidaGrande.ttc
+% /System/Library/Fonts/Menlo.ttc
+% /System/Library/Fonts/STHeiti Light.ttc
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 2ad6898..6e8b8be 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -19,9 +19,21 @@ names.path = {
systemdir = file.join(kpse.expand_var("$TEXMFSYSVAR"), names_dir),
}
+local success = pcall(require, "luatexbase.modutils")
+if success then
+ success = pcall(luatexbase.require_module, "lualatex-platform", "2011/03/30")
+end
+local get_installed_fonts
+if success then
+ get_installed_fonts = lualatex.platform.get_installed_fonts
+else
+ function get_installed_fonts()
+ end
+end
local splitpath, expandpath = file.split_path, kpse.expand_path
local glob, basename = dir.glob, file.basename
+local extname = file.extname
local upper, lower, format = string.upper, string.lower, string.format
local gsub, match, rpadd = string.gsub, string.match, string.rpadd
local gmatch, sub, find = string.gmatch, string.sub, string.find
@@ -64,13 +76,14 @@ local function load_names()
foundname = systempath
end
if data then
- logs.info("Font names database loaded: " .. foundname)
+ logs.info("Font names database loaded", "%s", foundname)
else
logs.info([[Font names database not found, generating new one.
This can take several minutes; please be patient.]])
data = names.update(fontnames_init())
names.save(data)
end
+ texio.write_nl("")
return data
end
@@ -239,9 +252,15 @@ end
local lastislog = 0
-local function log(fmt, ...)
+local function log(category, fmt, ...)
lastislog = 1
- texio.write_nl(format("luaotfload | %s", format(fmt,...)))
+ if fmt then
+ texio.write_nl(format("luaotfload | %s: %s", category, format(fmt, ...)))
+ elseif category then
+ texio.write_nl(format("luaotfload | %s", category))
+ else
+ texio.write_nl(format("luaotfload |"))
+ end
io.flush()
end
@@ -254,7 +273,7 @@ local function font_fullinfo(filename, subfont, texmf)
local f = fontloader.open(filename, subfont)
if not f then
if trace_loading then
- logs.report("error: failed to open %s", filename)
+ logs.report("error", "failed to open %s", filename)
end
return
end
@@ -286,7 +305,7 @@ local function font_fullinfo(filename, subfont, texmf)
else
-- no names table, propably a broken font
if trace_loading then
- logs.report("broken font rejected: %s", basefile)
+ logs.report("broken font rejected", "%s", basefile)
end
return
end
@@ -313,10 +332,10 @@ local function load_font(filename, fontnames, newfontnames, texmf)
local status = fontnames.status
local basefile = texmf and basename(filename) or filename
if filename then
- if table.contains(names.blacklist, filename) or
- table.contains(names.blacklist, basename(filename)) then
+ if names.blacklist[filename] or
+ names.blacklist[basename(filename)] then
if trace_search then
- logs.report("ignoring font '%s'", filename)
+ logs.report("ignoring font", "%s", filename)
end
return
end
@@ -341,7 +360,7 @@ local function load_font(filename, fontnames, newfontnames, texmf)
newstatus[basefile].index[index+1] = #newmappings
end
if trace_loading then
- logs.report("font already indexed: %s", basefile)
+ logs.report("font already indexed", "%s", basefile)
end
return
end
@@ -378,7 +397,7 @@ local function load_font(filename, fontnames, newfontnames, texmf)
end
else
if trace_loading then
- logs.report("failed to load %s", basefile)
+ logs.report("failed to load", "%s", basefile)
end
end
end
@@ -423,6 +442,7 @@ local function read_blacklist()
kpse.lookup("otfl-blacklist.cnf", {all=true, format="tex"})
}
local blacklist = names.blacklist
+ local whitelist = { }
if files and type(files) == "table" then
for _,v in next, files do
@@ -433,17 +453,60 @@ local function read_blacklist()
else
line = line:split("%")[1]
line = line:strip()
- if trace_search then
- logs.report("blacklisted file: %s", line)
+ if string.sub(line,1,1) == "-" then
+ whitelist[string.sub(line,2,-1)] = true
+ else
+ if trace_search then
+ logs.report("blacklisted file", "%s", line)
+ end
+ blacklist[line] = true
end
- blacklist[#blacklist+1] = line
end
end
end
end
+ for fontname,_ in pairs(whitelist) do
+ blacklist[fontname] = nil
+ end
end
local font_extensions = { "otf", "ttf", "ttc", "dfont" }
+local font_extensions_set = {}
+for key, value in ipairs(font_extensions) do
+ font_extensions_set[value] = true
+end
+
+local installed_fonts_scanned = false
+
+local function scan_installed_fonts(fontnames, newfontnames)
+ -- Try to query and add font list from operating system.
+ -- This uses the lualatex-platform module.
+ logs.info("Scanning fonts known to operating system...")
+ local fonts = get_installed_fonts()
+ if fonts and #fonts > 0 then
+ installed_fonts_scanned = true
+ if trace_search then
+ logs.report("operating system fonts found", "%d", #fonts)
+ end
+ for key, value in ipairs(fonts) do
+ local file = value.path
+ if file then
+ local ext = extname(file)
+ if ext and font_extensions_set[ext] then
+ file = path_normalize(file)
+ if trace_loading then
+ logs.report("loading font", "%s", file)
+ end
+ load_font(file, fontnames, newfontnames, false)
+ end
+ end
+ end
+ else
+ if trace_search then
+ logs.report("Could not retrieve list of installed fonts")
+ end
+ end
+end
local function scan_dir(dirname, fontnames, newfontnames, texmf)
--[[
@@ -456,7 +519,7 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf)
local list, found = { }, { }
local nbfound = 0
if trace_search then
- logs.report("scanning '%s'", dirname)
+ logs.report("scanning", "%s", dirname)
end
for _,i in next, font_extensions do
for _,ext in next, { i, upper(i) } do
@@ -464,20 +527,20 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf)
-- 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)
+ logs.report("fonts found", "%s '%s' fonts found", #found, ext)
end
nbfound = nbfound + #found
table.append(list, found)
end
end
if trace_search then
- logs.report("%d fonts found in '%s'", nbfound, dirname)
+ logs.report("fonts found", "%d fonts found in '%s'", nbfound, dirname)
end
for _,file in next, list do
file = path_normalize(file)
if trace_loading then
- logs.report("loading font: %s", file)
+ logs.report("loading font", "%s", file)
end
load_font(file, fontnames, newfontnames, texmf)
end
@@ -629,7 +692,7 @@ local function update_names(fontnames, force)
- fontnames is the final table to return
- force is whether we rebuild it from scratch or not
]]
- logs.info("Updating the font names database:")
+ logs.info("Updating the font names database")
if force then
fontnames = fontnames_init()
@@ -647,8 +710,10 @@ local function update_names(fontnames, force)
end
local newfontnames = fontnames_init()
read_blacklist()
+ installed_font_scanned = false
+ scan_installed_fonts(fontnames, newfontnames)
scan_texmf_fonts(fontnames, newfontnames)
- if expandpath("$OSFONTDIR"):is_empty() then
+ if not installed_fonts_scanned and expandpath("$OSFONTDIR"):is_empty() then
scan_os_fonts(fontnames, newfontnames)
end
return newfontnames
@@ -662,10 +727,10 @@ local function save_names(fontnames)
savepath = file.join(savepath, names.path.basename)
if file.iswritable(savepath) then
table.tofile(savepath, fontnames, true)
- logs.info("Font names database saved: %s \n", savepath)
+ logs.info("Font names database saved", "%s", savepath)
return savepath
else
- logs.info("Failed to save names database\n")
+ logs.info("Failed to save names database")
return nil
end
end