Abdelrazak Younes a écrit :
Abdelrazak Younes a écrit :
Martin Vermeer a écrit :
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.

There is no caching either in qt3. I guess we've found a nice optimisation to do :-)
I'll send a patch soon!

Font caching was not done in qt3 and qt4, this patch fixes this. Please test on linux/qt[34] and Mac/qt[34]

Abdel.
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;
        }
 
Index: src/frontends/qt4/qfont_loader.h
===================================================================
--- src/frontends/qt4/qfont_loader.h    (revision 13887)
+++ src/frontends/qt4/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;
        }
 

Reply via email to