X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiFontLoader.h;h=40c15f5ea0b60ab6391a5ae2532d76257b34f23d;hb=b6eacd8d4f86734e8abef3335b190ce12a6a11b5;hp=4ca34b92daa8d413ee4c2129632fabe6144769be;hpb=876d88a86e3c1f6072770bd28ae343e80cc1d769;p=lyx.git diff --git a/src/frontends/qt4/GuiFontLoader.h b/src/frontends/qt4/GuiFontLoader.h index 4ca34b92da..40c15f5ea0 100644 --- a/src/frontends/qt4/GuiFontLoader.h +++ b/src/frontends/qt4/GuiFontLoader.h @@ -9,85 +9,25 @@ * Full author contact details are available in file CREDITS. */ -#ifndef QT4_FONTLOADER_H -#define QT4_FONTLOADER_H +#ifndef GUI_FONTLOADER_H +#define GUI_FONTLOADER_H -#include "frontends/FontLoader.h" - -#include "FontInfo.h" - -#include "GuiFontMetrics.h" - -#include "Encoding.h" - -#include - -#include -#include +class QFont; namespace lyx { -namespace frontend { - -/** - * Qt font loader for LyX. Matches Fonts against - * actual QFont instances, and also caches metrics. - */ -class GuiFontInfo -{ -public: - GuiFontInfo(FontInfo const & f); - - /// The font instance - QFont font; - /// Metrics on the font - boost::scoped_ptr metrics; -}; - - -/// Hold info about a particular font -class GuiFontLoader : public FontLoader -{ -public: - /// - GuiFontLoader(); - /// Destructor - virtual ~GuiFontLoader() {} +class FontInfo; - virtual void update(); - virtual bool available(FontInfo const & f); - inline virtual FontMetrics const & metrics(FontInfo const & f) { - return *fontinfo(f).metrics.get(); - } - - /// 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(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 = - fontinfo_[f.family()][f.series()][f.realShape()][f.size()]; - if (!fi) - fi = new GuiFontInfo(f); - return *fi; - } +namespace frontend { -private: - /// BUTT ugly ! - GuiFontInfo * fontinfo_[NUM_FAMILIES][2][4][10]; -}; +class GuiFontMetrics; +/// Metrics on the font +GuiFontMetrics const & getFontMetrics(FontInfo const & f); +/// Get the QFont for this FontInfo +QFont const & getFont(FontInfo const & f); } // namespace frontend } // namespace lyx -#endif // QT4_FONTLOADER_H +#endif // GUI_FONTLOADER_H