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

because I check for [1] or # in case of a ttc font which fails on the ff userdata table. This variant is somewhat more in tune with the 'full' aspect.

Thanks for noticing,

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to