]> git.lyx.org Git - lyx.git/blob - src/frontends/NoGuiFontMetrics.h
hopefully fix tex2lyx linking.
[lyx.git] / src / frontends / NoGuiFontMetrics.h
1 // -*- C++ -*-
2 /**
3  * \file NoGuiFontMetrics.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LYX_NO_GUI_FONT_METRICS_H
13 #define LYX_NO_GUI_FONT_METRICS_H
14
15 #include "frontends/FontMetrics.h"
16
17 #include "support/docstring.h"
18
19 namespace lyx {
20 namespace frontend {
21
22 class NoGuiFontMetrics : public FontMetrics
23 {
24 public:
25
26         NoGuiFontMetrics() {}
27
28         virtual ~NoGuiFontMetrics() {}
29
30         virtual int maxAscent() const { return 1; }
31
32         virtual int maxDescent() const { return 1; }
33         
34         virtual int ascent(char_type) const { return 1; }
35         
36         int descent(char_type) const { return 1; }
37         
38         virtual int lbearing(char_type) const { return 1; }
39         
40         virtual int rbearing(char_type) const { return 1; }
41         
42         virtual int width(char_type const *, size_t n) const { return n; }
43         
44         virtual int signedWidth(docstring const & s) const
45         {
46                 if (s.size() && s[0] == '-')
47                         return -FontMetrics::width(s.substr(1, s.length() - 1));
48                 return FontMetrics::width(s);
49         }
50         
51         virtual void rectText(docstring const &,
52                 int & /*width*/, int & /*ascent*/, int & /*descent*/) const {}
53         
54         virtual void buttonText(docstring const &,
55                 int & /*width*/, int & /*ascent*/, int & /*descent*/) const {}
56 };
57
58 } // namespace frontend
59 } // namespace lyx
60
61 #endif // LYX_NO_GUI_FONT_METRICS_H