summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--otfl-blacklist.cnf2
-rw-r--r--otfl-font-nms.lua58
3 files changed, 36 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 0dbcb17..ddf2f45 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
NAME = luaotfload
DOC = $(NAME).pdf
DTX = $(NAME).dtx
-OTFL = $(wildcard otfl-*.lua)
+OTFL = $(wildcard otfl-*.lua) otfl-blacklist.cnf
SCRIPT = mkluatexfontdb.lua
# Files grouped by generation mode
diff --git a/otfl-blacklist.cnf b/otfl-blacklist.cnf
new file mode 100644
index 0000000..d9cf068
--- /dev/null
+++ b/otfl-blacklist.cnf
@@ -0,0 +1,2 @@
+% Tackes ages to load
+LastResort.ttf
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 7abc62b..53e66d2 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -362,6 +362,13 @@ 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 trace_search then
+ logs.report("ignoring font '%s'", filename)
+ end
+ return
+ end
local timestamp, db_timestamp
db_timestamp = status[basefile] and status[basefile].timestamp
timestamp = lfs.attributes(filename, "modification")
@@ -460,6 +467,30 @@ else
font_extensions = { "otf", "ttf", "ttc", "dfont" }
end
+names.blacklist = { }
+
+local function read_blacklist()
+ local files = {
+ kpse.lookup("otfl-blacklist.cnf", {all=true, format="tex"})
+ }
+ local blacklist = names.blacklist
+
+ if files and type(files) == "table" then
+ for _,v in next, files do
+ for line in io.lines(v) do
+ if line:find("^%%") or line:is_empty() then
+ -- comment or empty line
+ else
+ if trace_search then
+ logs.report("blacklisted file: %s", line)
+ end
+ blacklist[#blacklist+1] = line
+ end
+ end
+ end
+ end
+end
+
local function scan_dir(dirname, fontnames, newfontnames, texmf)
--[[
this function scans a directory and populates the list of fonts
@@ -488,7 +519,7 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf)
if trace_search then
logs.report("%d fonts found in '%s'", nbfound, dirname)
end
- list = remove_ignore_fonts(list) -- fixme: general solution required
+
for _,file in next, list do
file = path_normalize(file)
if trace_loading then
@@ -498,30 +529,6 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf)
end
end
--- Temporary until a general solution is implemented:
-if os.name == "macosx" then
- ignore_fonts = {
- -- this font kills the indexer:
- "/System/Library/Fonts/LastResort.ttf"
- }
- function remove_ignore_fonts(fonts)
- for N,fnt in ipairs(fonts) do
- if table.contains(ignore_fonts,fnt) then
- if trace_search then
- logs.report("ignoring font '%s'", fnt)
- end
- table.remove(fonts,N)
- end
- end
- return fonts
- end
--- This function is only necessary, for now, on Mac OS X.
-else
- function remove_ignore_fonts(fonts)
- return fonts
- end
-end
-
local function scan_texmf_fonts(fontnames, newfontnames)
--[[
The function that scans all fonts in the texmf tree, through kpathsea
@@ -707,6 +714,7 @@ local function update_names(fontnames, force)
end
end
local newfontnames = fontnames_init()
+ read_blacklist()
scan_texmf_fonts(fontnames, newfontnames)
if expandpath("$OSFONTDIR"):is_empty() then
scan_os_fonts(fontnames, newfontnames)