diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-07-02 14:53:44 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-07-02 14:53:44 +0200 |
commit | e46b1ade1a0b4cabec661aa0f505efd03b9bdc5a (patch) | |
tree | 94e705e1861718844e983f8ec372cd6824775937 | |
parent | b4fdea433f1949238fca34af9ba2a8b332e992a4 (diff) | |
download | luaotfload-e46b1ade1a0b4cabec661aa0f505efd03b9bdc5a.tar.gz |
limit font cache controls to actual font cache dir
-rw-r--r-- | luaotfload-database.lua | 18 | ||||
-rw-r--r-- | luaotfload-override.lua | 5 |
2 files changed, 19 insertions, 4 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 9eb5b1f..4755396 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -2006,9 +2006,21 @@ local collect_cache collect_cache = function (path, all, n, luanames, return luanames, lucnames, rest, all end +local getfontcachepath = function ( ) + --- fonts.handlers.otf doesn’t exist outside a Luatex run, + --- so we have to improvise + local writable = caches.getwritablepath () + if writable then + writable = writable .. "/fonts" + if lfsisdir (writable) then + return writable + end + end +end + --- unit -> unit local purge_cache = function ( ) - local writable_path = caches.getwritablepath() + local writable_path = getfontcachepath () local luanames, lucnames, rest = collect_cache(writable_path) if logs.get_loglevel() > 1 then print_cache("writable path", writable_path, luanames, lucnames, rest) @@ -2019,7 +2031,7 @@ end --- unit -> unit local erase_cache = function ( ) - local writable_path = caches.getwritablepath() + local writable_path = getfontcachepath () local luanames, lucnames, rest, all = collect_cache(writable_path) if logs.get_loglevel() > 1 then print_cache("writable path", writable_path, luanames, lucnames, rest) @@ -2035,7 +2047,7 @@ end --- unit -> unit local show_cache = function ( ) local readable_paths = caches.getreadablepaths() - local writable_path = caches.getwritablepath() + local writable_path = getfontcachepath () local luanames, lucnames, rest = collect_cache(writable_path) separator() diff --git a/luaotfload-override.lua b/luaotfload-override.lua index caf3627..225ac68 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -106,7 +106,10 @@ end stdout = function (category, ...) local res = { module_name, "|", category, ":" } - if select("#", ...) == 1 then + local nargs = select("#", ...) + if nargs == 0 then + writeln (tableconcat ({...})) + elseif nargs == 1 then res[#res+1] = select(1, ...) -- around 30% faster than unpack() else res[#res+1] = stringformat(...) |