#include "frontends/FontMetrics.h"
+#include "Dimension.h"
+
#include "support/docstring.h"
namespace lyx {
namespace frontend {
-class NoGuiFontMetrics: public FontMetrics
+class NoGuiFontMetrics : public FontMetrics
{
public:
virtual int maxAscent() const { return 1; }
virtual int maxDescent() const { return 1; }
-
- virtual int ascent(lyx::char_type) const { return 1; }
-
- int descent(lyx::char_type) const { return 1; }
-
- virtual int lbearing(lyx::char_type) const { return 1; }
-
- virtual int rbearing(lyx::char_type) const { return 1; }
-
- virtual int width(lyx::char_type const *, size_t n) const { return n; }
-
- virtual int signedWidth(lyx::docstring const & s) const
+
+ 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[0] == '-')
- return -FontMetrics::width(s.substr(1, s.length() - 1));
- else
- return FontMetrics::width(s);
+ if (s.size() && s[0] == '-')
+ return -width(s.substr(1, s.length() - 1));
+ return width(s);
}
-
- virtual void rectText(lyx::docstring const &,
- int & width,
- int & ascent,
- int & descent) const {};
-
- virtual void buttonText(lyx::docstring const &,
- int & width,
- int & ascent,
- int & descent) const {};
+
+ 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