3 * \file NoGuiFontMetrics.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Abdelrazak Younes
9 * Full author contact details are available in file CREDITS.
12 #ifndef LYX_NO_GUI_FONT_METRICS_H
13 #define LYX_NO_GUI_FONT_METRICS_H
15 #include "frontends/FontMetrics.h"
17 #include "support/docstring.h"
22 class NoGuiFontMetrics : public FontMetrics
28 virtual ~NoGuiFontMetrics() {}
30 virtual int maxAscent() const { return 1; }
32 virtual int maxDescent() const { return 1; }
34 virtual int ascent(char_type) const { return 1; }
36 int descent(char_type) const { return 1; }
38 virtual int lbearing(char_type) const { return 1; }
40 virtual int rbearing(char_type) const { return 1; }
42 virtual int width(char_type const *, size_t n) const { return n; }
44 virtual int signedWidth(docstring const & s) const
46 if (s.size() && s[0] == '-')
47 return -FontMetrics::width(s.substr(1, s.length() - 1));
48 return FontMetrics::width(s);
51 virtual void rectText(docstring const &,
52 int & /*width*/, int & /*ascent*/, int & /*descent*/) const {}
54 virtual void buttonText(docstring const &,
55 int & /*width*/, int & /*ascent*/, int & /*descent*/) const {}
58 } // namespace frontend
61 #endif // LYX_NO_GUI_FONT_METRICS_H