On 2025-01-20 at 15:26:47 +0100, Petr Olsak wrote:
> Thank you very much for testing.
>
> I didn't use such tools. I am watching the terminal when fonts are
> downloaded (at the end of the document) and I notice the delay per
> each Besley fonts downloaded from ~/texmf. Sure, it is
> observable. It looks like waiting for some kind of time limit.
>
> Unfortunately, questions remains: why behavior of Lua garbage
> collector differs in luatex and luahbtex when the programs have to
> do the same?
>
> When we copy the fonts from ~/texmf/fonts to current directory:
>
> cp ~/texmf/fonts/opentype/besley/* .
>
> and run the test, then the unwanted delay with luahbtex
> disappears. It seems that this has something to do with file
> searching from TeXmf tree. Garbage collector behavior differs when
> files are in in different locations?
To trace file searching you can set the environment variable
KPATHSEA_DEBUG=32
We can use the debug library
\directlua{local oldgc=collectgarbage; collectgarbage("stop"); function collectgarbage(...); print(...); print(debug.traceback()); end}
\fontfam[catalog]
\bye
but the debug library must be enabled at command line:
luahbtex --luadebug
One message looks suspicious, because it's "harf"
stack traceback:
[\directlua]:1: in function 'collectgarbage'
...mf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua:542: in function <...mf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua:539>
(...tail calls...)
luaotfload-harf-define.lua
539 luatexbase.add_to_callback('glyph_stream_provider', function(fid, cid, kind, ocid)
540 if cid == 0 then -- Always the first call for a font
541 glyph_stream_data, extents_hbfont = nil
542 collectgarbage()
543 local fontdir = font.getfont(fid)
544 if fontdir and fontdir.hb then
545 if kind == 3 then
and if we comment line 542, we have the same as luatex.
--
luigi