using std::string;
using std::auto_ptr;
+using std::vector;
InsetMathExFunc::InsetMathExFunc(string const & name)
void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
{
// FIXME UNICODE
- mathed_string_dim(mi.base.font, from_utf8(name_), dim_);
+ vector<char_type> n(name_.begin(), name_.end());
+ mathed_string_dim(mi.base.font, n, dim_);
}
using std::max;
using std::auto_ptr;
using std::endl;
+using std::vector;
MathMacro::MathMacro(string const & name, int numargs)
void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (!MacroTable::globalMacros().has(name())) {
- mathed_string_dim(mi.base.font, from_utf8("Unknown: " + name()), dim);
+ string t = "Unknown: " + name();
+ vector<char_type> n(t.begin(), t.end());
+ mathed_string_dim(mi.base.font, n, dim);
} else if (editing(mi.base.bv)) {
// FIXME UNICODE
asArray(from_utf8(MacroTable::globalMacros().get(name()).def()), tmpl_);
tmpl_.draw(pi, x + w + 12, h);
h += tmpl_.descent();
Dimension ldim;
- mathed_string_dim(font, from_ascii("#1: "), ldim);
+ string t = "#1: ";
+ vector<char_type> n(t.begin(), t.end());
+ mathed_string_dim(font, n, ldim);
for (idx_type i = 0; i < nargs(); ++i) {
MathArray const & c = cell(i);
h += max(c.ascent(), ldim.asc) + 5;
using std::string;
using std::auto_ptr;
-
+using std::vector;
InsetMathNumber::InsetMathNumber(string const & s)
: str_(s)
void InsetMathNumber::metrics(MetricsInfo & mi, Dimension & dim) const
{
// FIXME UNICODE
- mathed_string_dim(mi.base.font, from_utf8(str_), dim);
+ vector<char_type> n(str_.begin(), str_.end());
+ mathed_string_dim(mi.base.font, n, dim);
}
using std::string;
using std::auto_ptr;
+using std::vector;
InsetMathString::InsetMathString(string const & s)
void InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const
{
// FIXME UNICODE
- mathed_string_dim(mi.base.font, from_utf8(str_), dim);
+ vector<char_type> n(str_.begin(), str_.end());
+ mathed_string_dim(mi.base.font, n, dim);
}
int const em = mathed_char_width(mi.base.font, 'M');
FontSetChanger dummy(mi.base, sym_->inset.c_str());
// FIXME UNICODE
- mathed_string_dim(mi.base.font, from_utf8(sym_->draw), dim);
+ mathed_string_dim(mi.base.font, sym_->draw, dim);
// correct height for broken cmex and wasy font
#if defined(__APPLE__) && defined(__GNUC__)
if (sym_->inset == "cmex") {
FontSetChanger dummy(pi.base, sym_->inset.c_str());
// FIXME UNICODE
- pi.draw(x, y - h_, from_utf8(sym_->draw));
+ docstring n(sym_->draw.begin(), sym_->draw.end());
+ pi.draw(x, y - h_, n);
}
using std::string;
using std::auto_ptr;
+using std::vector;
InsetMathUnknown::InsetMathUnknown(string const & nm, bool final, bool black)
void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
{
// FIXME UNICODE
- mathed_string_dim(mi.base.font, from_utf8(name_), dim);
+ vector<char_type> n(name_.begin(), name_.end());
+ mathed_string_dim(mi.base.font, n, dim);
dim_ = dim;
}
using std::string;
using std::endl;
using std::istringstream;
+using std::vector;
bool has_math_fonts;
if (tmp.extra == "func" || tmp.extra == "funclim" || tmp.extra == "special") {
lyxerr[Debug::MATHED] << "symbol abuse for " << tmp.name << endl;
- tmp.draw = tmp.name;
+ // FIXME UNICODE
+ vector<char_type> n(tmp.name.begin(), tmp.name.end());
+ tmp.draw = n;
} else if (math_font_available(tmp.inset)) {
lyxerr[Debug::MATHED] << "symbol available for " << tmp.name << endl;
- tmp.draw += char(charid);
+ tmp.draw.push_back(char_type(charid));
} else if (fallbackid && math_font_available(symbol_font)) {
if (tmp.inset == "cmex")
tmp.inset = "lyxsymbol";
else
tmp.inset = "lyxboldsymbol";
lyxerr[Debug::MATHED] << "symbol fallback for " << tmp.name << endl;
- tmp.draw += char(fallbackid);
+ tmp.draw.push_back(char_type(fallbackid));
} else {
lyxerr[Debug::MATHED] << "faking " << tmp.name << endl;
- tmp.draw = tmp.name;
+ vector<char_type> n(tmp.name.begin(),
+ tmp.name.end());
+
+ tmp.draw = n;
tmp.inset = "lyxtex";
}
} else {
using std::endl;
using std::auto_ptr;
using std::size_t;
+using std::vector;
MathMacroArgument::MathMacroArgument(size_t n)
void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
{
- mathed_string_dim(mi.base.font, from_utf8(str_), dim_);
+ vector<char_type> n(str_, str_ + 3);
+ mathed_string_dim(mi.base.font, n, dim_);
dim = dim_;
}
#ifndef MATH_PARSER_H
#define MATH_PARSER_H
-#include <string>
+#include "support/types.h"
+#include <string>
+#include <vector>
namespace lyx {
/// name of a inset that handles that macro
std::string inset;
/// position of the ting in a font
- std::string draw;
+ std::vector<char_type> draw;
/// operator/..., fontname e
std::string extra;
/// how is this called as XML entity?
using std::string;
using std::max;
using std::endl;
+using std::vector;
///
}
-void mathed_string_dim(LyXFont const & font, docstring const & s, Dimension & dim)
+void mathed_string_dim(LyXFont const & font,
+ vector<char_type> const & s,
+ Dimension & dim)
{
frontend::FontMetrics const & fm = theFontMetrics(font);
dim.asc = 0;
dim.des = 0;
- for (docstring::const_iterator it = s.begin(); it != s.end(); ++it) {
+ for (vector<char_type>::const_iterator it = s.begin();
+ it != s.end();
+ ++it) {
dim.asc = max(dim.asc, fm.ascent(*it));
dim.des = max(dim.des, fm.descent(*it));
}
- dim.wid = fm.width(s);
+ dim.wid = fm.width(&s[0], s.size());
}
#include "support/docstring.h"
#include <string>
-
+#include <vector>
namespace lyx {
void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
std::string const & name);
-void mathed_string_dim(LyXFont const & font, docstring const & s, Dimension & dim);
+void mathed_string_dim(LyXFont const & font,
+ std::vector<char_type> const & s,
+ Dimension & dim);
+
int mathed_string_width(LyXFont const &, docstring const & s);
void drawStrRed(PainterInfo & pi, int x, int y, docstring const & s);