···
On 11/9/2013 6:45 PM, Philipp Gesang wrote:
Hi all,
calling fontloader.to_table() appears to be redundant when extracting font names, see the attached patch. On my system I measured 42 (patched) vs 59 (vanilla) seconds for rebuilding the entire index:
mtxrun --script fonts --reload --force
The resulting index is -- except for the uuid, naturally -- identical in both cases.
Okay.
In fact this fullinfo was meant as temporary hack because fontloader.info should return these values (and might at some time).
In the meantime delayed loading was introduced which is why:
function fontloader.fullinfo(...) -- lazy loading anyway local ff = fontloader.open(...) if ff then return ff else return nil, "error in loading font" end end
also could work ok (in fact, the explicit glyphs = nil in the current variant assumes the old loader and has the speed impact you notice because it now first loads all glyphs and next discards them)
Okay, in practice we need something like this:
function fontloader.fullinfo(...) -- lazy loading anyway local ff = fontloader.open(...) if ff then local d = { } -- ff is userdata so [1] or # fails on it setmetatable(d, { __index = ff }) return d else return nil, "error in loading font" end end
Aren’t you allocating fonts without freeing them? With this approach you need fontloader.close() somewhere inside check_names() which isn’t straightforward if you hide the font data inside the metatable. Btw. calling fontloader.info() first yields a table for ttcs and is unnoticable performance-wise. Best, Philipp