Jean-Marc Lasgouttes wrote:

>>>>>> "Georg" == Georg Baum
>>>>>> <[EMAIL PROTECTED]>
>>>>>> writes:
> 
> Georg> The reason is that lyx_gui::font_available takes quite some
> Georg> time in the qt case. This is called several times from math
> Georg> initialization (initSymbols).
> 
> How do you know the time is spent there? The code in
> qfont_loader::available seems reasonable (except for the <int> instead
> of <bool> for the cache vectors).

Yes, it seems to be fast if the cache is used, but slow if a font is
serahced ro the first time. Here is wht I did:
I instrumented math_font_available() with some debug messages:

bool math_font_available(string & name)
{
        lyxerr[Debug::INIT] << "math_font_available font: '" << name << '\''
                << endl;
        LyXFont f;
        augmentFont(f, name);
        lyxerr[Debug::INIT] << "math_font_available (augmented)" << endl;

        // Do we have the font proper?
        if (lyx_gui::font_available(f)) {
                lyxerr[Debug::INIT] << "math_font_available finished (found)"
                        << endl;
                return true;
        }

        lyxerr[Debug::INIT] << "math_font_available trying to fake" << endl;
        // can we fake it?
        if (name == "eufrak") {
                name = "lyxfakefrak";
                lyxerr[Debug::INIT] << "math_font_available finished (found 
fake)"
                        << endl;
                return true;
        }

        lyxerr[Debug::MATHED]
                << "font " << name << " not available and I can't fake it"
                << endl;
        lyxerr[Debug::INIT] << "math_font_available finished (found nothing)"
                << endl;
        return false;
}

I can see a noticeable pause after the very first call to augmentFont (which
calls also lyx_gui::font_available if it is not initialized):

math_font_available font: 'cmr'
<wait ~ 2 sec>
math_font_available (augmented)
math_font_available finished (found)

and then a second time here:

math_font_available font: 'lyxsymbol'
math_font_available (augmented)
<wait ~ 2 sec>
math_font_available trying to fake
math_font_available finished (found nothing)

The rest scrolls by very fast. Of course all these debug messages (with
flush by endl) add some time too, I have now 6.3s overall execution time


Georg

Reply via email to