diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua index 5c2d13df00f..f26c872734e 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua @@ -4,7 +4,7 @@ ----------------------------------------------------------------------- assert(luaotfload_module, "This is a part of luaotfload and should not be loaded independently") { name = "luaotfload-harf-plug", - version = "3.27", --TAGVERSION + version = "3.28", --TAGVERSION date = "2024-02-14", --TAGDATE description = "luaotfload submodule / HarfBuzz shaping", license = "GPL v2.0", @@ -23,8 +23,10 @@ local format = string.format local open = io.open local tableinsert = table.insert local tableremove = table.remove -local ostmpname = os.tmpname +local ostmpdir = os.tmpdir local osremove = os.remove +local dir = lfs.dir +local rmdir = lfs.rmdir local direct = node.direct local tonode = direct.tonode @@ -704,13 +706,17 @@ end -- Cache of color glyph PNG data for bookkeeping, only because I couldn't -- figure how to make the engine load the image from the binary data directly. +local tmpdirname +local tmpcount = 0 local pngcache = {} local pngcachefiles = {} local function cachedpng(data) local hash = md5.sumhexa(data) local i = pngcache[hash] if not i then - local path = ostmpname() + tmpdirname = tmpdirname or ostmpdir() + tmpcount = tmpcount + 1 + local path = format('%s/%i.png', tmpdirname, tmpcount) pngcachefiles[#pngcachefiles + 1] = path open(path, "wb"):write(data):close() -- local file = open(path, "wb"):write():close() @@ -1106,9 +1112,14 @@ end local function run_cleanup() -- Remove temporary PNG files that we created, if any. -- FIXME: It would be nice if we wouldn't need this - for _, path in next, pngcachefiles do - osremove(path) + if not tmpdirname then return end + for file in dir(tmpdirname) do + if file ~= '.' and file ~= '..' then + assert(osremove(format('%s/%s', tmpdirname, file))) + end end + assert(rmdir(tmpdirname)) + tmpdirname = nil end local function set_tounicode() |