Andre Poenitz a écrit :
On Sat, May 20, 2006 at 05:08:34PM +0200, Abdelrazak Younes wrote:
Index: src/frontends/qt3/qfont_loader.h
===================================================================
--- src/frontends/qt3/qfont_loader.h (revision 13887)
+++ src/frontends/qt3/qfont_loader.h (working copy)
@@ -83,10 +83,13 @@
/// Get font info (font + metrics) for the given LyX font.
QLFontInfo & fontinfo(LyXFont const & f) {
- QLFontInfo * & fi =
+ QLFontInfo * fi =
fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
- if (!fi)
+ if (!fi) {
fi = new QLFontInfo(f);
+
fontinfo_[f.family()][f.series()][f.realShape()][f.size()]
+ = fi;
+ }
return *fi;
}
Would you care to explain the difference between what has been there
and what you have now?
All I can see is that we suddenly evaluate
fontinfo_[f.family()][f.series()][f.realShape()][f.size()]
twice instead of once. Apart from taht it seems to be functionally
equivalent.
See my mail to JMarc...
if (not already created) i.e if (not in fontinfo_ table)
create it
store it in fontinfo_ table
end
Is it clearer now?
fontinfo_ is a 4 dimensional table, I have no idea if this kind of
memory model work but I am just reusing what was there. Besides
fontinfo_ is initialized to zero and was not filled in anywhere in the
old code so the if (!fi) was always true; hence a new QLFontInfo(f) at
each call of the method.
Abdel.
Andre'