X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathFontOld.cpp;h=11ba283fdf9efc51ed1ff593f82b4441cff257bd;hb=3e79e0f5f00add2c735d372f4734cf31f64b7e5f;hp=c14c4e36a8c3c9e8b955572d62aec572b8112f83;hpb=87f155767a59eb2df2a17ccc0c93325e4545c9ff;p=lyx.git diff --git a/src/mathed/InsetMathFontOld.cpp b/src/mathed/InsetMathFontOld.cpp index c14c4e36a8..11ba283fdf 100644 --- a/src/mathed/InsetMathFontOld.cpp +++ b/src/mathed/InsetMathFontOld.cpp @@ -18,8 +18,13 @@ #include "MathSupport.h" #include "MetricsInfo.h" +#include "support/gettext.h" +#include "support/lassert.h" +#include "support/lstrings.h" + #include +using namespace lyx::support; namespace lyx { @@ -30,6 +35,13 @@ InsetMathFontOld::InsetMathFontOld(Buffer * buf, latexkeys const * key) } +std::string InsetMathFontOld::font() const +{ + LASSERT(isAscii(key_->name), return "mathnormal"); + return to_ascii(key_->name); +} + + Inset * InsetMathFontOld::clone() const { return new InsetMathFontOld(*this); @@ -38,33 +50,35 @@ Inset * InsetMathFontOld::clone() const void InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const { - current_mode_ = isTextFont(from_ascii(mi.base.fontname)) + current_mode_ = isTextFont(mi.base.fontname) ? TEXT_MODE : MATH_MODE; - docstring const font = current_mode_ == MATH_MODE - ? "math" + key_->name : "text" + key_->name; + std::string const fontname = current_mode_ == MATH_MODE + ? "math" + font() : "text" + font();// I doubt that this still works // When \cal is used in text mode, the font is not changed - bool really_change_font = font != "textcal"; + bool really_change_font = fontname != "textcal"; - FontSetChanger dummy(mi.base, font, really_change_font); + Changer dummy = really_change_font ? mi.base.changeFontSet(fontname) + : Changer(); cell(0).metrics(mi, dim); - metricsMarkers(dim); + metricsMarkers(mi, dim); } void InsetMathFontOld::draw(PainterInfo & pi, int x, int y) const { - current_mode_ = isTextFont(from_ascii(pi.base.fontname)) + current_mode_ = isTextFont(pi.base.fontname) ? TEXT_MODE : MATH_MODE; - docstring const font = current_mode_ == MATH_MODE - ? "math" + key_->name : "text" + key_->name; + std::string const fontname = current_mode_ == MATH_MODE + ? "math" + font() : "text" + font();// I doubt that this still works // When \cal is used in text mode, the font is not changed - bool really_change_font = font != "textcal"; + bool really_change_font = fontname != "textcal"; - FontSetChanger dummy(pi.base, font, really_change_font); + Changer dummy = really_change_font ? pi.base.changeFontSet(fontname) + : Changer(); cell(0).draw(pi, x + 1, y); drawMarkers(pi, x, y); } @@ -96,7 +110,7 @@ void InsetMathFontOld::normalize(NormalStream & os) const void InsetMathFontOld::infoize(odocstream & os) const { - os << "Font: " << key_->name; + os << bformat(_("Font: %1$s"), key_->name); }