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 LyXFonts against
29 * actual QFont instances, and also caches metrics.
33 QLFontInfo(LyXFont const & f);
37 /// Metrics on the font
38 boost::scoped_ptr<GuiFontMetrics> metrics;
42 /// Hold info about a particular font
43 class GuiFontLoader: public FontLoader
50 virtual ~GuiFontLoader();
52 virtual void update();
53 virtual bool available(LyXFont const & f);
54 inline virtual FontMetrics const & metrics(LyXFont const & f) {
55 return *fontinfo(f).metrics.get();
58 /// Get the QFont for this LyXFont
59 QFont const & get(LyXFont const & f) {
60 return fontinfo(f).font;
64 /// Get font info (font + metrics) for the given LyX font.
65 QLFontInfo & fontinfo(LyXFont const & f) {
66 // fi is a reference to the pointer type (QLFontInfo *) in the
69 fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
71 fi = new QLFontInfo(f);
77 QLFontInfo * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
81 } // namespace frontend
84 #endif // QT4_FONTLOADER_H