On Tue, Dec 10, 2002 at 03:01:36AM +0000, John Levon wrote: > > Unless somebody has major complaints I'm going to commit it ...
What happens when the user changes the font in the preferences dialog ? If I'm not mistaken, the cache will not be cleared. One solution (other than cleaning the cache) is to store (qfont_loader::font_info const *, int) pairs instead of (LyXFont, int) pairs. This might also give a little speedups as comparing LyXFonts is slower than comparing pointers. Another possible optimization is to move the matched pair to the beginning of the metric list if its position in the list is more than 3. BTW, why is QFontMetrics::width so slow ? If you can find a way to speed it up it would be better than the caching hack.