diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua | 101 |
1 files changed, 51 insertions, 50 deletions
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 5aadd7b4aaa..ac3f0ba0b79 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-nms.lua @@ -92,23 +92,9 @@ function names.load() end local synonyms = { - regular = { - normal = true, - roman = true, - plain = true, - book = true, - medium = true, - }, - italic = { - regularitalic = true, - normalitalic = true, - oblique = true, - slant = true, - }, - bolditalic = { - boldoblique = true, - boldslant = true, - }, + regular = { "normal", "roman", "plain", "book", "medium" }, + italic = { "regularitalic", "normalitalic", "oblique", "slant" }, + bolditalic = { "boldoblique", "boldslat" }, } local loaded = false @@ -164,7 +150,8 @@ function names.resolve(specification) found[1] = face break end - elseif synonyms[style] and synonyms[style][subfamily] then + elseif synonyms[style] and + table.contains(synonyms[style], subfamily) then if optsize then if dsnsize == size or (size > minsize and size <= maxsize) then @@ -177,8 +164,8 @@ function names.resolve(specification) found[1] = face break end - elseif subfamily == "regular" - or synonyms.regular[style] then + elseif subfamily == "regular" or + table.contains(synonyms.regular, subfamily) then found.fallback = face end else @@ -273,10 +260,18 @@ end local lastislog = 0 +function log(fmt, ...) + lastislog = 1 + texio.write_nl(format("luaotfload | %s", format(fmt,...))) + io.flush() +end + logs = logs or { } logs.report = logs.report or log logs.info = logs.info or log +local log = names.log + -- The progress bar local function progress(current, total) if trace_progress then @@ -355,6 +350,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") @@ -446,13 +448,35 @@ end 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" } -else - font_extensions = { "otf", "ttf", "ttc", "dfont" } +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 + line = line:strip() -- to get rid of lines like " % foo" + if line:find("^%%") or line:is_empty() then + -- comment or empty line + else + line = line:split("%")[1] + line = line:strip() + if trace_search then + logs.report("blacklisted file: %s", line) + end + blacklist[#blacklist+1] = line + end + end + end + end end +local font_extensions = { "otf", "ttf", "ttc", "dfont" } + local function scan_dir(dirname, fontnames, newfontnames, texmf) --[[ this function scans a directory and populates the list of fonts @@ -481,7 +505,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 @@ -491,30 +515,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 @@ -700,6 +700,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) |