-#if defined(USE_LYX_FONTCACHE)
- typedef std::map<Uchar, int> WidthCache;
- /// Cache of char widths
- WidthCache widthcache;
-#endif
-};
-
-
-/// Hold info about a particular font
-class GuiFontLoader: public FontLoader
-{
-public:
- ///
- GuiFontLoader();
-
- /// Destructor
- virtual ~GuiFontLoader();
-
- /// Update fonts after zoom, dpi, font names, or norm change
- virtual void update();
-
- /// Do we have anything matching?
- virtual bool available(LyXFont const & f);
-
- /// Get the QFont for this LyXFont
- QFont const & get(LyXFont const & f) {
- return fontinfo(f).font;
- }
-
- /// Get the QFont metrics for this LyXFont
- QFontMetrics const & metrics(LyXFont const & f) {
- return fontinfo(f).metrics;
- }
-
- /// Get font info (font + metrics) for the given LyX font.
- QLFontInfo & fontinfo(LyXFont const & f) {
- // fi is a reference to the pointer type (QLFontInfo *) in the
- // fontinfo_ table.
- QLFontInfo * & fi =
- fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
- if (!fi)
- fi = new QLFontInfo(f);
- return *fi;
- }