3 * \file GuiFontLoader.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef QT4_FONTLOADER_H
13 #define QT4_FONTLOADER_H
15 #include "frontends/FontLoader.h"
17 #include "GuiFontMetrics.h"
24 #include <boost/scoped_ptr.hpp>
30 * Qt font loader for LyX. Matches Fonts against
31 * actual QFont instances, and also caches metrics.
36 GuiFontInfo(Font const & f);
40 /// Metrics on the font
41 boost::scoped_ptr<GuiFontMetrics> metrics;
45 /// Hold info about a particular font
46 class GuiFontLoader : public FontLoader
53 virtual ~GuiFontLoader() {}
55 virtual void update();
56 virtual bool available(Font const & f);
57 inline virtual FontMetrics const & metrics(Font const & f) {
58 return *fontinfo(f).metrics.get();
61 /// Get the QFont for this Font
62 QFont const & get(Font const & f) {
63 return fontinfo(f).font;
67 /// Get font info (font + metrics) for the given LyX font.
68 GuiFontInfo & fontinfo(Font const & f) {
69 // fi is a reference to the pointer type (GuiFontInfo *) in the
72 fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
74 fi = new GuiFontInfo(f);
80 GuiFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10];
84 } // namespace frontend
87 #endif // QT4_FONTLOADER_H