]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt3/qfont_loader.h
This commit introduces the FontLoader interface class. In the future, I intend to...
[lyx.git] / src / frontends / qt3 / qfont_loader.h
index 9c52c0c996e24ae83df13ce82cfc03779d6b8fca..d18e729ca8d88a3bfbc6d54ed7cd2e9b741196c0 100644 (file)
 #ifndef QFONTLOADER_H
 #define QFONTLOADER_H
 
+#include "frontends/FontLoader.h"
+
 #include "encoding.h"
 #include "lyxfont.h"
 
 #include <qfont.h>
 #include <qfontmetrics.h>
 
-#if QT_VERSION < 0x030100
+#if QT_VERSION < 0x030100 || defined(Q_WS_MACX)
 #define USE_LYX_FONTCACHE
 #endif
 
@@ -35,7 +37,7 @@ public:
        QLFontInfo(LyXFont const & f);
 
        /// Return pixel width for the given unicode char
-       int width(Uchar val) const;
+       int width(Uchar val);
 
        /// The font instance
        QFont font;
@@ -51,16 +53,19 @@ public:
 
 
 /// Hold info about a particular font
-class FontLoader {
+class GuiFontLoader: public lyx::frontend::FontLoader {
 public:
        ///
-       FontLoader();
+       GuiFontLoader();
+       
+       /// Destructor
+       virtual ~GuiFontLoader();
 
        /// Update fonts after zoom, dpi, font names, or norm change
-       void update();
+       virtual void update();
 
        /// Do we have anything matching?
-       bool available(LyXFont const & f);
+       virtual bool available(LyXFont const & f);
 
        /// Get the QFont for this LyXFont
        QFont const & get(LyXFont const & f) {
@@ -72,14 +77,13 @@ public:
                return fontinfo(f).metrics;
        }
 
-       /// Called before QApplication is initialized
-       static void initFontPath();
-
        /// Called the first time when available() can't load a symbol font
        static void addToFontPath();
 
        /// 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)
@@ -92,6 +96,6 @@ private:
        QLFontInfo * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
 };
 
-extern FontLoader fontloader;
+extern GuiFontLoader fontloader;
 
 #endif // QFONT_LOADER_H