]> git.lyx.org Git - lyx.git/commitdiff
Remove a conversion to_utf8() inside FontSetChanger
authorGuillaume Munch <gm@lyx.org>
Tue, 7 Jun 2016 21:58:55 +0000 (22:58 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 13 Jun 2016 07:46:15 +0000 (08:46 +0100)
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).

Profiling of scrolling inside a document over macro-instensive areas:

Before the patch:
  44,1% BufferView::updateMetrics()
   -> 34,8% InsetMathHull::metrics()
     -> 9,8% FontSetChanger::FontSetChanger()
  28,4% BufferView::draw()

After the patch:
  35,3% BufferView::updateMetrics()
   -> 27,2% InsetMathHull::metrics
     -> 0,4% FontSetChanger::FontSetChanger()
  47,5% BufferView::draw()

FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.

18 files changed:
src/MetricsInfo.cpp
src/MetricsInfo.h
src/mathed/InsetMathBrace.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathEnsureMath.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFont.h
src/mathed/InsetMathFontOld.cpp
src/mathed/InsetMathFontOld.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h
src/mathed/InsetMathSymbol.cpp
src/mathed/MathData.cpp
src/mathed/MathFactory.cpp
src/mathed/MathMacro.cpp
src/mathed/MathMacroTemplate.cpp
src/mathed/MathSupport.cpp
src/mathed/MathSupport.h

index 3353a7d3e65f617facd8496630ecb481c3aac7f7..5e10df1d6d4a307f94191d90eff8e04ba852b0f5 100644 (file)
@@ -66,15 +66,15 @@ MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w)
 }
 
 
-Changer MetricsBase::changeFontSet(docstring const & name, bool cond)
+Changer MetricsBase::changeFontSet(string const & name, bool cond)
 {
        RefChanger<MetricsBase> rc = make_save(*this);
        if (!cond)
                rc->keep();
        else {
                ColorCode oldcolor = font.color();
-               docstring const oldname = from_ascii(fontname);
-               fontname = to_utf8(name);
+               string const oldname = fontname;
+               fontname = name;
                font = sane_font;
                augmentFont(font, name);
                font.setSize(rc->old.font.size());
@@ -87,12 +87,6 @@ Changer MetricsBase::changeFontSet(docstring const & name, bool cond)
 }
 
 
-Changer MetricsBase::changeFontSet(char const * name, bool cond)
-{
-       return changeFontSet(from_ascii(name), cond);
-}
-
-
 /////////////////////////////////////////////////////////////////////////
 //
 // MetricsInfo
index 9a1fff47e5fcadf494726627abaf9629e0b0b3b4..18dbbe354046d7af7c2e93bc62fb193172036117 100644 (file)
@@ -68,8 +68,7 @@ public:
        int textwidth;
 
        /// Temporarily change a full font.
-       Changer changeFontSet(docstring const & font, bool cond = true);
-       Changer changeFontSet(char const * font, bool cond = true);
+       Changer changeFontSet(std::string const & font, bool cond = true);
        /// Temporarily change the font size and the math style.
        Changer changeStyle(Styles style, bool cond = true);
        // Temporarily change to the style suitable for use in fractions
index 8b06f6d546d06c9095814b75dd12c8209b764d61..52ccc01b83055169b456241f980d95242a8eaa93 100644 (file)
@@ -50,7 +50,7 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
        Dimension dim0;
        cell(0).metrics(mi, dim0);
        FontInfo font = mi.base.font;
-       augmentFont(font, from_ascii("mathnormal"));
+       augmentFont(font, "mathnormal");
        Dimension t = theFontMetrics(font).dimension('{');
        dim.asc = max(dim0.asc, t.asc);
        dim.des = max(dim0.des, t.des);
@@ -62,7 +62,7 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
 {
        FontInfo font = pi.base.font;
-       augmentFont(font, from_ascii("mathnormal"));
+       augmentFont(font, "mathnormal");
        font.setShape(UP_SHAPE);
        font.setColor(Color_latex);
        Dimension t = theFontMetrics(font).dimension('{');
index 438d16153cd1f42d300b2cdf1968f302be26b4b3..cd34d4d241b29d8210939305074fc8d779567771 100644 (file)
@@ -106,7 +106,7 @@ InsetMath::mode_type InsetMathDecoration::currentMode() const
 void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        bool really_change_font = currentMode() == TEXT_MODE
-                               && isMathFont(from_ascii(mi.base.fontname));
+                               && isMathFont(mi.base.fontname);
        Changer dummy = mi.base.changeFontSet("textnormal", really_change_font);
 
        cell(0).metrics(mi, dim);
@@ -129,7 +129,7 @@ void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const
 {
        bool really_change_font = currentMode() == TEXT_MODE
-                               && isMathFont(from_ascii(pi.base.fontname));
+                                     && isMathFont(pi.base.fontname);
        Changer dummy = pi.base.changeFontSet("textnormal", really_change_font);
 
        cell(0).draw(pi, x + 1, y);
index 5a4252f682cd275dfde70ff6b85e87749681ed8e..d1e69fb6c23a584b050f3c188eaf0fb7ad25beda 100644 (file)
@@ -38,7 +38,7 @@ Inset * InsetMathEnsureMath::clone() const
 
 void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       bool really_change_font = isTextFont(from_ascii(mi.base.fontname));
+       bool really_change_font = isTextFont(mi.base.fontname);
        Changer dummy = mi.base.changeFontSet("mathnormal", really_change_font);
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
@@ -47,7 +47,7 @@ void InsetMathEnsureMath::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathEnsureMath::draw(PainterInfo & pi, int x, int y) const
 {
-       bool really_change_font = isTextFont(from_ascii(pi.base.fontname));
+       bool really_change_font = isTextFont(pi.base.fontname);
        Changer dummy = pi.base.changeFontSet("mathnormal", really_change_font);
        cell(0).draw(pi, x, y);
        drawMarkers(pi, x, y);
index 7c15b82a29f2db0b0a1ca73df60acaaa34ce7a43..b7b3dfb3558a67279693b4976bf048470c9d7205 100644 (file)
@@ -19,6 +19,7 @@
 #include "MetricsInfo.h"
 
 #include "support/gettext.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 
 #include <ostream>
@@ -38,6 +39,13 @@ Inset * InsetMathFont::clone() const
 }
 
 
+std::string InsetMathFont::font() const
+{
+       LASSERT(isAscii(key_->name), return "mathnormal");
+       return to_ascii(key_->name);
+}
+
+
 InsetMath::mode_type InsetMathFont::currentMode() const
 {
        if (key_->extra == "mathmode")
@@ -58,7 +66,7 @@ bool InsetMathFont::lockedMode() const
 
 void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       Changer dummy = mi.base.changeFontSet(key_->name);
+       Changer dummy = mi.base.changeFontSet(font());
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
 }
@@ -66,7 +74,7 @@ void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
 {
-       Changer dummy = pi.base.changeFontSet(key_->name);
+       Changer dummy = pi.base.changeFontSet(font());
        cell(0).draw(pi, x + 1, y);
        drawMarkers(pi, x, y);
        setPosCache(pi, x, y);
@@ -96,19 +104,20 @@ docstring InsetMathFont::name() const
 void InsetMathFont::validate(LaTeXFeatures & features) const
 {
        InsetMathNest::validate(features);
+       std::string fontname = font();
        if (features.runparams().isLaTeX()) {
                // Make sure amssymb is put in preamble if Blackboard Bold or
                // Fraktur used:
-               if (key_->name == "mathfrak" || key_->name == "mathbb")
+               if (fontname == "mathfrak" || fontname == "mathbb")
                        features.require("amssymb");
-               if (key_->name == "text" || key_->name == "textnormal"
-                               || (key_->name.length() == 6 && key_->name.substr(0, 4) == "text"))
+               if (fontname == "text" || fontname == "textnormal"
+                   || (fontname.length() == 6 && fontname.substr(0, 4) == "text"))
                        features.require("amstext");
-               if (key_->name == "mathscr")
+               if (fontname == "mathscr")
                        features.require("mathrsfs");
-               if (key_->name == "textipa")
+               if (fontname == "textipa")
                        features.require("tipa");
-               if (key_->name == "ce" || key_->name == "cf")
+               if (fontname == "ce" || fontname == "cf")
                        features.require("mhchem");
        } else if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
                features.addCSSSnippet(
index 88c83165e94dd95140ae96f2f8c4fd611e165f4f..945dcf7f3430cd439bee3bfb034d71a513d25993 100644 (file)
@@ -57,6 +57,8 @@ public:
        InsetCode lyxCode() const { return MATH_FONT_CODE; }
 
 private:
+       std::string font() const;
+       ///
        virtual Inset * clone() const;
        /// the font to be used on screen
        latexkeys const * key_;
index 4c54a97c5b0e3d47db694b8ea038a4ae0e00c27e..20f3b1d45b1ec73024a20fdc832670b5d23575c5 100644 (file)
@@ -19,6 +19,7 @@
 #include "MetricsInfo.h"
 
 #include "support/gettext.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 
 #include <ostream>
@@ -34,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);
@@ -42,16 +50,16 @@ 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";
 
-       Changer dummy = mi.base.changeFontSet(font, really_change_font);
+       Changer dummy = mi.base.changeFontSet(fontname, really_change_font);
        cell(0).metrics(mi, dim);
        metricsMarkers(dim);
 }
@@ -59,16 +67,16 @@ void InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const
 
 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";
 
-       Changer dummy = pi.base.changeFontSet(font, really_change_font);
+       Changer dummy = pi.base.changeFontSet(fontname, really_change_font);
        cell(0).draw(pi, x + 1, y);
        drawMarkers(pi, x, y);
 }
index 3046d03d485d305ff30aa55cd41ef95f4de3fa2c..261696d104465b222517338878e61e068849f5a3 100644 (file)
@@ -49,6 +49,8 @@ public:
        InsetCode lyxCode() const { return MATH_FONTOLD_CODE; }
 
 private:
+       std::string font() const;
+       ///
        virtual Inset * clone() const;
        /// the font to be used on screen
        latexkeys const * key_;
index fbf7208189eac1b8d64f706f27e5dd252f12fab1..513a8963345ae7ba0fe0083f02b8e234c4879de6 100644 (file)
@@ -426,15 +426,15 @@ int InsetMathHull::defaultColSpace(col_type col)
 }
 
 
-docstring InsetMathHull::standardFont() const
+string InsetMathHull::standardFont() const
 {
        switch (type_) {
        case hullRegexp:
-               return from_ascii("texttt");
+               return "texttt";
        case hullNone:
-               return from_ascii("lyxnochange");
+               return "lyxnochange";
        default:
-               return from_ascii("mathnormal");
+               return "mathnormal";
        }
 }
 
@@ -501,7 +501,7 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
        }
 
        if (numberedType()) {
-               Changer dummy = mi.base.changeFontSet(from_ascii("mathbf"));
+               Changer dummy = mi.base.changeFontSet("mathbf");
                int l = 0;
                for (row_type row = 0; row < nrows(); ++row)
                        l = max(l, mathed_string_width(mi.base.font, nicelabel(row)));
@@ -592,7 +592,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
                int const xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
                for (row_type row = 0; row < nrows(); ++row) {
                        int const yy = y + rowinfo_[row].offset_;
-                       Changer dummy = pi.base.changeFontSet(from_ascii("mathrm"));
+                       Changer dummy = pi.base.changeFontSet("mathrm");
                        docstring const nl = nicelabel(row);
                        pi.draw(xx, yy, nl);
                }
index 1fdf0d098a5429f6be2da44c65db3947a0cf8f14..6f2f850e3b45d2f06e0cc91cf3e4fc401de699b5 100644 (file)
@@ -235,7 +235,7 @@ private:
        /// change number of columns, split or combine columns if necessary.
        void changeCols(col_type);
        ///
-       docstring standardFont() const;
+       std::string standardFont() const;
        ///
        ColorCode standardColor() const;
        /// consistency check
index 9d923ce76786bdd1de9729bf1b65c5ffda8b4ff9..a4dc36abf090ec0de1cb26e6c3f720d2ef3c530b 100644 (file)
@@ -69,7 +69,7 @@ void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
                                         sym_->extra == "mathalpha" &&
                                         mi.base.fontname == "mathit";
        std::string const font = italic_upcase_greek ? "cmm" : sym_->inset;
-       Changer dummy = mi.base.changeFontSet(from_ascii(font));
+       Changer dummy = mi.base.changeFontSet(font);
        mathed_string_dim(mi.base.font, sym_->draw, dim);
        docstring::const_reverse_iterator rit = sym_->draw.rbegin();
        kerning_ = mathed_char_kerning(mi.base.font, *rit);
@@ -118,7 +118,7 @@ void InsetMathSymbol::draw(PainterInfo & pi, int x, int y) const
        //else
        //      x += support::iround(0.0833 * em);
 
-       Changer dummy = pi.base.changeFontSet(from_ascii(font));
+       Changer dummy = pi.base.changeFontSet(font);
        pi.draw(x, y - h_, sym_->draw);
 }
 
index 7e302c8ac7b8655f860fb307f8bde1812a69b79e..8ac4ac1273ac33ebd67ab933e32113722f3164d8 100644 (file)
@@ -285,7 +285,7 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
                        continue;
 
                FontInfo font = mi.base.font;
-               augmentFont(font, from_ascii("mathnormal"));
+               augmentFont(font, "mathnormal");
                dim.wid += mathed_string_width(font, completion);
        }
        // Cache the dimension.
@@ -334,7 +334,7 @@ void MathData::draw(PainterInfo & pi, int x, int y) const
                if (completion.length() == 0)
                        continue;
                FontInfo f = pi.base.font;
-               augmentFont(f, from_ascii("mathnormal"));
+               augmentFont(f, "mathnormal");
 
                // draw the unique and the non-unique completion part
                // Note: this is not time-critical as it is
index f2e980a2db7b47b0e8164a75cddaa9954c384678..82f885b3132229ece9d951df40448113c6ccc46b 100644 (file)
@@ -92,7 +92,7 @@ bool isMathFontAvailable(string & name)
                return false;
 
        FontInfo f;
-       augmentFont(f, from_ascii(name));
+       augmentFont(f, name);
 
        // Do we have the font proper?
        if (theFontLoader().available(f))
@@ -233,7 +233,7 @@ void initSymbols()
                docstring help;
                is >> tmp.name >> help;
                tmp.inset = to_ascii(help);
-               if (isFontName(help))
+               if (isFontName(tmp.inset))
                        is >> charid >> fallbackid >> tmp.extra >> tmp.xmlname;
                else
                        is >> tmp.extra;
@@ -253,7 +253,7 @@ void initSymbols()
                        continue;
                }
 
-               if (isFontName(from_ascii(tmp.inset))) {
+               if (isFontName(tmp.inset)) {
                        // tmp.inset _is_ the fontname here.
                        // create fallbacks if necessary
 
index d745b010091513c624abda72004bc3c303eaca08..3def7f9f1411c10e343e40522fb4dc8f819b92eb 100644 (file)
@@ -433,7 +433,7 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
                if (lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX
                    && d->editing_[mi.base.bv]) {
                        FontInfo font = mi.base.font;
-                       augmentFont(font, from_ascii("lyxtex"));
+                       augmentFont(font, "lyxtex");
                        Dimension namedim;
                        mathed_string_dim(font, name(), namedim);
 #if 0
@@ -622,7 +622,7 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
                if (drawBox && d->editing_[pi.base.bv]) {
                        // draw header and rectangle around
                        FontInfo font = pi.base.font;
-                       augmentFont(font, from_ascii("lyxtex"));
+                       augmentFont(font, "lyxtex");
                        font.setSize(FONT_SIZE_TINY);
                        font.setColor(Color_mathmacrolabel);
                        Dimension namedim;
index 8516c39b0a4e4dbc8f6f3d4e1e81855cdc712fe0..5c7ae707131a1095bc4d1478f67af5453e779580 100644 (file)
@@ -543,7 +543,7 @@ void MathMacroTemplate::createLook(int args) const
 
 void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       Changer dummy1 = mi.base.changeFontSet(from_ascii("mathnormal"));
+       Changer dummy1 = mi.base.changeFontSet("mathnormal");
        Changer dummy2 = mi.base.changeStyle(LM_ST_TEXT);
 
        // valid macro?
@@ -587,7 +587,7 @@ void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
 {
        // FIXME: Calling Changer on the same object repeatedly is inefficient.
        Changer dummy0 = pi.base.font.changeColor(Color_math);
-       Changer dummy1 = pi.base.changeFontSet(from_ascii("mathnormal"));
+       Changer dummy1 = pi.base.changeFontSet("mathnormal");
        Changer dummy2 = pi.base.changeStyle(LM_ST_TEXT);
 
        setPosCache(pi, x, y);
index 6a393cb5f5054e8724f41a1333d6621631d9297b..e18a351c82543e46d4a1cfa28226f5607d4f85fa 100644 (file)
@@ -659,7 +659,7 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h,
 void metricsStrRedBlack(MetricsInfo & mi, Dimension & dim, docstring const & str)
 {
        FontInfo font = mi.base.font;
-       augmentFont(font, from_ascii("mathnormal"));
+       augmentFont(font, "mathnormal");
        mathed_string_dim(font, str, dim);
 }
 
@@ -667,7 +667,7 @@ void metricsStrRedBlack(MetricsInfo & mi, Dimension & dim, docstring const & str
 void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
 {
        FontInfo f = pi.base.font;
-       augmentFont(f, from_ascii("mathnormal"));
+       augmentFont(f, "mathnormal");
        f.setColor(Color_latex);
        pi.pain.text(x, y, str, f);
 }
@@ -676,7 +676,7 @@ void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str)
 void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str)
 {
        FontInfo f = pi.base.font;
-       augmentFont(f, from_ascii("mathnormal"));
+       augmentFont(f, "mathnormal");
        f.setColor(Color_foreground);
        pi.pain.text(x, y, str, f);
 }
@@ -806,11 +806,10 @@ fontinfo fontinfos[] = {
 };
 
 
-fontinfo * lookupFont(docstring const & name0)
+fontinfo * lookupFont(string const & name)
 {
        //lyxerr << "searching font '" << name << "'" << endl;
        int const n = sizeof(fontinfos) / sizeof(fontinfo);
-       string name = to_utf8(name0);
        for (int i = 0; i < n; ++i)
                if (fontinfos[i].cmd_ == name) {
                        //lyxerr << "found '" << i << "'" << endl;
@@ -820,7 +819,7 @@ fontinfo * lookupFont(docstring const & name0)
 }
 
 
-fontinfo * searchFont(docstring const & name)
+fontinfo * searchFont(string const & name)
 {
        fontinfo * f = lookupFont(name);
        return f ? f : fontinfos;
@@ -829,27 +828,27 @@ fontinfo * searchFont(docstring const & name)
 }
 
 
-bool isFontName(docstring const & name)
+bool isFontName(string const & name)
 {
        return lookupFont(name);
 }
 
 
-bool isMathFont(docstring const & name)
+bool isMathFont(string const & name)
 {
        fontinfo * f = lookupFont(name);
        return f && f->color_ == Color_math;
 }
 
 
-bool isTextFont(docstring const & name)
+bool isTextFont(string const & name)
 {
        fontinfo * f = lookupFont(name);
        return f && f->color_ == Color_foreground;
 }
 
 
-FontInfo getFont(docstring const & name)
+FontInfo getFont(string const & name)
 {
        FontInfo font;
        augmentFont(font, name);
@@ -857,7 +856,7 @@ FontInfo getFont(docstring const & name)
 }
 
 
-void fakeFont(docstring const & orig, docstring const & fake)
+void fakeFont(string const & orig, string const & fake)
 {
        fontinfo * forig = searchFont(orig);
        fontinfo * ffake = searchFont(fake);
@@ -867,22 +866,22 @@ void fakeFont(docstring const & orig, docstring const & fake)
                forig->shape_  = ffake->shape_;
                forig->color_  = ffake->color_;
        } else {
-               lyxerr << "Can't fake font '" << to_utf8(orig) << "' with '"
-                      << to_utf8(fake) << "'" << endl;
+               lyxerr << "Can't fake font '" << orig << "' with '"
+                      << fake << "'" << endl;
        }
 }
 
 
-void augmentFont(FontInfo & font, docstring const & name)
+void augmentFont(FontInfo & font, string const & name)
 {
        static bool initialized = false;
        if (!initialized) {
                initialized = true;
                // fake fonts if necessary
-               if (!theFontLoader().available(getFont(from_ascii("mathfrak"))))
-                       fakeFont(from_ascii("mathfrak"), from_ascii("lyxfakefrak"));
-               if (!theFontLoader().available(getFont(from_ascii("mathcal"))))
-                       fakeFont(from_ascii("mathcal"), from_ascii("lyxfakecal"));
+               if (!theFontLoader().available(getFont("mathfrak")))
+                       fakeFont("mathfrak", "lyxfakefrak");
+               if (!theFontLoader().available(getFont("mathcal")))
+                       fakeFont("mathcal", "lyxfakecal");
        }
        fontinfo * info = searchFont(name);
        if (info->family_ != inh_family)
index c14f21a807b21d83b149720c5c8fba6849ef956e..74b7465f10d5934da5a56b807a40a1853d872d41 100644 (file)
@@ -55,13 +55,13 @@ void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & s);
 
 void math_font_max_dim(FontInfo const &, int & asc, int & desc);
 
-void augmentFont(FontInfo & f, docstring const & cmd);
+void augmentFont(FontInfo & f, std::string const & cmd);
 
-bool isFontName(docstring const & name);
+bool isFontName(std::string const & name);
 
-bool isMathFont(docstring const & name);
+bool isMathFont(std::string const & name);
 
-bool isTextFont(docstring const & name);
+bool isTextFont(std::string const & name);
 
 bool isAlphaSymbol(MathAtom const & at);