#include <config.h>
-#include "metricsinfo.h"
-#include "mathed/math_support.h"
-#include "frontends/Painter.h"
#include "BufferView.h"
#include "LColor.h"
+#include "metricsinfo.h"
+
+#include "mathed/MathSupport.h"
+
+#include "frontends/Painter.h"
+
+#include <boost/assert.hpp>
+
+
+namespace lyx {
using std::string;
{}
-
MetricsBase::MetricsBase(BufferView * b, LyXFont const & f, int w)
: bv(b), font(f), style(LM_ST_TEXT), fontname("mathnormal"),
textwidth(w)
-PainterInfo::PainterInfo(BufferView * bv)
- : pain(bv->painter())
+PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
+ : pain(painter), ltr_pos(false), erased_(false)
{
base.bv = bv;
}
-void PainterInfo::draw(int x, int y, char c)
+void PainterInfo::draw(int x, int y, char_type c)
{
pain.text(x, y, c, base.font);
}
+void PainterInfo::draw(int x, int y, docstring const & str)
+{
+ pain.text(x, y, str, base.font);
+}
+
+
Styles smallerScriptStyle(Styles st)
{
switch (st) {
{}
+
ShapeChanger::ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape)
: Changer<LyXFont, LyXFont::FONT_SHAPE>(font)
{
orig_.setShape(shape);
}
+
ShapeChanger::~ShapeChanger()
{
orig_.setShape(save_);
StyleChanger::StyleChanger(MetricsBase & mb, Styles style)
: Changer<MetricsBase>(mb)
{
- static const int diff[4][4] = { { 0, 0, -3, -5 },
- { 0, 0, -3, -5 },
- { 3, 3, 0, -2 },
- { 5, 5, 2, 0 } };
+ static const int diff[4][4] =
+ { { 0, 0, -3, -5 },
+ { 0, 0, -3, -5 },
+ { 3, 3, 0, -2 },
+ { 5, 5, 2, 0 } };
save_ = mb;
int t = diff[mb.style][style];
if (t > 0)
: Changer<MetricsBase>(mb)
{
save_ = mb;
+ LyXFont::FONT_SIZE oldsize = save_.font.size();
mb.fontname = name;
mb.font = LyXFont();
+ augmentFont(mb.font, from_ascii(name));
+ mb.font.setSize(oldsize);
+}
+
+
+FontSetChanger::FontSetChanger(MetricsBase & mb, docstring const & name)
+ : Changer<MetricsBase>(mb)
+{
+ save_ = mb;
+ LyXFont::FONT_SIZE oldsize = save_.font.size();
+ mb.fontname = to_utf8(name);
+ mb.font = LyXFont();
augmentFont(mb.font, name);
+ mb.font.setSize(oldsize);
}
ColorChanger::ColorChanger(LyXFont & font, string const & color)
: Changer<LyXFont, string>(font)
{
- save_ = lcolor.getFromGUIName(color);
- font.setColor(lcolor.getFromGUIName(color));
+ save_ = lcolor.getFromLyXName(color);
+ font.setColor(lcolor.getFromLyXName(color));
}
ColorChanger::~ColorChanger()
{
- orig_.setColor(lcolor.getFromGUIName(save_));
+ orig_.setColor(lcolor.getFromLyXName(save_));
}
+
+
+} // namespace lyx