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
This commit is contained in:
Abdelrazak Younes 2008-02-07 09:12:19 +00:00
parent eac609495b
commit d4068e14e8
5 changed files with 5 additions and 130 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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()) {