]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiFontLoader.h
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiFontLoader.h
index b3128361a38fbe4deeaace0bc4ef7953fd11c8da..b48bfd4cfd18351dd84d92c4d2b59304ac2c69cf 100644 (file)
 
 #include "frontends/FontLoader.h"
 
+#include "FontInfo.h"
+
 #include "GuiFontMetrics.h"
 
 #include "Encoding.h"
-#include "Font.h"
 
 #include <QFont>
 
-#include <boost/scoped_ptr.hpp>
+#include <boost/assert.hpp>
 
 namespace lyx {
 namespace frontend {
@@ -33,12 +34,12 @@ namespace frontend {
 class GuiFontInfo
 {
 public:
-       GuiFontInfo(Font const & f);
+       GuiFontInfo(FontInfo const & f);
 
        /// The font instance
        QFont font;
        /// Metrics on the font
-       boost::scoped_ptr<GuiFontMetrics> metrics;
+       GuiFontMetrics metrics;
 };
 
 
@@ -50,22 +51,26 @@ public:
        GuiFontLoader();
 
        /// Destructor
-       virtual ~GuiFontLoader() {}
+       virtual ~GuiFontLoader();
 
        virtual void update();
-       virtual bool available(Font const & f);
-       inline virtual FontMetrics const & metrics(Font const & f) {
-               return *fontinfo(f).metrics.get();
+       virtual bool available(FontInfo const & f);
+       inline virtual FontMetrics const & metrics(FontInfo const & f) {
+               return fontinfo(f).metrics;
        }
 
-       /// Get the QFont for this Font
-       QFont const & get(Font const & f) {
+       /// Get the QFont for this FontInfo
+       QFont const & get(FontInfo const & f) {
                return fontinfo(f).font;
        }
 
 
        /// Get font info (font + metrics) for the given LyX font.
-       GuiFontInfo & fontinfo(Font const & f) {
+       GuiFontInfo & fontinfo(FontInfo const & f) {
+               BOOST_ASSERT(f.family() < NUM_FAMILIES);
+               BOOST_ASSERT(f.series() < 2);
+               BOOST_ASSERT(f.realShape() < 4);
+               BOOST_ASSERT(f.size() < 10);
                // fi is a reference to the pointer type (GuiFontInfo *) in the
                // fontinfo_ table.
                GuiFontInfo * & fi =
@@ -77,7 +82,7 @@ public:
 
 private:
        /// BUTT ugly !
-       GuiFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10];
+       GuiFontInfo * fontinfo_[NUM_FAMILIES][2][4][10];
 };