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"
19 #include "GuiFontMetrics.h"
25 #include <boost/scoped_ptr.hpp>
31 * Qt font loader for LyX. Matches Fonts against
32 * actual QFont instances, and also caches metrics.
37 GuiFontInfo(FontInfo const & f);
41 /// Metrics on the font
42 boost::scoped_ptr<GuiFontMetrics> metrics;
46 /// Hold info about a particular font
47 class GuiFontLoader : public FontLoader
54 virtual ~GuiFontLoader() {}
56 virtual void update();
57 virtual bool available(FontInfo const & f);
58 inline virtual FontMetrics const & metrics(FontInfo const & f) {
59 return *fontinfo(f).metrics.get();
62 /// Get the QFont for this FontInfo
63 QFont const & get(FontInfo const & f) {
64 return fontinfo(f).font;
68 /// Get font info (font + metrics) for the given LyX font.
69 GuiFontInfo & fontinfo(FontInfo const & f) {
70 // fi is a reference to the pointer type (GuiFontInfo *) in the
73 fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
75 fi = new GuiFontInfo(f);
81 GuiFontInfo * fontinfo_[NUM_FAMILIES][2][4][10];
85 } // namespace frontend
88 #endif // QT4_FONTLOADER_H