Martin Vermeer a écrit :
On Sat, May 20, 2006 at 03:32:05PM +0200, Abdelrazak Younes wrote:
Abdelrazak Younes a écrit :
Martin Vermeer a écrit :

...
Hum, this code in "qfont_loader.C" looks suspicious:
______________________

        QLFontInfo & fontinfo(LyXFont const & f) {
                QLFontInfo * & fi =
fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
                if (!fi)
                        fi = new QLFontInfo(f);
                return *fi;
        }

private:
        /// BUTT ugly !
        QLFontInfo * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
______________________

Why the '&' in "QLFontInfo * & "?
If this is the cache your are talking about, I guess something is going wrong either in f.series(), f.realShape(), f.size() or in the fontinfo_ multi-dimensional table. Analysing the LyxFont class seems too big a task for a Saturday afternoon; even a rainy one...

It doesn't look to me that this is caching anything. Is it?

Martin Vermeer a écrit :
On Sat, May 20, 2006 at 03:32:05PM +0200, Abdelrazak Younes wrote:
Abdelrazak Younes a écrit :
Martin Vermeer a écrit :

...
Hum, this code in "qfont_loader.C" looks suspicious:
______________________

        QLFontInfo & fontinfo(LyXFont const & f) {
                QLFontInfo * & fi =
fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
                if (!fi)
                        fi = new QLFontInfo(f);
                return *fi;
        }

private:
        /// BUTT ugly !
        QLFontInfo * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
______________________

Why the '&' in "QLFontInfo * & "?
If this is the cache your are talking about, I guess something is going wrong either in f.series(), f.realShape(), f.size() or in the fontinfo_ multi-dimensional table. Analysing the LyxFont class seems too big a task for a Saturday afternoon; even a rainy one...

It doesn't look to me that this is caching anything. Is it?
Right, now I look at it, it should be something like this:

if (!fi)
        fi = new QLFontInfo(f);
        fontinfo_[f.family()][f.series()][f.realShape()][f.size()] = fi;
return *fi;


The table is the cache. Or maybe this caching is done somewhere else? I'll have a look at the qt3 version.

Abdel.

- Martin



- Martin


Reply via email to