mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
8f98ec35e4
http://bugzilla.lyx.org/show_bug.cgi?id=2900 The only drawback is that it requires about 20Mo extra-memory when loading the UserGuide. If it turns out to be too much, we can switch to a QHash based solution instead of a table. * dimension.[Ch]: - Dimension(LyXFont const, char_typec): new ctor - set(LyXFont const & font, char_type c): new method. * frontends/FontMetrics.h: - width(char_type): is now a pure virtual method. * GuiFontMetrics: - CharMetrics: new structure; - the metrics cache now also cache ascent and descent. This is especially useful for mathed. * MathSupport.[Ch]: - mathed_char_dim(): deleted. We now use Dimension::set() directly instead. * rowpainter.C: fixe empty space. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16124 a592a061-630c-0410-9148-cb99ea01b6c8
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
// -*- 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 "support/docstring.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 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(char_type const *, size_t n) const { return n; }
|
|
|
|
virtual int signedWidth(docstring const & s) const
|
|
{
|
|
if (s.size() && s[0] == '-')
|
|
return -FontMetrics::width(s.substr(1, s.length() - 1));
|
|
return FontMetrics::width(s);
|
|
}
|
|
|
|
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
|