From d4068e14e8923a488f2feee441f48ab0dd23cffb Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 7 Feb 2008 09:12:19 +0000 Subject: [PATCH] The core is now clean enough that we don't need the NoGuiFontLoader/Metrics anymore... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22828 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/Makefile.am | 2 - src/frontends/NoGuiFontLoader.h | 47 ------------------- src/frontends/NoGuiFontMetrics.h | 69 ---------------------------- src/frontends/qt4/GuiApplication.cpp | 12 ----- src/mathed/MathFactory.cpp | 5 ++ 5 files changed, 5 insertions(+), 130 deletions(-) delete mode 100644 src/frontends/NoGuiFontLoader.h delete mode 100644 src/frontends/NoGuiFontMetrics.h diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index adda793d94..ededa99a5e 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -11,8 +11,6 @@ AM_CPPFLAGS += -I$(srcdir)/.. $(BOOST_INCLUDES) liblyxfrontends_la_SOURCES = \ alert.h \ Application.h \ - NoGuiFontLoader.h \ - NoGuiFontMetrics.h \ FontLoader.h \ FontMetrics.h \ KeyModifier.h \ diff --git a/src/frontends/NoGuiFontLoader.h b/src/frontends/NoGuiFontLoader.h deleted file mode 100644 index e22c7ea5ca..0000000000 --- a/src/frontends/NoGuiFontLoader.h +++ /dev/null @@ -1,47 +0,0 @@ -// -*- C++ -*- -/** - * \file NoGuiFontLoader.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Abdelrazak Younes - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef NO_GUI_FONTLOADER_H -#define NO_GUI_FONTLOADER_H - -#include "frontends/FontLoader.h" -#include "frontends/NoGuiFontMetrics.h" - -namespace lyx { -namespace frontend { - -/// Dummy FontLoader for command-line output. -class NoGuiFontLoader : public FontLoader -{ -public: - /// - NoGuiFontLoader() {} - /// - virtual ~NoGuiFontLoader() {} - - /// Update fonts after zoom, dpi, font names, or norm change - virtual void update() {} - - /// Is the given font available ? - virtual bool available(FontInfo const &) { return false; } - - /// Get the Font metrics for this FontInfo - virtual FontMetrics const & metrics(FontInfo const &) { return metrics_; } - -private: - /// - NoGuiFontMetrics metrics_; -}; - -} // namespace frontend -} // namespace lyx - -#endif // NO_GUI_FONTLOADER_H diff --git a/src/frontends/NoGuiFontMetrics.h b/src/frontends/NoGuiFontMetrics.h deleted file mode 100644 index e6d92cd932..0000000000 --- a/src/frontends/NoGuiFontMetrics.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -/** - * \file NoGuiFontMetrics.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Abdelrazak Younes - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef LYX_NO_GUI_FONT_METRICS_H -#define LYX_NO_GUI_FONT_METRICS_H - -#include "frontends/FontMetrics.h" - -#include "Dimension.h" - -#include "support/strfwd.h" - -namespace lyx { -namespace frontend { - -class NoGuiFontMetrics : public FontMetrics -{ -public: - - NoGuiFontMetrics() {} - - virtual ~NoGuiFontMetrics() {} - - virtual int maxAscent() const { return 1; } - - virtual int maxDescent() const { return 1; } - - virtual Dimension const defaultDimension() const { return Dimension(1, 1, 1); } - - virtual int width(char_type) const { return 1; } - - virtual int ascent(char_type) const { return 1; } - - int descent(char_type) const { return 1; } - - virtual int lbearing(char_type) const { return 1; } - - virtual int rbearing(char_type) const { return 1; } - - virtual int width(docstring const & s) const { return s.size(); } - - virtual int signedWidth(docstring const & s) const - { - if (s.size() && s[0] == '-') - return -width(s.substr(1, s.length() - 1)); - return width(s); - } - - virtual Dimension const dimension(char_type) const { return Dimension(1, 1, 1); } - - virtual void rectText(docstring const &, - int & /*width*/, int & /*ascent*/, int & /*descent*/) const {} - - virtual void buttonText(docstring const &, - int & /*width*/, int & /*ascent*/, int & /*descent*/) const {} -}; - -} // namespace frontend -} // namespace lyx - -#endif // LYX_NO_GUI_FONT_METRICS_H diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index dbfef23992..705b9acec7 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -20,8 +20,6 @@ #include "frontends/alert.h" #include "frontends/Application.h" -#include "frontends/NoGuiFontLoader.h" -#include "frontends/NoGuiFontMetrics.h" #include "frontends/FontLoader.h" #include "frontends/FontMetrics.h" @@ -681,11 +679,6 @@ bool GuiApplication::x11EventFilter(XEvent * xev) frontend::FontLoader & theFontLoader() { - static frontend::NoGuiFontLoader no_gui_font_loader; - - if (!use_gui) - return no_gui_font_loader; - BOOST_ASSERT(frontend::guiApp); return frontend::guiApp->fontLoader(); } @@ -699,11 +692,6 @@ frontend::FontMetrics const & theFontMetrics(Font const & f) frontend::FontMetrics const & theFontMetrics(FontInfo const & f) { - static frontend::NoGuiFontMetrics no_gui_font_metrics; - - if (!use_gui) - return no_gui_font_metrics; - BOOST_ASSERT(frontend::guiApp); return frontend::guiApp->fontLoader().metrics(f); } diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index a7d3ba0300..6ca7a4d9f6 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -58,6 +58,8 @@ #include "frontends/FontLoader.h" +#include "LyX.h" // use_gui + using namespace std; using namespace lyx::support; @@ -97,6 +99,9 @@ bool math_font_available(docstring & name) void initSymbols() { + if (!use_gui) + return; + FileName const filename = libFileSearch(string(), "symbols"); LYXERR(Debug::MATHED, "read symbols from " << filename); if (filename.empty()) { -- 2.39.5