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"
28 * Qt font loader for LyX. Matches Fonts against
29 * actual QFont instances, and also caches metrics.
34 GuiFontInfo(Font const & f);
38 /// Metrics on the font
39 boost::scoped_ptr<GuiFontMetrics> metrics;
43 /// Hold info about a particular font
44 class GuiFontLoader : public FontLoader
51 virtual ~GuiFontLoader() {}
53 virtual void update();
54 virtual bool available(Font const & f);
55 inline virtual FontMetrics const & metrics(Font const & f) {
56 return *fontinfo(f).metrics.get();
59 /// Get the QFont for this Font
60 QFont const & get(Font const & f) {
61 return fontinfo(f).font;
65 /// Get font info (font + metrics) for the given LyX font.
66 GuiFontInfo & fontinfo(Font const & f) {
67 // fi is a reference to the pointer type (GuiFontInfo *) in the
70 fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
72 fi = new GuiFontInfo(f);
78 GuiFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10];
82 } // namespace frontend
85 #endif // QT4_FONTLOADER_H